-rwxr-xr-x 1 root root /usr/bin/passwd │└┬┘└┬┘└┬┘ │ │ │ └── other: r-x │ │ └───── group: r-x │ └──────── owner: rwx └────────── type: - file, d dir, l symlink
find / -perm -4000 -type f 2>/dev/null is the first command in every privesc playbook; an unexpected SUID binary is a finding./tmp.getcap -r / 2>/dev/null. cap_setuid or cap_sys_admin on a binary is effectively root.sudo -l shows what you may run. NOPASSWD entries for anything with a shell escape (vi, find, awk, tar) are game over./etc/passwd /etc/shadow /etc/group /etc/sudoers /etc/sudoers.d/ ~/.ssh/authorized_keys persistence in one line /etc/ssh/sshd_config PermitRootLogin, PasswordAuthentication /etc/crontab /etc/cron.d/ /var/spool/cron/ /etc/systemd/system/ unit files = modern persistence /proc/<pid>/{cmdline,exe,environ,cwd} live process truth
systemctl list-units --type=service --state=running systemctl cat nginx.service read the unit, check ExecStart journalctl -u sshd --since "1 hour ago" journalctl -p err -b errors this boot
| Source | Contains | Use for |
|---|---|---|
| journald / syslog | Service messages, auth events | SSH logins, sudo, service failures |
| auditd | Syscall-level events by rule | File access, execve, privilege changes |
| eBPF agents (Falco, EDR) | Rich kernel events, low overhead | Container-aware runtime detection |
# auditd rules that earn their keep
-w /etc/passwd -p wa -k identity
-w /etc/sudoers.d/ -p wa -k sudoers
-a always,exit -F arch=b64 -S execve -F euid=0 -k root_exec
-w /root/.ssh -p wa -k ssh_keys
Auth events to alert on: Accepted publickey/password for root, sudo: … COMMAND= for unexpected users, useradd/usermod, and repeated Failed password followed by a success — the classic brute-force-then-in pattern.
A container is a normal Linux process with three kernel features applied: namespaces (its own view of PIDs, network, mounts, users), cgroups (resource limits) and usually seccomp/AppArmor (syscall restriction). There is no VM boundary — the host kernel is shared.
RUN creates a layer; a secret deleted in a later layer is still present in the earlier one. Scan images, and never COPY credentials.--privileged, mounting the Docker socket (/var/run/docker.sock) into a container, hostPID/hostNetwork, dangerous capabilities like CAP_SYS_ADMIN, and writable host mounts.# quick container posture checks docker inspect <id> --format '{{.HostConfig.Privileged}} {{.HostConfig.Binds}}' grep -q docker /proc/1/cgroup && echo "we are in a container" capsh --print what capabilities do we hold?
cluster-admin bindings, wildcard verbs, and the ability to create pods (which is usually equivalent to node compromise).Detections that generalise: exec into a production pod, creation of a privileged pod, a service account suddenly listing secrets cluster-wide, anonymous or unauthenticated API access, and images pulled from outside approved registries.
A deployment mounts /var/run/docker.sock into its container "so the app can manage builds". Risk?
Forward at minimum: auth logs, sudo, auditd execve for root, SSH sessions, package installs, and container runtime events. That set answers "who got in, as whom, and what did they run" — which is 80% of any incident question.