Shellcode validation via C pointer

Ahmad Avatar

C snippet to test the shellcode

replace your shellcode with your custom payload

 

char shellcode[] = "\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc";

int main(int argc, char **argv){
        int (*target)();
        target = (int(*)())shellcode;
        (int)(*target)();
}

compile options

gcc shellcode.c -o shellcode  -fno-stack-protector -z execstack
gdb ./shellcode

 

Enjoying this article?

Subscribe to get new posts delivered straight to your inbox. No spam, unsubscribe anytime.

No spam. Unsubscribe anytime.

You may also like

See All blog →

Leave a Comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.