Lion Cipher Lab

Hijack a file stream with the House of Emma: defeat glibc pointer guard on the _IO_cookie_jumps path

Why it matters

House of Apple 2 taught you to reach an attacker-controlled function pointer through a legitimate glibc vtable. But glibc protects many of its stored function pointers with POINTER GUARD (PTR_MANGLE): the value in memory is not the real pointer, it is rol(pointer XOR a secret per-thread guard, 0x11), and glibc reverses it right before the call. So even with a full write primitive, you cannot just drop `system` into a guarded field -- write the raw address and it demangles to garbage and crashes. House of Emma is the FSOP technique for exactly this situation: it targets fopencookie streams,…

What you'll learn

Steps in this lab

  1. Read this first: your own container, your own program, authorized-only
  2. The wall this climbs: a callee that is pointer-guarded
  3. Pointer guard, exactly: rol(p XOR guard, 0x11)
  4. The idea in one breath: borrow _IO_cookie_jumps, ride overflow into _IO_cookie_write
  5. Pin glibc 2.35 with Docker -- and confirm it
  6. Write the toy: leak system, leak &_IO_cookie_jumps, leak the guard
  7. Compile with mitigations off for teaching -- and note what stays ON
  8. Build the fake _IO_cookie_file: every field, and the branch it satisfies
  9. Fire it, and get the shell -- a call glibc made from its own exit path
  10. When it fails, and do it better: Emma vs Apple 2, and what still stops both

Open the full interactive lab →