Dev.to Security 🔐 Cybersecurity 👁 0

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 -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
  • nosuid on writable mounts
  • Sudoers principles
  • An auditd rule set

Steps

  1. Baseline: find / -xdev -perm -4000 -type f | sort > suid.txt, then diff on a schedule. Remove unneeded bits with chmod u-s.
  2. Mount /tmp and /home with nosuid,nodev (add noexec only after testing).
  3. Sudoers: absolute paths, no shell-capable commands, pinned arguments, use_pty, logfile, !visiblepw; validate with visudo -cf.
  4. auditd: the uid!=euid execve 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.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.