Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 32-bit stack overflow
- Dump of assembler code for function main:
- 0x0804850e <+0>: lea 0x4(%esp),%ecx
- 0x08048512 <+4>: and $0xfffffff0,%esp
- 0x08048515 <+7>: pushl -0x4(%ecx)
- 0x08048518 <+10>: push %ebp
- 0x08048519 <+11>: mov %esp,%ebp
- 0x0804851b <+13>: push %ecx
- 0x0804851c <+14>: sub $0x14,%esp
- 0x0804851f <+17>: mov %gs:0x14,%eax
- 0x08048525 <+23>: mov %eax,-0xc(%ebp)
- 0x08048528 <+26>: xor %eax,%eax
- 0x0804852a <+28>: call 0x80484cb <func>
- 0x0804852f <+33>: movl $0x1,-0x10(%ebp)
- 0x08048536 <+40>: sub $0x8,%esp
- 0x08048539 <+43>: lea -0x10(%ebp),%eax
- 0x0804853c <+46>: push %eax
- 0x0804853d <+47>: push $0x80485f0
- 0x08048542 <+52>: call 0x8048370 <printf@plt>
- 0x08048547 <+57>: add $0x10,%esp
- 0x0804854a <+60>: mov $0x0,%eax
- 0x0804854f <+65>: mov -0xc(%ebp),%edx
- 0x08048552 <+68>: xor %gs:0x14,%edx
- 0x08048559 <+75>: je 0x8048560 <main+82>
- ---Type <return> to continue, or q <return> to quit---
- 0x0804855b <+77>: call 0x8048390 <__stack_chk_fail@plt>
- 0x08048560 <+82>: mov -0x4(%ebp),%ecx
- 0x08048563 <+85>: leave
- 0x08048564 <+86>: lea -0x4(%ecx),%esp
- 0x08048567 <+89>: ret
- End of assembler dump.
- (gdb) break *0x08048518
- Breakpoint 1 at 0x8048518: file overflow.c, line 11.
- (gdb) break *0x08048519
- Breakpoint 2 at 0x8048519: file overflow.c, line 11.
- (gdb) break *0x0804851b
- Breakpoint 3 at 0x804851b: file overflow.c, line 11.
- (gdb) break *0x0804851c
- Breakpoint 4 at 0x804851c: file overflow.c, line 11.
- (gdb) break *0x0804851f
- Breakpoint 5 at 0x804851f: file overflow.c, line 11.
- (gdb) break *0x0804852a
- Breakpoint 6 at 0x804852a: file overflow.c, line 12.
- (gdb) run
- Starting program: /home/haydar/Desktop/overflow
- Breakpoint 1, 0x08048518 in main () at overflow.c:11
- 11 int main() {
- (gdb) i r
- eax 0xb7fbedbc -1208226372
- ecx 0xbffff170 -1073745552
- edx 0xbffff194 -1073745516
- ebx 0x0 0
- esp 0xbffff15c 0xbffff15c
- ebp 0x0 0x0
- esi 0x1 1
- edi 0xb7fbd000 -1208233984
- eip 0x8048518 0x8048518 <main+10>
- eflags 0x286 [ PF SF IF ]
- cs 0x73 115
- ss 0x7b 123
- ds 0x7b 123
- es 0x7b 123
- fs 0x0 0
- gs 0x33 51
- (gdb) disass main
- Dump of assembler code for function main:
- 0x0804850e <+0>: lea 0x4(%esp),%ecx
- 0x08048512 <+4>: and $0xfffffff0,%esp
- 0x08048515 <+7>: pushl -0x4(%ecx)
- => 0x08048518 <+10>: push %ebp
- 0x08048519 <+11>: mov %esp,%ebp
- 0x0804851b <+13>: push %ecx
- 0x0804851c <+14>: sub $0x14,%esp
- 0x0804851f <+17>: mov %gs:0x14,%eax
- 0x08048525 <+23>: mov %eax,-0xc(%ebp)
- 0x08048528 <+26>: xor %eax,%eax
- 0x0804852a <+28>: call 0x80484cb <func>
- 0x0804852f <+33>: movl $0x1,-0x10(%ebp)
- 0x08048536 <+40>: sub $0x8,%esp
- 0x08048539 <+43>: lea -0x10(%ebp),%eax
- 0x0804853c <+46>: push %eax
- 0x0804853d <+47>: push $0x80485f0
- 0x08048542 <+52>: call 0x8048370 <printf@plt>
- 0x08048547 <+57>: add $0x10,%esp
- 0x0804854a <+60>: mov $0x0,%eax
- 0x0804854f <+65>: mov -0xc(%ebp),%edx
- 0x08048552 <+68>: xor %gs:0x14,%edx
- 0x08048559 <+75>: je 0x8048560 <main+82>
- ---Type <return> to continue, or q <return> to quit---q
- Quit
- (gdb) x/20x $ebp
- 0x0: Cannot access memory at address 0x0
- (gdb) x/20x $esp
- 0xbffff15c: 0xb7e1f276 0x00000001 0xb7fbd000 0x00000000
- 0xbffff16c: 0xb7e1f276 0x00000001 0xbffff204 0xbffff20c
- 0xbffff17c: 0x00000000 0x00000000 0x00000000 0xb7fbd000
- 0xbffff18c: 0xb7fffc04 0xb7fff000 0x00000000 0x00000001
- 0xbffff19c: 0xb7fbd000 0x00000000 0xbbd9de2c 0x87df523c
- (gdb) cont
- Continuing.
- Breakpoint 2, 0x08048519 in main () at overflow.c:11
- 11 int main() {
- (gdb) x/20x $ebp
- 0x0: Cannot access memory at address 0x0
- (gdb) x/20x $esp
- 0xbffff158: 0x00000000 0xb7e1f276 0x00000001 0xb7fbd000
- 0xbffff168: 0x00000000 0xb7e1f276 0x00000001 0xbffff204
- 0xbffff178: 0xbffff20c 0x00000000 0x00000000 0x00000000
- 0xbffff188: 0xb7fbd000 0xb7fffc04 0xb7fff000 0x00000000
- 0xbffff198: 0x00000001 0xb7fbd000 0x00000000 0xbbd9de2c
- (gdb) cont
- Continuing.
- Breakpoint 3, 0x0804851b in main () at overflow.c:11
- 11 int main() {
- (gdb) disass main
- Dump of assembler code for function main:
- 0x0804850e <+0>: lea 0x4(%esp),%ecx
- 0x08048512 <+4>: and $0xfffffff0,%esp
- 0x08048515 <+7>: pushl -0x4(%ecx)
- 0x08048518 <+10>: push %ebp
- 0x08048519 <+11>: mov %esp,%ebp
- => 0x0804851b <+13>: push %ecx
- 0x0804851c <+14>: sub $0x14,%esp
- 0x0804851f <+17>: mov %gs:0x14,%eax
- 0x08048525 <+23>: mov %eax,-0xc(%ebp)
- 0x08048528 <+26>: xor %eax,%eax
- 0x0804852a <+28>: call 0x80484cb <func>
- 0x0804852f <+33>: movl $0x1,-0x10(%ebp)
- 0x08048536 <+40>: sub $0x8,%esp
- 0x08048539 <+43>: lea -0x10(%ebp),%eax
- 0x0804853c <+46>: push %eax
- 0x0804853d <+47>: push $0x80485f0
- 0x08048542 <+52>: call 0x8048370 <printf@plt>
- 0x08048547 <+57>: add $0x10,%esp
- 0x0804854a <+60>: mov $0x0,%eax
- 0x0804854f <+65>: mov -0xc(%ebp),%edx
- 0x08048552 <+68>: xor %gs:0x14,%edx
- 0x08048559 <+75>: je 0x8048560 <main+82>
- ---Type <return> to continue, or q <return> to quit---q
- Quit
- (gdb) x/20x $ebp
- 0xbffff158: 0x00000000 0xb7e1f276 0x00000001 0xb7fbd000
- 0xbffff168: 0x00000000 0xb7e1f276 0x00000001 0xbffff204
- 0xbffff178: 0xbffff20c 0x00000000 0x00000000 0x00000000
- 0xbffff188: 0xb7fbd000 0xb7fffc04 0xb7fff000 0x00000000
- 0xbffff198: 0x00000001 0xb7fbd000 0x00000000 0xbbd9de2c
- (gdb) x/20x $esp
- 0xbffff158: 0x00000000 0xb7e1f276 0x00000001 0xb7fbd000
- 0xbffff168: 0x00000000 0xb7e1f276 0x00000001 0xbffff204
- 0xbffff178: 0xbffff20c 0x00000000 0x00000000 0x00000000
- 0xbffff188: 0xb7fbd000 0xb7fffc04 0xb7fff000 0x00000000
- 0xbffff198: 0x00000001 0xb7fbd000 0x00000000 0xbbd9de2c
- (gdb) cont
- Continuing.
- Breakpoint 4, 0x0804851c in main () at overflow.c:11
- 11 int main() {
- (gdb) x/20x $ebp
- 0xbffff158: 0x00000000 0xb7e1f276 0x00000001 0xb7fbd000
- 0xbffff168: 0x00000000 0xb7e1f276 0x00000001 0xbffff204
- 0xbffff178: 0xbffff20c 0x00000000 0x00000000 0x00000000
- 0xbffff188: 0xb7fbd000 0xb7fffc04 0xb7fff000 0x00000000
- 0xbffff198: 0x00000001 0xb7fbd000 0x00000000 0xbbd9de2c
- (gdb) x/20x $esp
- 0xbffff154: 0xbffff170 0x00000000 0xb7e1f276 0x00000001
- 0xbffff164: 0xb7fbd000 0x00000000 0xb7e1f276 0x00000001
- 0xbffff174: 0xbffff204 0xbffff20c 0x00000000 0x00000000
- 0xbffff184: 0x00000000 0xb7fbd000 0xb7fffc04 0xb7fff000
- 0xbffff194: 0x00000000 0x00000001 0xb7fbd000 0x00000000
- (gdb) cont
- Continuing.
- Breakpoint 5, main () at overflow.c:11
- 11 int main() {
- (gdb) x/20x $ebp
- 0xbffff158: 0x00000000 0xb7e1f276 0x00000001 0xb7fbd000
- 0xbffff168: 0x00000000 0xb7e1f276 0x00000001 0xbffff204
- 0xbffff178: 0xbffff20c 0x00000000 0x00000000 0x00000000
- 0xbffff188: 0xb7fbd000 0xb7fffc04 0xb7fff000 0x00000000
- 0xbffff198: 0x00000001 0xb7fbd000 0x00000000 0xbbd9de2c
- (gdb) x/20x $esp
- 0xbffff140: 0x00000001 0xbffff204 0xbffff20c 0x08048591
- 0xbffff150: 0xb7fbd3dc 0xbffff170 0x00000000 0xb7e1f276
- 0xbffff160: 0x00000001 0xb7fbd000 0x00000000 0xb7e1f276
- 0xbffff170: 0x00000001 0xbffff204 0xbffff20c 0x00000000
- 0xbffff180: 0x00000000 0x00000000 0xb7fbd000 0xb7fffc04
- (gdb) cont
- Continuing.
- Breakpoint 6, main () at overflow.c:12
- 12 func();
- (gdb) x/20x $ebp
- 0xbffff158: 0x00000000 0xb7e1f276 0x00000001 0xb7fbd000
- 0xbffff168: 0x00000000 0xb7e1f276 0x00000001 0xbffff204
- 0xbffff178: 0xbffff20c 0x00000000 0x00000000 0x00000000
- 0xbffff188: 0xb7fbd000 0xb7fffc04 0xb7fff000 0x00000000
- 0xbffff198: 0x00000001 0xb7fbd000 0x00000000 0xbbd9de2c
- (gdb) x/20x $esp
- 0xbffff140: 0x00000001 0xbffff204 0xbffff20c 0xfd0ea200
- 0xbffff150: 0xb7fbd3dc 0xbffff170 0x00000000 0xb7e1f276
- 0xbffff160: 0x00000001 0xb7fbd000 0x00000000 0xb7e1f276
- 0xbffff170: 0x00000001 0xbffff204 0xbffff20c 0x00000000
- 0xbffff180: 0x00000000 0x00000000 0xb7fbd000 0xb7fffc04
- (gdb) cont
- Continuing.
- AAAAAAAAAABBBBBBBBBB //10 Bytes buffer pass 'B's
- AAAAAAAAAABBBBBBBBBB //printf
- *** stack smashing detected ***: /home/haydar/Desktop/overflow terminated
- Program received signal SIGABRT, Aborted.
- 0xb7fd9d05 in __kernel_vsyscall ()
- (gdb)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement