Lion Cipher Lab

Escalate to root on your own Linux VM by abusing file capabilities

Why it matters

Most people learn Linux privilege escalation as SUID binaries and sudo rules and stop there — which means the day they meet a box where the privesc path is a single capability on a copied binary, they walk right past it, because there is no `s` in the permissions and a SUID sweep comes up empty. Capabilities were designed to be SAFER than SUID: instead of 'run this whole program as root,' you grant one narrow power, like 'bind to a low port' or 'send raw packets,' and drop the rest. But a few of those narrow powers — the ability to set your own user ID, to bypass file-read checks, to load…

What you'll learn

Steps in this lab

  1. The one rule: your own throwaway VM, and nothing else
  2. What a capability is — root, sliced into pieces
  3. Read a capability string: the =ep that matters
  4. Plant vector #1: cap_setuid on a copy of python3 (deliberate, on your VM)
  5. Find it the way an attacker does — getcap -r /
  6. Exploit vector #1: cap_setuid to a root shell
  7. Plant and exploit vector #2: cap_dac_read_search reads /etc/shadow
  8. Fix it and revert — leave the box clean
  9. When to reach for this, and how a pro reads it

Open the full interactive lab →