CPSA ยท Mapping, fingerprinting and host auditing
Unix and Windows file permissions and registry ACLs
Unix mode bits, setuid, Windows NTFS ACLs and registry key permissions and their security implications.
Key points
- Unix mode bits: read (4), write (2), execute (1) for owner, group, others; a leading digit adds setuid (4), setgid (2), sticky (1).
- Setuid program: runs as its owner, so a setuid-root file others can modify means privilege escalation.
- Windows: NTFS and registry ACLs (Write, Full Control); broad groups with write on a service binary, its folder or registry key can run code with the service's privileges.
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Practice questions
What does numeric mode 4755 mean for an executable file?
- Setuid set, owner rwx, group and others r-x
- Sticky bit set, everyone has full access
- Setgid set, owner read-only
- No special bits, owner r-x, others rwx
Show answer
Answer: A. Setuid set, owner rwx, group and others r-x
The leading 4 is the setuid bit, 7 gives the owner rwx, and the two 5s give group and others r-x. The file therefore runs as its owner for anyone who executes it.
Which Windows permission settings are security weaknesses?
- Users can write to the folder containing a service's executable
- Authenticated Users have Full Control on a service's registry key
- Users can modify a script that a SYSTEM scheduled task runs
- Administrators have Full Control on the Windows folder
- SYSTEM has Full Control on its own service key
Show answer
Answer: A. Users can write to the folder containing a service's executable, B. Authenticated Users have Full Control on a service's registry key, C. Users can modify a script that a SYSTEM scheduled task runs
Write access for ordinary users to the folder of a service executable, to a service's registry key, or to a script run by SYSTEM lets them change what privileged code runs. Administrators and SYSTEM having Full Control on system folders is normal.
The sticky bit on /tmp lets any user delete any other user's files in it.
Show answer
Answer: False
False. It does the opposite: in a sticky directory, unprivileged users cannot remove or rename files they do not own, even though everyone can write there.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
