Attack teaches defence
Knowing how each path works tells you exactly how to close it. This is the other half of the skill — the part that keeps real systems safe:
- SUID binaries — audit them (
find / -perm -4000) and strip the bit from anything that does not truly need it. - Sudo rules — grant the narrowest command possible, never a shell or a pager, and avoid
NOPASSWDunless essential. - Writable
/etc/passwd— it must be644, owned by root; the same goes for/etc/shadow(640) and/etc/sudoers. - Cron scripts — a file run by root must be writable only by root, and live in a directory only root can write.
- PATH in privileged scripts — call programs by full path and set an explicit, trusted
PATH; never let a writable dir come first. - Leaked credentials — keep secrets out of readable files, use a secrets store, and never reuse a password across accounts.
A hardened box is simply one where every item on the enumeration checklist comes back clean.