《缓冲区溢出攻击实践》以实践者角度介绍了初级缓冲区溢出攻击方法,本文从原理上对该方法做原理性介绍。
(gdb) disassemble main
Dump of assembler code for function main:
0x08048484 <+0>: push %ebp
0x08048485 <+1>: mov %esp,%ebp
0x08048487 <+3>: and $0xfffffff0,%esp
0x0804848a <+6>: sub $0x40,%esp
0x0804848d <+9>: mov $0x80485e0,%edx
0x08048492 <+14>: mov $0x80485e2,%eax
0x08048497 <+19>: mov %edx,0x4(%esp)
0x0804849b <+23>: mov %eax,(%esp)
0x0804849e <+26>: call 0x80483c0
0x080484a3 <+31>: mov %eax,0x3c(%esp)
0x080484a7 <+35>: cmpl $0x0,0x3c(%esp)
0x080484ac <+40>: jne 0x80484c1
0x080484ae <+42>: movl $0x80485ea,(%esp)
0x080484b5 <+49>: call 0x8048380
0x080484ba <+54>: mov $0x1,%eax
0x080484bf <+59>: jmp 0x80484ff
0x080484c1 <+61>: lea 0x1c(%esp),%eax
0x080484c5 <+65>: mov 0x3c(%esp),%edx
0x080484c9 <+69>: mov %edx,0xc(%esp)
0x080484cd <+73>: movl $0x1,0x8(%esp)
0x080484d5 <+81>: movl $0x400,0x4(%esp)
0x080484dd <+89>: mov %eax,(%esp)
0x080484e0 <+92>: call 0x8048390
0x080484e5 <+97>: mov $0x80485f0,%eax
0x080484ea <+102>: lea 0x1c(%esp),%edx
0x080484ee <+106>: mov %edx,0x4(%esp)
0x080484f2 <+110>: mov %eax,(%esp)
0x080484f5 <+113>: call 0x8048370
0x080484fa <+118>: mov $0x0,%eax
0x080484ff <+123>: leave
0x08048500 <+124>: ret
End of assembler dump.