Special Permissions (SUID, SGID & Sticky Bit)
Konzept & Übersicht
Standard file permissions (rwx) have three special bits that provide advanced access models:
- Sticky Bit (+t or octal 1000): Set on shared directories like /tmp. Anyone can create files, but users can only delete or rename files they own. Displayed as t in ls -l (e.g. drwxrwxrwt).
- SUID (Set User ID, u+s or octal 4000): When set on an executable binary, standard users run the binary with the file owner's privileges (usually root). Displayed as s in owner execute position (e.g. -rwsr-xr-x). Essential for tools like /usr/bin/passwd.
- Security Auditing: Attackers frequently abuse SUID binaries for privilege escalation. Sysadmins audit systems for SUID binaries using: find / -perm -4000 2> /dev/null.
1. Set the sticky bit on
/tmp/shared using chmod +t /tmp/shared.2. Set the SUID bit on
/home/learner/admin_tool using chmod u+s admin_tool.3. Audit SUID binaries across the system by running
find / -perm -4000 2> /dev/null (or find /usr/bin -perm -4000).Befehlssyntax-Referenz
| Command / Syntax | Description |
|---|---|
chmod +t /tmp/shared | Set sticky bit (+t) on shared directory |
chmod u+s admin_tool | Set SUID bit (u+s) on executable binary |
find / -perm -4000 2> /dev/null | Audit all binaries with SUID permission bit set |
Prüfungsziele
- ○Set sticky bit on /tmp/shared (+t or 1777)
- ○Set SUID on admin_tool (u+s or 4755)
- ○Audit SUID binaries using find with -perm -4000