The Mindset
As a pentester, you’re looking for two things:- What can I access that I shouldn’t? — World-readable sensitive files, writable system scripts
- What can I run as someone else? — SUID/SGID binaries, sudo rights, writable cron scripts
Reading Permission Strings
Runls -l on any file and you’ll see this:
File Type (First Character)
Permission Characters
Octal Notation
Permissions are also expressed as numbers. Each permission has a value:
Add the values for each group (owner / group / others):
chmod 754 means:
Changing Permissions
chmod — Change File Mode
chown — Change Ownership
SUID & SGID — Privilege Escalation Gold
What They Are
- SUID (Set User ID) — When set on an executable, it runs with the file owner’s privileges, not the caller’s. If root owns a SUID binary, anyone who runs it gets root-level execution.
- SGID (Set Group ID) — Same concept but for groups.
s in place of the execute bit:
Finding SUID/SGID Binaries
What To Do With Them
Take every result and check it against GTFOBins (https://gtfobins.github.io/). Common SUID abuses:Sticky Bit
The sticky bit on a directory means only the file’s owner (or root) can delete or rename files inside it — even if others have write access to the directory.World-Writable Files & Directories
World-writable means any user can write to it. In a privesc context, this means you can modify a file that a privileged process may later read or execute.- World-writable scripts that are called by root-owned cron jobs
- World-writable config files for services running as root
- World-writable directories in PATH (path hijacking)
PATH Hijacking via Writable Directories
If a directory in the system’s PATH is world-writable, you can plant a malicious binary that gets executed instead of the real one.Permission Enumeration Checklist
Quick Reference
Next: User & Group Management — enumerating users, reading
/etc/shadow, and finding lateral movement targets.