Permissions & Users
Linux permissions are how the OS decides who can read, write, or execute a file. Misconfigurations here are a leading cause of privilege escalation.
The Permission Model
Every file has three permission sets: owner, group, others.
Each set has three bits: r (read), w (write), x (execute).
Changing Permissions
Learn both octal (755) and symbolic (+x) notation. You will see both in the wild.
Ownership
sudo and Root
sudo runs a command as root. Root has no permission restrictions.
sudo -l is a Privilege Escalation Step
On a compromised system, sudo -l is one of the first things you run. It shows what commands you can execute as root without a password. Misconfigured sudo entries are a common path to root.
The rules live in /etc/sudoers. Edit it only with visudo, which checks the syntax before it saves, so a typo cannot lock you out. A line with NOPASSWD: lets a command run as root with no password. When sudo -l shows one on a CTF box, that line is the way to root.
Special Permissions: SUID/SGID
When SUID is set on a binary, it runs as the file’s owner, not the caller.
A SUID binary owned by root that can be manipulated by a low-privilege user is a classic privilege escalation vector. GTFOBins catalogs these.
The Defaults You Did Not Set
A new file is 644 and a new directory is 755, and you never asked for that. The umask decides. It subtracts permissions from the maximum.
/tmp is writable by everyone, yet you cannot delete another user’s file there. That is the sticky bit: in a shared directory, only a file’s owner can remove it.
Beyond rwx
Two mechanisms hide permissions that ls -l does not show. When root cannot delete a file, look here.
A + at the end of ls -l output (-rw-r--r--+) means an ACL is present. Read it before you trust the nine characters. Reference: chattr(1).
Users and Groups
/etc/shadow stores hashed passwords. Only readable by root.
In CTF Environments
Privilege escalation (privesc) is one of the most common CTF phases on Linux boxes. You land as a low-privilege user and need to get to root.
Standard privesc enumeration:
Exploiting a misconfigured sudo entry:
GTFOBins workflow: find a SUID binary or sudo-allowed binary → go to gtfobins.github.io → look up the binary → run the listed exploit.
Automated enumeration scripts (use after manual checks):
- linpeas.sh — comprehensive Linux privesc enumeration
- linenum.sh — older but still useful
Using AI
Where it helps on permissions:
- Interpreting
sudo -loutput: Paste the output. Ask “which of these entries can be exploited for privilege escalation?” AI knows GTFOBins and common sudo misconfigurations. - Explaining SUID findings: Paste the list of SUID binaries. Ask which ones are interesting and what attacks apply.
- chmod math: “What does chmod 4755 mean?” Faster than calculating mentally.
- Writing privesc scripts: “Write a bash script that checks for world-writable cron scripts and SUID binaries and prints a summary.” Good starting point.
- Reading linpeas output: The output is long and color-coded. Paste sections and ask what to prioritize.
How the Club Uses This
TODO: Add privilege escalation scenarios or CTF challenges the club has worked through.
References
- GTFOBins — SUID/sudo privilege escalation reference
- Linux Privilege Escalation checklist
- chmod calculator
- The Filesystem
-
Permissions & Users
- Processes & Services