1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| # muhe @ ubuntu in ~/Desktop/study [2:54:35] $ gcc hos.c -m32 -fno-stack-protector -mpreferred-stack-boundary=2 -mno-accumulate-outgoing-args -z execstack -o hos -g # muhe @ ubuntu in ~/Desktop/study [2:54:45] $ gdb ./hos -q Reading symbols from ./hos...done. gdb-peda$ pdisass fvuln Dump of assembler code for function fvuln: 0x080484fb <+0>: push ebp 0x080484fc <+1>: mov ebp,esp 0x080484fe <+3>: sub esp,0x2c 0x08048501 <+6>: mov eax,DWORD PTR [ebp+0xc] 0x08048504 <+9>: mov DWORD PTR [ebp-0x4],eax 0x08048507 <+12>: push 0x100 0x0804850c <+17>: call 0x80483b0 <malloc@plt> 0x08048511 <+22>: add esp,0x4 0x08048514 <+25>: mov DWORD PTR [ebp-0x8],eax 0x08048517 <+28>: push DWORD PTR [ebp-0x8] 0x0804851a <+31>: push 0x8048660 0x0804851f <+36>: call 0x8048380 <printf@plt> 0x08048524 <+41>: add esp,0x8 0x08048527 <+44>: push DWORD PTR [ebp+0x8] 0x0804852a <+47>: lea eax,[ebp-0x2c] 0x0804852d <+50>: push eax 0x0804852e <+51>: call 0x80483a0 <strcpy@plt> 0x08048533 <+56>: add esp,0x8 0x08048536 <+59>: push DWORD PTR [ebp-0x8] 0x08048539 <+62>: push 0x804866f 0x0804853e <+67>: call 0x8048380 <printf@plt> 0x08048543 <+72>: add esp,0x8 0x08048546 <+75>: push DWORD PTR [ebp-0x8] 0x08048549 <+78>: call 0x8048390 <free@plt> 0x0804854e <+83>: add esp,0x4 0x08048551 <+86>: push 0x28 0x08048553 <+88>: call 0x80483b0 <malloc@plt> 0x08048558 <+93>: add esp,0x4 0x0804855b <+96>: mov DWORD PTR [ebp-0xc],eax 0x0804855e <+99>: push DWORD PTR [ebp-0x4] 0x08048561 <+102>: lea eax,[ebp-0x2c] 0x08048564 <+105>: push eax 0x08048565 <+106>: push 0x804867f 0x0804856a <+111>: push 0x27 0x0804856c <+113>: push DWORD PTR [ebp-0xc] 0x0804856f <+116>: call 0x80483d0 <snprintf@plt> 0x08048574 <+121>: add esp,0x14 0x08048577 <+124>: push DWORD PTR [ebp-0xc] 0x0804857a <+127>: push 0x8048692 0x0804857f <+132>: call 0x8048380 <printf@plt> 0x08048584 <+137>: add esp,0x8 0x08048587 <+140>: nop 0x08048588 <+141>: leave 0x08048589 <+142>: ret End of assembler dump. gdb-peda$ b *0x0804850c Breakpoint 1 at 0x804850c: file hos.c, line 14. gdb-peda$ b *0x0804852e Breakpoint 2 at 0x804852e: file hos.c, line 16. gdb-peda$ b *0x08048549 Breakpoint 3 at 0x8048549: file hos.c, line 19. gdb-peda$ b *0x08048553 Breakpoint 4 at 0x8048553: file hos.c, line 21. gdb-peda$ r aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbcccc 20 Starting program: /home/muhe/Desktop/study/hos aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbcccc 20
|