![]() |
|
[C] Executing shellcode - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] Executing shellcode (/showthread.php?tid=6109007) |
Executing shellcode - ShallowME - Sep 13, 2020 Code # include <stdlib.h>Getting an access violation error. What gives? RE: Executing shellcode - saltycracker - Sep 13, 2020 This might point you in the right direction.. Advice right from GCC's C compiler. Quote:error: variable-sized object may not be initialized Spoiler (Click to View) Another copy and paste... https://www.exploit-db.com/exploits/37758 RE: Executing shellcode - HFDone - Sep 13, 2020 which os you using is it 32 \ 64 shellcode where you get the shellcode ... probably its from your shell code try this shell code https://www.exploit-db.com/exploits/28996 and you better use virtualalloc over virtualprotect RE: Executing shellcode - ShallowME - Sep 13, 2020 (Sep 13, 2020 09:40 AM)HFDone Wrote: which os you using is it 32 \ 64 shellcode where you get the shellcode ... x86 it is. (Sep 13, 2020 09:21 AM)saltycracker Wrote: This might point you in the right direction.. Advice right from GCC's C compiler.I did hardcode the size to no avail. Never said it was mine, to begin with. RE: Executing shellcode - gurlhackerclub - Sep 14, 2020 Just a shot in the dark. Could turning off DEP (Data Execution Prevention) help in your test? Or adding an exception in DEP? I think most exploits get around this by using gadget chains. I don't know. All too complex for me. RE: Executing shellcode - ShallowME - Sep 15, 2020 (Sep 14, 2020 01:24 PM)gurlhackerclub Wrote: Just a shot in the dark. Could turning off DEP (Data Execution Prevention) help in your test? Or adding an exception in DEP?You can give access to execute the shellcode using PAGE_EXECUTE flag and such to go around DEP. RE: Executing shellcode - Sparkling Jack - Sep 15, 2020 Use this code instead. I've tested my code and it works well. Code shell = VirtualAlloc(0, n_Size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);RE: Executing shellcode - hell-o-world - Oct 7, 2020 (Sep 15, 2020 06:47 PM)Sparkling Jack Wrote: Use this code instead. Thanks for sharing RE: Executing shellcode - Goodies - Oct 15, 2020 You should never have memory that is PAGE_EXECUTE_READWRITE. That is something any extremely simple detection software would be able to identify. Instead, you should use VirtualAlloc to allocate the memory as PAGE_READWRITE. After you acquire the memory, you can use WriteProcessMemory or RtlCopyMemory depending on if the memory is remote or local. After that, you can use VirtualProtect to change the permissions to PAGE_EXECUTE_READ so that it is never executable and writable at the same time. This is typically referred to as "W^X" (Write xor Execute, one or the other, but not both). Try this on for size. Just wrote it and works fine. Code #define WIN32_LEAN_AND_MEAN |