Lion Cipher Lab

Poison the tcache freelist past safe-linking (in your own lab)

Why it matters

The use-after-free lab taught the safest heap primitive: overwrite an application field of a chunk malloc had already handed back, so safe-linking never mattered. That was on purpose -- it kept the first heap exploit deterministic. This lab crosses the line that lab drew. Instead of writing to a chunk's payload, you corrupt the tcache free-list's own forward pointer, so the allocator itself becomes your weapon: poison one fd and the next-but-one malloc of that size returns a chunk sitting on ANY address you chose -- a global, a function pointer, a GOT entry -- giving you an arbitrary write…

What you'll learn

Steps in this lab

  1. Read this first: your own container, your own program, authorized-only
  2. Where this picks up: the fd pointer the last lab refused to touch
  3. Safe-linking: why a raw fd write dies, and why you need a heap leak
  4. Pin glibc with Docker -- heap exploits are version-specific
  5. Write the vulnerable target -- a UAF-writable slot and an aligned function pointer
  6. Compile with mitigations off for teaching -- and note what stays ON
  7. See safe-linking with your own eyes in pwndbg (tcachebins)
  8. Fire the exploit: poison the fd past safe-linking, land the write, call win()
  9. Do it better: how the class is actually killed -- and where it goes next

Open the full interactive lab →