Skip to content

Instantly share code, notes, and snippets.

@Ga-ryo
Created March 7, 2016 14:06
Show Gist options
  • Save Ga-ryo/a6b4bbe4b1f2f51457cd to your computer and use it in GitHub Desktop.
Save Ga-ryo/a6b4bbe4b1f2f51457cd to your computer and use it in GitHub Desktop.
#include <stdio.h>
//gcc exec_shellcode.c -o exec_shellcode -m32 -z execstack -fno-stack-protector
char sc[] = "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69"
"\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80";
int main(){
int a=0xdeadbeef;
//pointer incremetn by its size
*(int *)(&a + 2) = sc;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment