Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ gcc -g -no-pie -o helloworld-no-pie helloworld.c
- $ readelf -r helloworld-no-pie | grep puts
- 000000601018 000100000007 R_X86_64_JUMP_SLO 0000000000000000 puts@GLIBC_2.2.5 + 0
- $ gdb -q helloworld-no-pie
- Reading symbols from helloworld-no-pie...done.
- gdb-peda$ set env LD_BIND_NOW
- Setting environment variable "LD_BIND_NOW" to null value.
- gdb-peda$ disp/gx 0x601018
- 1: x/xg 0x601018 0x601018: 0x00000000004003f6
- gdb-peda$ b main
- Breakpoint 1 at 0x4004eb: file helloworld.c, line 21.
- gdb-peda$ r
- Starting program: /home/ubuntu/Dropbox/Workspace/c/doodle/helloworld-no-pie
- [----------------------------------registers-----------------------------------]
- RAX: 0x4004e7 (<main>: push rbp)
- RBX: 0x0
- RCX: 0x400500 (<__libc_csu_init>: push r15)
- RDX: 0x7fffffffe348 --> 0x7fffffffe608 ("HOME=/home/ubuntu")
- RSI: 0x7fffffffe338 --> 0x7fffffffe5ce ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld-no-pie")
- RDI: 0x1
- RBP: 0x7fffffffe250 --> 0x400500 (<__libc_csu_init>: push r15)
- RSP: 0x7fffffffe250 --> 0x400500 (<__libc_csu_init>: push r15)
- RIP: 0x4004eb (<main+4>: lea rdi,[rip+0x92] # 0x400584)
- R8 : 0x7ffff7dd0d80 --> 0x0
- R9 : 0x7ffff7dd0d80 --> 0x0
- R10: 0x0
- R11: 0x1
- R12: 0x400400 (<_start>: xor ebp,ebp)
- R13: 0x7fffffffe330 --> 0x1
- R14: 0x0
- R15: 0x0
- EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
- [-------------------------------------code-------------------------------------]
- 0x4004e5 <frame_dummy+5>: jmp 0x400470 <register_tm_clones>
- 0x4004e7 <main>: push rbp
- 0x4004e8 <main+1>: mov rbp,rsp
- => 0x4004eb <main+4>: lea rdi,[rip+0x92] # 0x400584
- 0x4004f2 <main+11>: call 0x4003f0 <puts@plt>
- 0x4004f7 <main+16>: mov eax,0x0
- 0x4004fc <main+21>: pop rbp
- 0x4004fd <main+22>: ret
- [------------------------------------stack-------------------------------------]
- 0000| 0x7fffffffe250 --> 0x400500 (<__libc_csu_init>: push r15)
- 0008| 0x7fffffffe258 --> 0x7ffff7a05b97 (<__libc_start_main+231>: mov edi,eax)
- 0016| 0x7fffffffe260 --> 0x1
- 0024| 0x7fffffffe268 --> 0x7fffffffe338 --> 0x7fffffffe5ce ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld-no-pie")
- 0032| 0x7fffffffe270 --> 0x100008000
- 0040| 0x7fffffffe278 --> 0x4004e7 (<main>: push rbp)
- 0048| 0x7fffffffe280 --> 0x0
- 0056| 0x7fffffffe288 --> 0x4109919a95c7f178
- [------------------------------------------------------------------------------]
- Legend: code, data, rodata, value
- Breakpoint 1, main () at helloworld.c:21
- 21 printf("Hello world!\n");
- 1: x/xg 0x601018 0x601018: 0x00000000004003f6
- gdb-peda$ set env LD_BIND_NOW=1
- gdb-peda$ r
- Starting program: /home/ubuntu/Dropbox/Workspace/c/doodle/helloworld-no-pie
- [----------------------------------registers-----------------------------------]
- RAX: 0x4004e7 (<main>: push rbp)
- RBX: 0x0
- RCX: 0x400500 (<__libc_csu_init>: push r15)
- RDX: 0x7fffffffe348 --> 0x7fffffffe607 ("HOME=/home/ubuntu")
- RSI: 0x7fffffffe338 --> 0x7fffffffe5cd ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld-no-pie")
- RDI: 0x1
- RBP: 0x7fffffffe250 --> 0x400500 (<__libc_csu_init>: push r15)
- RSP: 0x7fffffffe250 --> 0x400500 (<__libc_csu_init>: push r15)
- RIP: 0x4004eb (<main+4>: lea rdi,[rip+0x92] # 0x400584)
- R8 : 0x7ffff7dd0d80 --> 0x0
- R9 : 0x7ffff7dd0d80 --> 0x0
- R10: 0x0
- R11: 0x1
- R12: 0x400400 (<_start>: xor ebp,ebp)
- R13: 0x7fffffffe330 --> 0x1
- R14: 0x0
- R15: 0x0
- EFLAGS: 0x246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow)
- [-------------------------------------code-------------------------------------]
- 0x4004e5 <frame_dummy+5>: jmp 0x400470 <register_tm_clones>
- 0x4004e7 <main>: push rbp
- 0x4004e8 <main+1>: mov rbp,rsp
- => 0x4004eb <main+4>: lea rdi,[rip+0x92] # 0x400584
- 0x4004f2 <main+11>: call 0x4003f0 <puts@plt>
- 0x4004f7 <main+16>: mov eax,0x0
- 0x4004fc <main+21>: pop rbp
- 0x4004fd <main+22>: ret
- [------------------------------------stack-------------------------------------]
- 0000| 0x7fffffffe250 --> 0x400500 (<__libc_csu_init>: push r15)
- 0008| 0x7fffffffe258 --> 0x7ffff7a05b97 (<__libc_start_main+231>: mov edi,eax)
- 0016| 0x7fffffffe260 --> 0x1
- 0024| 0x7fffffffe268 --> 0x7fffffffe338 --> 0x7fffffffe5cd ("/home/ubuntu/Dropbox/Workspace/c/doodle/helloworld-no-pie")
- 0032| 0x7fffffffe270 --> 0x100008000
- 0040| 0x7fffffffe278 --> 0x4004e7 (<main>: push rbp)
- 0048| 0x7fffffffe280 --> 0x0
- 0056| 0x7fffffffe288 --> 0xbb586d33e5a0e758
- [------------------------------------------------------------------------------]
- Legend: code, data, rodata, value
- Breakpoint 1, main () at helloworld.c:21
- 21 printf("Hello world!\n");
- 1: x/xg 0x601018 0x601018: 0x00007ffff7a649c0
- gdb-peda$ x/4i 0x00007ffff7a649c0
- 0x7ffff7a649c0 <_IO_puts>: push r13
- 0x7ffff7a649c2 <_IO_puts+2>: push r12
- 0x7ffff7a649c4 <_IO_puts+4>: mov r12,rdi
- 0x7ffff7a649c7 <_IO_puts+7>: push rbp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement