$ cat writeup.md…
$ cat writeup.md…
sunshinectf2026
Task: glibc 2.39 heap menu (wallet manager) with a Use-After-Free in Transfer that copies a just-freed ledger pointer to another active wallet. Solution: UAF leak of main_arena (libc) and of the safe-linking mangle key, then tcache poisoning of the fixed No-PIE wallets[] table to forge fake structs, overwrite free@GOT with system, and trigger free("/bin/sh").
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Your coins, our heap. The books haven't been audited... yet.
nc chal.sunshinectf.games 26004
An interactive "crypto wallet manager" heap menu binary. glibc 2.39 (Ubuntu 2.39-0ubuntu8.3). The goal is to get RCE and read the flag. The wordplay is deliberate: "Cache Money" = tcache, "our heap" = heap challenge, "books haven't been audited" = a stale/dangling reference (UAF).
0x400000), Partial RELRO (GOT writable at fixed 0x404000), NX, stack canary, FORTIFY.fd is stored mangled as (chunk_addr >> 12) ^ next. Forging a poisoned fd therefore requires knowing the per-run heap mangle key chunk_addr >> 12.Wallet struct is 0x30 bytes, allocated with calloc. There is a global table wallets[16] at the fixed address 0x4040c0:
| offset | field |
|---|---|
| +0x00 | name[16] (fgets 16) |
| +0x10 | balance |
| +0x18 | ledger pointer (malloc) |
| +0x20 | ledger size |
| +0x28 | active flag (int) |
0x4015b0): calloc(0x30); fgets name; strtol size; size clamped to [0x20..0x100] else default 0x80; malloc(size); memset(ledger, 0, size); active = 1.0x4017d0): read(0, ledger, size) — no memset.0x4018a0): write(1, ledger, size) — leak primitive.0x401a10): the bug (below).0x401b60): free(ledger) then free(struct); wallets[i] = 0.0x401c90): prints entries....
$ grep --similar