cf16

shell_execve objdump

Aug 26th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shell_execve# objdump --prefix-addresses --show-raw-insn -Srl prog1
  2.  
  3. prog1:     file format elf64-x86-64
  4.  
  5.  
  6. Disassembly of section .init:
  7. _init():
  8. 00000000004003c8 <_init> 48 83 ec 08            sub    $0x8,%rsp
  9. 00000000004003cc <_init+0x4> e8 6b 00 00 00         callq  000000000040043c <call_gmon_start>
  10. 00000000004003d1 <_init+0x9> e8 fa 00 00 00         callq  00000000004004d0 <frame_dummy>
  11. 00000000004003d6 <_init+0xe> e8 f5 01 00 00         callq  00000000004005d0 <__do_global_ctors_aux>
  12. 00000000004003db <_init+0x13> 48 83 c4 08           add    $0x8,%rsp
  13. 00000000004003df <_init+0x17> c3                    retq  
  14.  
  15. Disassembly of section .plt:
  16. 00000000004003e0 <__libc_start_main@plt-0x10> ff 35 22 0c 20 00     pushq  0x200c22(%rip)        # 0000000000601008 <_GLOBAL_OFFSET_TABLE_+0x8>
  17. 00000000004003e6 <__libc_start_main@plt-0xa> ff 25 24 0c 20 00      jmpq   *0x200c24(%rip)        # 0000000000601010 <_GLOBAL_OFFSET_TABLE_+0x10>
  18. 00000000004003ec <__libc_start_main@plt-0x4> 0f 1f 40 00            nopl   0x0(%rax)
  19. 00000000004003f0 <__libc_start_main@plt> ff 25 22 0c 20 00      jmpq   *0x200c22(%rip)        # 0000000000601018 <_GLOBAL_OFFSET_TABLE_+0x18>
  20. 00000000004003f6 <__libc_start_main@plt+0x6> 68 00 00 00 00         pushq  $0x0
  21. 00000000004003fb <__libc_start_main@plt+0xb> e9 e0 ff ff ff         jmpq   00000000004003e0 <_init+0x18>
  22. 0000000000400400 <execve@plt> ff 25 1a 0c 20 00     jmpq   *0x200c1a(%rip)        # 0000000000601020 <_GLOBAL_OFFSET_TABLE_+0x20>
  23. 0000000000400406 <execve@plt+0x6> 68 01 00 00 00        pushq  $0x1
  24. 000000000040040b <execve@plt+0xb> e9 d0 ff ff ff        jmpq   00000000004003e0 <_init+0x18>
  25.  
  26. Disassembly of section .text:
  27. _start():
  28. 0000000000400410 <_start> 31 ed                 xor    %ebp,%ebp
  29. 0000000000400412 <_start+0x2> 49 89 d1              mov    %rdx,%r9
  30. 0000000000400415 <_start+0x5> 5e                    pop    %rsi
  31. 0000000000400416 <_start+0x6> 48 89 e2              mov    %rsp,%rdx
  32. 0000000000400419 <_start+0x9> 48 83 e4 f0           and    $0xfffffffffffffff0,%rsp
  33. 000000000040041d <_start+0xd> 50                    push   %rax
  34. 000000000040041e <_start+0xe> 54                    push   %rsp
  35. 000000000040041f <_start+0xf> 49 c7 c0 c0 05 40 00  mov    $0x4005c0,%r8
  36. 0000000000400426 <_start+0x16> 48 c7 c1 30 05 40 00     mov    $0x400530,%rcx
  37. 000000000040042d <_start+0x1d> 48 c7 c7 f4 04 40 00     mov    $0x4004f4,%rdi
  38. 0000000000400434 <_start+0x24> e8 b7 ff ff ff           callq  00000000004003f0 <__libc_start_main@plt>
  39. 0000000000400439 <_start+0x29> f4                       hlt    
  40. 000000000040043a <_start+0x2a> 66 90                    xchg   %ax,%ax
  41. call_gmon_start():
  42. 000000000040043c <call_gmon_start> 48 83 ec 08              sub    $0x8,%rsp
  43. 0000000000400440 <call_gmon_start+0x4> 48 8b 05 b1 0b 20 00     mov    0x200bb1(%rip),%rax        # 0000000000600ff8 <_DYNAMIC+0x190>
  44. 0000000000400447 <call_gmon_start+0xb> 48 85 c0                 test   %rax,%rax
  45. 000000000040044a <call_gmon_start+0xe> 74 02                    je     000000000040044e <call_gmon_start+0x12>
  46. 000000000040044c <call_gmon_start+0x10> ff d0                   callq  *%rax
  47. 000000000040044e <call_gmon_start+0x12> 48 83 c4 08             add    $0x8,%rsp
  48. 0000000000400452 <call_gmon_start+0x16> c3                      retq  
  49. 0000000000400453 <call_gmon_start+0x17> 66 2e 0f 1f 84 00 00 00 00 00   nopw   %cs:0x0(%rax,%rax,1)
  50. 000000000040045d <call_gmon_start+0x21> 0f 1f 00                nopl   (%rax)
  51. __do_global_dtors_aux():
  52. 0000000000400460 <__do_global_dtors_aux> 55                     push   %rbp
  53. 0000000000400461 <__do_global_dtors_aux+0x1> 48 89 e5               mov    %rsp,%rbp
  54. 0000000000400464 <__do_global_dtors_aux+0x4> 53                     push   %rbx
  55. 0000000000400465 <__do_global_dtors_aux+0x5> 48 83 ec 08            sub    $0x8,%rsp
  56. 0000000000400469 <__do_global_dtors_aux+0x9> 80 3d c8 0b 20 00 00   cmpb   $0x0,0x200bc8(%rip)        # 0000000000601038 <_edata>
  57. 0000000000400470 <__do_global_dtors_aux+0x10> 75 4b                 jne    00000000004004bd <__do_global_dtors_aux+0x5d>
  58. 0000000000400472 <__do_global_dtors_aux+0x12> bb 58 0e 60 00        mov    $0x600e58,%ebx
  59. 0000000000400477 <__do_global_dtors_aux+0x17> 48 8b 05 c2 0b 20 00  mov    0x200bc2(%rip),%rax        # 0000000000601040 <dtor_idx.7469>
  60. 000000000040047e <__do_global_dtors_aux+0x1e> 48 81 eb 50 0e 60 00  sub    $0x600e50,%rbx
  61. 0000000000400485 <__do_global_dtors_aux+0x25> 48 c1 fb 03           sar    $0x3,%rbx
  62. 0000000000400489 <__do_global_dtors_aux+0x29> 48 83 eb 01           sub    $0x1,%rbx
  63. 000000000040048d <__do_global_dtors_aux+0x2d> 48 39 d8              cmp    %rbx,%rax
  64. 0000000000400490 <__do_global_dtors_aux+0x30> 73 24                 jae    00000000004004b6 <__do_global_dtors_aux+0x56>
  65. 0000000000400492 <__do_global_dtors_aux+0x32> 66 0f 1f 44 00 00     nopw   0x0(%rax,%rax,1)
  66. 0000000000400498 <__do_global_dtors_aux+0x38> 48 83 c0 01           add    $0x1,%rax
  67. 000000000040049c <__do_global_dtors_aux+0x3c> 48 89 05 9d 0b 20 00  mov    %rax,0x200b9d(%rip)        # 0000000000601040 <dtor_idx.7469>
  68. 00000000004004a3 <__do_global_dtors_aux+0x43> ff 14 c5 50 0e 60 00  callq  *0x600e50(,%rax,8)
  69. 00000000004004aa <__do_global_dtors_aux+0x4a> 48 8b 05 8f 0b 20 00  mov    0x200b8f(%rip),%rax        # 0000000000601040 <dtor_idx.7469>
  70. 00000000004004b1 <__do_global_dtors_aux+0x51> 48 39 d8              cmp    %rbx,%rax
  71. 00000000004004b4 <__do_global_dtors_aux+0x54> 72 e2                 jb     0000000000400498 <__do_global_dtors_aux+0x38>
  72. 00000000004004b6 <__do_global_dtors_aux+0x56> c6 05 7b 0b 20 00 01  movb   $0x1,0x200b7b(%rip)        # 0000000000601038 <_edata>
  73. 00000000004004bd <__do_global_dtors_aux+0x5d> 48 83 c4 08           add    $0x8,%rsp
  74. 00000000004004c1 <__do_global_dtors_aux+0x61> 5b                    pop    %rbx
  75. 00000000004004c2 <__do_global_dtors_aux+0x62> c9                    leaveq
  76. 00000000004004c3 <__do_global_dtors_aux+0x63> c3                    retq  
  77. 00000000004004c4 <__do_global_dtors_aux+0x64> 66 66 66 2e 0f 1f 84 00 00 00 00 00   data32 data32 nopw %cs:0x0(%rax,%rax,1)
  78. frame_dummy():
  79. 00000000004004d0 <frame_dummy> 55                       push   %rbp
  80. 00000000004004d1 <frame_dummy+0x1> 48 83 3d 87 09 20 00 00  cmpq   $0x0,0x200987(%rip)        # 0000000000600e60 <__JCR_END__>
  81. 00000000004004d9 <frame_dummy+0x9> 48 89 e5                 mov    %rsp,%rbp
  82. 00000000004004dc <frame_dummy+0xc> 74 12                    je     00000000004004f0 <frame_dummy+0x20>
  83. 00000000004004de <frame_dummy+0xe> b8 00 00 00 00           mov    $0x0,%eax
  84. 00000000004004e3 <frame_dummy+0x13> 48 85 c0                test   %rax,%rax
  85. 00000000004004e6 <frame_dummy+0x16> 74 08                   je     00000000004004f0 <frame_dummy+0x20>
  86. 00000000004004e8 <frame_dummy+0x18> bf 60 0e 60 00          mov    $0x600e60,%edi
  87. 00000000004004ed <frame_dummy+0x1d> c9                      leaveq
  88. 00000000004004ee <frame_dummy+0x1e> ff e0                   jmpq   *%rax
  89. 00000000004004f0 <frame_dummy+0x20> c9                      leaveq
  90. 00000000004004f1 <frame_dummy+0x21> c3                      retq  
  91. 00000000004004f2 <frame_dummy+0x22> 66 90                   xchg   %ax,%ax
  92. main():
  93. /mylogin/NetBeansProjects/examples/hacker/shell_execve/main.c:5
  94. #include <unistd.h>
  95. /*
  96.  *
  97.  */
  98. int main() {
  99. 00000000004004f4 <main> 55                      push   %rbp
  100. 00000000004004f5 <main+0x1> 48 89 e5                mov    %rsp,%rbp
  101. 00000000004004f8 <main+0x4> 48 83 ec 10             sub    $0x10,%rsp
  102. /mylogin/NetBeansProjects/examples/hacker/shell_execve/main.c:9
  103.  
  104.     char *shell[2];
  105.  
  106.     shell[0] = "/bin/sh";
  107. 00000000004004fc <main+0x8> 48 c7 45 f0 1c 06 40 00     movq   $0x40061c,-0x10(%rbp)
  108. /mylogin/NetBeansProjects/examples/hacker/shell_execve/main.c:10
  109.     shell[1] = NULL;
  110. 0000000000400504 <main+0x10> 48 c7 45 f8 00 00 00 00    movq   $0x0,-0x8(%rbp)
  111. /mylogin/NetBeansProjects/examples/hacker/shell_execve/main.c:11
  112.     execve(shell[0], shell, NULL);
  113. 000000000040050c <main+0x18> 48 8b 45 f0            mov    -0x10(%rbp),%rax
  114. 0000000000400510 <main+0x1c> 48 8d 4d f0            lea    -0x10(%rbp),%rcx
  115. 0000000000400514 <main+0x20> ba 00 00 00 00         mov    $0x0,%edx
  116. 0000000000400519 <main+0x25> 48 89 ce               mov    %rcx,%rsi
  117. 000000000040051c <main+0x28> 48 89 c7               mov    %rax,%rdi
  118. 000000000040051f <main+0x2b> e8 dc fe ff ff         callq  0000000000400400 <execve@plt>
  119. /mylogin/NetBeansProjects/examples/hacker/shell_execve/main.c:13
  120.  
  121.     return 0;
  122. 0000000000400524 <main+0x30> b8 00 00 00 00         mov    $0x0,%eax
  123. /mylogin/NetBeansProjects/examples/hacker/shell_execve/main.c:14
  124. }
  125. 0000000000400529 <main+0x35> c9                     leaveq
  126. 000000000040052a <main+0x36> c3                     retq  
  127. 000000000040052b <main+0x37> 0f 1f 44 00 00         nopl   0x0(%rax,%rax,1)
  128. __libc_csu_init():
  129. 0000000000400530 <__libc_csu_init> 48 89 6c 24 d8           mov    %rbp,-0x28(%rsp)
  130. 0000000000400535 <__libc_csu_init+0x5> 4c 89 64 24 e0           mov    %r12,-0x20(%rsp)
  131. 000000000040053a <__libc_csu_init+0xa> 48 8d 2d fb 08 20 00     lea    0x2008fb(%rip),%rbp        # 0000000000600e3c <__init_array_end>
  132. 0000000000400541 <__libc_csu_init+0x11> 4c 8d 25 f4 08 20 00    lea    0x2008f4(%rip),%r12        # 0000000000600e3c <__init_array_end>
  133. 0000000000400548 <__libc_csu_init+0x18> 4c 89 6c 24 e8          mov    %r13,-0x18(%rsp)
  134. 000000000040054d <__libc_csu_init+0x1d> 4c 89 74 24 f0          mov    %r14,-0x10(%rsp)
  135. 0000000000400552 <__libc_csu_init+0x22> 4c 89 7c 24 f8          mov    %r15,-0x8(%rsp)
  136. 0000000000400557 <__libc_csu_init+0x27> 48 89 5c 24 d0          mov    %rbx,-0x30(%rsp)
  137. 000000000040055c <__libc_csu_init+0x2c> 48 83 ec 38             sub    $0x38,%rsp
  138. 0000000000400560 <__libc_csu_init+0x30> 4c 29 e5                sub    %r12,%rbp
  139. 0000000000400563 <__libc_csu_init+0x33> 41 89 fd                mov    %edi,%r13d
  140. 0000000000400566 <__libc_csu_init+0x36> 49 89 f6                mov    %rsi,%r14
  141. 0000000000400569 <__libc_csu_init+0x39> 48 c1 fd 03             sar    $0x3,%rbp
  142. 000000000040056d <__libc_csu_init+0x3d> 49 89 d7                mov    %rdx,%r15
  143. 0000000000400570 <__libc_csu_init+0x40> e8 53 fe ff ff          callq  00000000004003c8 <_init>
  144. 0000000000400575 <__libc_csu_init+0x45> 48 85 ed                test   %rbp,%rbp
  145. 0000000000400578 <__libc_csu_init+0x48> 74 1c                   je     0000000000400596 <__libc_csu_init+0x66>
  146. 000000000040057a <__libc_csu_init+0x4a> 31 db                   xor    %ebx,%ebx
  147. 000000000040057c <__libc_csu_init+0x4c> 0f 1f 40 00             nopl   0x0(%rax)
  148. 0000000000400580 <__libc_csu_init+0x50> 4c 89 fa                mov    %r15,%rdx
  149. 0000000000400583 <__libc_csu_init+0x53> 4c 89 f6                mov    %r14,%rsi
  150. 0000000000400586 <__libc_csu_init+0x56> 44 89 ef                mov    %r13d,%edi
  151. 0000000000400589 <__libc_csu_init+0x59> 41 ff 14 dc             callq  *(%r12,%rbx,8)
  152. 000000000040058d <__libc_csu_init+0x5d> 48 83 c3 01             add    $0x1,%rbx
  153. 0000000000400591 <__libc_csu_init+0x61> 48 39 eb                cmp    %rbp,%rbx
  154. 0000000000400594 <__libc_csu_init+0x64> 75 ea                   jne    0000000000400580 <__libc_csu_init+0x50>
  155. 0000000000400596 <__libc_csu_init+0x66> 48 8b 5c 24 08          mov    0x8(%rsp),%rbx
  156. 000000000040059b <__libc_csu_init+0x6b> 48 8b 6c 24 10          mov    0x10(%rsp),%rbp
  157. 00000000004005a0 <__libc_csu_init+0x70> 4c 8b 64 24 18          mov    0x18(%rsp),%r12
  158. 00000000004005a5 <__libc_csu_init+0x75> 4c 8b 6c 24 20          mov    0x20(%rsp),%r13
  159. 00000000004005aa <__libc_csu_init+0x7a> 4c 8b 74 24 28          mov    0x28(%rsp),%r14
  160. 00000000004005af <__libc_csu_init+0x7f> 4c 8b 7c 24 30          mov    0x30(%rsp),%r15
  161. 00000000004005b4 <__libc_csu_init+0x84> 48 83 c4 38             add    $0x38,%rsp
  162. 00000000004005b8 <__libc_csu_init+0x88> c3                      retq  
  163. 00000000004005b9 <__libc_csu_init+0x89> 0f 1f 80 00 00 00 00    nopl   0x0(%rax)
  164. __libc_csu_fini():
  165. 00000000004005c0 <__libc_csu_fini> f3 c3                    repz retq
  166. 00000000004005c2 <__libc_csu_fini+0x2> 66 2e 0f 1f 84 00 00 00 00 00    nopw   %cs:0x0(%rax,%rax,1)
  167. 00000000004005cc <__libc_csu_fini+0xc> 0f 1f 40 00              nopl   0x0(%rax)
  168. __do_global_ctors_aux():
  169. 00000000004005d0 <__do_global_ctors_aux> 55                     push   %rbp
  170. 00000000004005d1 <__do_global_ctors_aux+0x1> 48 89 e5               mov    %rsp,%rbp
  171. 00000000004005d4 <__do_global_ctors_aux+0x4> 53                     push   %rbx
  172. 00000000004005d5 <__do_global_ctors_aux+0x5> 48 83 ec 08            sub    $0x8,%rsp
  173. 00000000004005d9 <__do_global_ctors_aux+0x9> 48 8b 05 60 08 20 00   mov    0x200860(%rip),%rax        # 0000000000600e40 <__CTOR_LIST__>
  174. 00000000004005e0 <__do_global_ctors_aux+0x10> 48 83 f8 ff           cmp    $0xffffffffffffffff,%rax
  175. 00000000004005e4 <__do_global_ctors_aux+0x14> 74 19                 je     00000000004005ff <__do_global_ctors_aux+0x2f>
  176. 00000000004005e6 <__do_global_ctors_aux+0x16> bb 40 0e 60 00        mov    $0x600e40,%ebx
  177. 00000000004005eb <__do_global_ctors_aux+0x1b> 0f 1f 44 00 00        nopl   0x0(%rax,%rax,1)
  178. 00000000004005f0 <__do_global_ctors_aux+0x20> 48 83 eb 08           sub    $0x8,%rbx
  179. 00000000004005f4 <__do_global_ctors_aux+0x24> ff d0                 callq  *%rax
  180. 00000000004005f6 <__do_global_ctors_aux+0x26> 48 8b 03              mov    (%rbx),%rax
  181. 00000000004005f9 <__do_global_ctors_aux+0x29> 48 83 f8 ff           cmp    $0xffffffffffffffff,%rax
  182. 00000000004005fd <__do_global_ctors_aux+0x2d> 75 f1                 jne    00000000004005f0 <__do_global_ctors_aux+0x20>
  183. 00000000004005ff <__do_global_ctors_aux+0x2f> 48 83 c4 08           add    $0x8,%rsp
  184. 0000000000400603 <__do_global_ctors_aux+0x33> 5b                    pop    %rbx
  185. 0000000000400604 <__do_global_ctors_aux+0x34> c9                    leaveq
  186. 0000000000400605 <__do_global_ctors_aux+0x35> c3                    retq  
  187. 0000000000400606 <__do_global_ctors_aux+0x36> 66 90                 xchg   %ax,%ax
  188.  
  189. Disassembly of section .fini:
  190. _fini():
  191. 0000000000400608 <_fini> 48 83 ec 08            sub    $0x8,%rsp
  192. 000000000040060c <_fini+0x4> e8 4f fe ff ff         callq  0000000000400460 <__do_global_dtors_aux>
  193. 0000000000400611 <_fini+0x9> 48 83 c4 08            add    $0x8,%rsp
  194. 0000000000400615 <_fini+0xd> c3                     retq  
  195. mylogin@ubuntuamd:~/NetBeansProjects/examples/hacker/shell_execve# objdump --prefix-addresses --show-raw-insn -Srl prog1 > dump.txt
  196. mylogin@ubuntuamd:~/NetBeansProjects/examples/hacker/shell_execve# ls
  197. dump.txt  main.c  main.o  main.s  Makefile  nbproject  prog  prog1
Add Comment
Please, Sign In to add comment