C, ASM, and Shellcode

i'm trying to write a simple loader with custom shellcode in order to practice AV evasion, but am running into issues when trying to convert an advanced C function to shellcode. i followed the shellcode creation process here, but instead using a ~50 line reverse shell script condensed to a single function that can be called on its own to pop a reverse shell. the function pops a reverse shell when compiled on its own, but when i convert to shellcode from assembly and try to invoke it this way it fails (buf being the unsigned char[] shellcode):

int (*RunShell)() = (int(*)())buf;
RunShell();

does it have to do with the nullbytes, nops, and offsets in the shellcode? perhaps the dependencies in the original C code? if anyone has any tips, articles or references for this it'd be much appreciated

submitted by /u/Acrobatic-Boot-3843
[link] [comments]

from hacking: security in practice https://ift.tt/cQXw9IU

Comments