Lion Cipher Lab

Linux file permissions, ownership, and the SUID bit

Why it matters

Almost every Linux privilege-escalation writeup you will ever read hinges on two things a beginner is never actually taught: how to read a file's permissions, and what the SUID bit does. People memorise 'run find / -perm -4000' as a magic incantation without understanding that they are listing every program on the machine that runs as its owner instead of as them -- and that a single abusable one is the difference between a normal shell and root. This lab teaches the fundamental from zero. You learn to decode the 10-character mode string that ls -l prints (the type, then read/write/execute…

What you'll learn

Steps in this lab

  1. Read the mode string: what ls -l is actually telling you
  2. chmod in symbolic form: change permissions by name
  3. chmod in octal form: the numbers 644, 755, 700
  4. Ownership: chown, chgrp, and two very different errors
  5. The SUID bit: a program that runs as its OWNER, not as you
  6. The attacker's lens: enumerate SUID binaries and meet GTFOBins
  7. SGID, the sticky bit, and the judgment: when SUID is wrong, and the better way
  8. What you did, and the reflex to keep

Open the full interactive lab →