Lion Cipher Lab

Pop a shell with Sigreturn-Oriented Programming (SROP)

Why it matters

Every rung of the binary-exploitation ladder so far has needed the RIGHT gadgets: ROP needed a `pop rdi` to set an argument, ret2libc needed that plus a leak. But real targets — especially tiny statically-linked binaries, embedded firmware, or the tail end of a chain where you have almost nothing left — sometimes hand you no useful `pop` gadgets at all. SROP (Sigreturn-Oriented Programming) is the technique for exactly that famine. It exploits a design feature of Unix signal handling: when the kernel delivers a signal it dumps ALL of the CPU's registers into a structure called a sigcontext on…

What you'll learn

Steps in this lab

  1. Where the arc left you — and what SROP is
  2. Get the Linux toolchain and pwntools
  3. Write the vulnerable program — and hand it a syscall gadget
  4. Find the overflow offset yourself
  5. Locate the syscall gadget and the way to set rax=15
  6. Forge the fake sigcontext with SigreturnFrame()
  7. Run the exploit and pop a shell
  8. When SROP beats ROP — and how it is defended
  9. What you learned — and the next rung

Open the full interactive lab →