CSCTF 2026 · Pwn · 270 pts
forge.
An unsorted-bin leak, a tcache leak, a corrupted top-chunk size, and one precisely sized malloc land straight on free_hook.
| Event | CSCTF 2026, Operation Dawn (online jeopardy) |
|---|---|
| Category | Pwn |
| Points | 270 |
| Status | Solved during the event |
| Target | Live TCP service (libc 2.27) |
TL;DR. forge() mallocs any size and temper() writes past the end of a chunk's declared length, which is enough to leak libc and the heap, corrupt the top chunk's size, and then use the classic House of Force trick — one malloc that walks the top chunk to a chosen address, and a second that allocates exactly there — to land a write on __free_hook.
Challenge
forge allocates a chunk of any requested size; temper writes size bytes starting at p + strlen(p), which overflows past the chunk whenever the write is longer than what's already stored there (libc 2.27).
Solution
libc leak: allocate a 0x500 chunk and a small 0x18 guard chunk, free the big one into the unsorted bin, then allocate a fresh 0x500 chunk and inspect it — its forward pointer is main_arena+0x60, giving the libc base directly.
Heap leak: allocate two 0x18 chunks, free both into tcache, reallocate the second and inspect it — its tcache next pointer is the first chunk's address, giving a heap pointer.
Corrupting the top chunk: allocate one chunk from tcache and one fresh from the top chunk; inspecting the fresh chunk reveals the low byte of the top chunk's size field. temper() overwrites that size with 0xff repeated enough times to make it enormous — chunk sizes being 16-byte aligned means only a few low bytes need overwriting.
House of Force: with an oversized top chunk, one malloc(N) where N = (target - current_top - 0x10) - 8 moves the top chunk pointer to target - 0x10; the very next malloc(0x18) then returns exactly target. Setting target = __free_hook - 8 (aligned to 16 bytes) lets the second allocation write 8 filler bytes followed by system's address directly into __free_hook.
Freeing any chunk containing the string "/bin/sh" then calls __free_hook, i.e. system("/bin/sh"), and a shell pops.
Gotcha
The read routine can't accept a literal newline byte (0x0a), so if system's address happens to contain one in its low 6 bytes (about 2.3% of the time), the script detects it and retries with a different target offset.
Flag
CSCTF{uuLr0SF54XspPo6bhuemSgdE}What I took from it
- House of Force only needs a single corrupted top-chunk size field and two mallocs to turn "allocate anywhere" into an arbitrary write — no tcache poisoning or unlink trick required once the top chunk's size is yours.