Close Linux escalation at the door: SUID audit, nosuid, sudoers
The scenario is fictional. The SUID diff and visudo -cf were tested on synthetic data; fstab and auditd settings are from the book and untested live. What you'll learn SUID baseline: watch for what is new
The scenario is fictional. The SUID diff and
visudo -cfwere tested on synthetic data; fstab and auditd settings are from the book and untested live.
What you'll learn
- SUID baseline: watch for what is new
-
nosuidon writable mounts - Sudoers principles
- An auditd rule set
Steps
- Baseline:
find / -xdev -perm -4000 -type f | sort > suid.txt, then diff on a schedule. Remove unneeded bits withchmod u-s. - Mount
/tmpand/homewithnosuid,nodev(addnoexeconly after testing). - Sudoers: absolute paths, no shell-capable commands, pinned arguments,
use_pty,logfile,!visiblepw; validate withvisudo -cf. - auditd: the
uid!=euidexecve rule plus watches on/etc/sudoers,/etc/passwd,/etc/shadow; forward logs off-host.
Config flaws are not fixed by patches. Inventory, least privilege and validation are the answer.
Next: the Windows equivalent.
Adapted from chapters 15 and 25 of my Japanese book on server defense.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.