Skip to main content
Synced from an Obsidian vault

For graph and advanced features, download the full Intel Codex Vault and open it in Obsidian.

Linux Pentesting SOP (Authorized)

Authorized environments only. Read Legal & Ethics and OPSEC Plan before any engagement. This SOP covers defensive assessment, hardening validation, and non-destructive privilege-escalation enumeration.


Table of Contents​

  1. Engagement Setup
  2. Information Gathering (Read-Only)
  3. Configuration Review
  4. Privilege Escalation Vectors (Non-Destructive Checks)
  5. Logging & Monitoring Review
  6. Network Security
  7. Automated Enumeration Tools
  8. Common Misconfigurations Checklist
  9. Evidence Collection
  10. Reporting
  11. Safety & Legal
  12. Tools Reference
  13. Common Pitfalls
  14. Reference Resources

Pre-Engagement & Authorization​

Linux LPE work is inherently destabilizing — kernel exploits panic boxes, container escapes cross trust boundaries, and persistence primitives outlive the engagement window. Pin specifics in writing before any tool from §7 runs against an in-scope host. The "Pre-Engagement" checklist inside §1 below covers engagement kickoff; this section adds the Linux-specific abuse-surface authorization an LPE engagement actually needs.

Authorization Checklist​

  • Kernel-exploit detonation scope — explicit per-CVE authorization for any LPE PoC binary (PwnKit / DirtyPipe / Copy Fail / GameOver(lay) / Looney Tunables / nf_tables UAF / Leaky Vessels), tied to a captured uname -a + distro snapshot taken at engagement start. Public PoCs on production are out-of-scope by default. This covers enumeration scripts that probe a kernel bug at runtime: linPEAS releases from 20260430-8eec6923 (2026-04-30) on include, in the default run, a Copy Fail (CVE-2026-31431) check that, when Python is present, runs a self-described non-destructive AF_ALG/splice page-cache write against a temporary file it creates [verify 2026-11-05].
  • Container escape boundary — explicit host-vs-guest authorization. runc Leaky Vessels (CVE-2024-21626), cgroup v1 release_agent escape (kernel bug CVE-2022-0492; needs a cgroup v1 hierarchy, either one the host has mounted or one a CAP_SYS_ADMIN container mounts itself; Ubuntu 26.04's systemd no longer mounts v1, but the kernel still allows v1 mounts unless booted with cgroup_no_v1=all,named [verify 2026-11-05]), Docker / containerd / podman socket abuse, and Kubernetes service-account-token use all cross the container/host boundary; if the host is out of scope, escape PoCs stop at proof-of-namespace-break.
  • /etc/passwd / /etc/shadow modification scope — read-only enumeration is in scope; write access (adding a UID 0 row, exfiltrating /etc/shadow for offline cracking) requires written sign-off and a backup snapshot.
  • Sudo / sudoedit policy abuse — capturing sudo -l output is enumeration; chaining NOPASSWD entries via GTFOBins or detonating CVE-2023-22809 / CVE-2021-3156 / CVE-2025-32463 is exploitation and must be named in the SoW.
  • SUID binary modification — auditing the existing SUID set is in scope; creating new SUID bits (chmod +s …) or modifying baseline SUID binaries requires explicit permission plus a documented revert step.
  • NFS / SMB / CIFS share write authorization — showmount -e and no_root_squash flag-grep are read-only; writing a SUID payload to a no_root_squash export needs sign-off from the share owner, not just the host owner.
  • systemd unit / cron / timer write authorization — dropping a .service, .timer, .socket, lingering ~/.config/systemd/user/ unit, or /etc/cron.*/ file creates persistence and must be named, time-boxed, and registered for cleanup.
  • Jurisdictional + safe-harbor framing — see Legal & Ethics (canonical) for CFAA / Computer Misuse Act framing; bug-bounty engagements: confirm the program's safe-harbor language covers Linux LPE explicitly (some VDPs scope to web-only).

Lab Environment Requirements​

  • Distro + kernel version-matched lab VM. Kernel CVE PoCs are pinned at the patch level — Ubuntu 22.04 with kernel 5.15.0-67-generic is not the same target as 5.15.0-101-generic even though both are upstream 5.15.0; the ABI suffix in uname -r, the upload number in uname -v, and /proc/version_signature carry the patch level. Snapshot the target's cat /etc/os-release, uname -a, ldd --version, sudo --version plus the active sudo provider (see §4 Sudo), pkexec --version, runc --version, systemctl --version | head -1, mount --version, and ssh -V before staging the lab.
  • Platform churn since 2026-04. Ubuntu 26.04 LTS ships kernel 7.0, sudo-rs as sudo (C sudo renamed sudo.ws), rust-coreutils (uutils; cp/mv/rm are still GNU), systemd 259 without cgroup v1 support (the kernel still allows v1 mounts; see the Container escape boundary item), and /tmp as tmpfs. Upstream 5.10 and 5.15 LTS are projected to reach end of life in December 2026 (kernel.org); after that, hosts on those kernels rely on distro back-ports only [verify 2026-11-05].
  • Throwaway VM snapshot before any kernel-exploit detonation. Public LPE PoCs panic the kernel on near-miss versions or leave the box unbootable; reproduce in a snapshotted VM, never on the live target.
  • Container runtime version-matched for Leaky Vessels (CVE-2024-21626) testing. containerd and Docker Engine release builds each bundle their own runc. runc ≥ 1.1.12 is the fix; it ships in Docker Engine 25.0.2 / 24.0.9 and containerd 1.7.13 / 1.6.28 release builds [verify 2026-11-05]. Check the bundled runc version (runc --version, docker version), not the engine version, and match it exactly in the lab. These versions are the floor for one 2024 CVE, not a current patched baseline: runc, containerd and CRI-O have all published security advisories in 2026 — check the vendors' GitHub security advisories and Container & K8s Pentest before calling a runtime patched.
  • Capability-aware lab container. Validate container-escape primitives in a lab container that mirrors the in-scope target's --cap-add / --privileged / --security-opt / mount set; capability differences silently change which primitives work.
  • GTFOBins coverage spot-check pre-engagement. Before reporting a sudo / SUID / capability finding as exploitable, verify the binary appears on GTFOBins with the relevant primitive — many baseline binaries look exploitable but lack a public escalation gadget.
  • Operator-side OPSEC. No curl … | sh from a target you do not control (see §7 note); download to a throwaway path, sha256sum, inspect, then run. Tool artifacts (LinPEAS output, pspy logs, captured /etc/shadow) are sensitive — store, transport, and destroy per OPSEC Plan.

Disclosure-Ready Posture​

  • Baseline before touching anything. At engagement start capture: linpeas.sh -n > linpeas.baseline.out, lse.sh -l 2 -i > lse.baseline.out, sudo -l > sudo-policy.baseline.out, getcap -r / 2>/dev/null > caps.baseline.out, full find / -perm -4000 -ls > suid.baseline.out SUID inventory. The disclosure delta (what you changed) is meaningless without the baseline.
    • linPEAS flags [verify 2026-11-05]: -n skips the external hostname check, which otherwise sends the target's hostname to a HackTricks web service. Do not use -a for the baseline: it brute-forces su with the top-2000 password list against every user with a shell (account-lockout risk; the README calls it "super noisy") and, unless -n is also given, sends the hostname, OS/kernel release and up to 300 installed packages to the HackTricks online lookup. Run -a only where the RoE explicitly authorizes the su brute force, and add -n unless the upload is also authorized.
    • Even the default -n run is not passive. linPEAS releases from 20260430-8eec6923 (2026-04-30) on run an active, self-described non-destructive Copy Fail (CVE-2026-31431) kernel probe when Python is present; clear it under the Kernel-exploit detonation scope item above and warn the blue team that AF_ALG detection rules may fire [verify 2026-11-05].
    • Inside a container the default run also attempts cgroup v1 mounts (directly and via unshare -UrmC) and zero-byte open-for-write tests on /proc and /sys files; clear these under the Container escape boundary item above [verify 2026-11-05].
  • Activity timeline. Run pspy and/or auditd (where authorized) for the duration of active testing so the sysadmin can correlate test activity to alerts post-engagement. At hand-off capture the audit records themselves: sudo ausearch -i --start &lt;date&gt; &lt;time&gt; > audit.engagement.txt (date in the locale's date '+%x' format) and, where journald collects audit events, journalctl _TRANSPORT=audit --since "<engagement-start ISO-8601>". journalctl -u auditd shows only the daemon's own start/stop messages.
  • Do NOT wipe history in scope unless explicitly authorized. ~/.bash_history, ~/.zsh_history, lastb, journald, and /var/log/auth.log are evidence — wiping them is itself a finding that must be disclosed. Use a dedicated operator account or unset HISTFILE rather than scrubbing after the fact. unset HISTFILE is itself ATT&CK T1690 (Prevent Command History Logging, Defense Impairment), so record it in the activity log as a disclosed test action.
  • Sudoers + capability state snapshot. Sudoers (mode 440 root-owned) and file capabilities change rarely, but the sudo -l policy and getcap -r / output that were in effect during the test must be in the report — otherwise reproducibility is lost when sysadmins later tighten the rules.
  • Container runtime + image digest snapshot. Record the runtime component versions (docker version --format '{{range .Server.Components}}{{.Name}} {{.Version}}{{"\n"}}{{end}}' lists containerd, runc and docker-init), the image ID (docker inspect --format '{{.Image}}' &lt;ctr&gt;) plus the registry digest (docker image inspect --format '{{json .RepoDigests}}' &lt;image&gt;), and kubectl version so findings tie back to a reproducible runtime build.
  • Evidence pack + final report routing. Stage evidence per the Collection Log hash-and-timestamp pattern referenced in §9 below; final disclosure pack (executive summary, technical detail, IOC defanging, remediation timeline) follows Reporting / Packaging / Disclosure.

1. Engagement Setup​

Pre-Engagement​

  • Obtain written authorization (signed Rules of Engagement)
  • Define scope: hosts, subnets, services, user accounts
  • Set time windows and blackout periods
  • Establish emergency contacts and escalation path
  • Agree on change control procedures
  • Confirm backup/restore process exists

Objectives (Examples)​

  • Identify misconfigurations enabling unauthorized access or privilege escalation
  • Validate hardening baseline compliance against the benchmark release for the target OS — e.g. CIS Ubuntu 26.04 LTS v1.0.0 / 24.04 LTS v2.0.0, RHEL 10 v1.0.1 / RHEL 9 v3.0.0, Debian 13 v1.1.0 / 12 v2.0.0; DISA STIG via SCAP Security Guide v0.1.82 profiles (RHEL 10 V1R2, RHEL 9 V2R9, RHEL 8 V2R8, Ubuntu 24.04 V1R5) [verify 2026-11-05]
  • Test privilege separation and access controls
  • Evaluate logging/monitoring efficacy

2. Information Gathering (Read-Only)​

System Identification​

# OS version and kernel
uname -a
cat /etc/os-release
cat /etc/*-release
hostnamectl

# Kernel version (for known vuln research)
uname -r

User & Group Enumeration​

TARGET_USER="alice" # account under review

# List all users
cat /etc/passwd
cut -d: -f1 /etc/passwd

# Users with login shells
grep -v "/nologin\|/false" /etc/passwd

# Check for UID 0 (root-equivalent) accounts
awk -F: '$3 == 0 {print $1}' /etc/passwd

# Group memberships
cat /etc/group
groups "$TARGET_USER"

# Sudo access
sudo -l
cat /etc/sudoers
ls -la /etc/sudoers.d/

# Recently modified user accounts
ls -lat /home/

Running Services & Network​

# Active services
systemctl list-units --type=service --state=running
ps aux

# Network listeners
ss -tulnp
netstat -tulnp

# Firewall status
sudo iptables -L -n -v
sudo ufw status verbose
sudo firewall-cmd --list-all
sudo nft list ruleset # nftables (firewalld's default backend; iptables -L may show nothing)

# Wildcard listeners only (0.0.0.0 / [::] / *), tested on the local-address column
ss -tulnpH | awk '$5 ~ /^(0\.0\.0\.0|\[::\]|\*):/'

Installed Packages​

# Debian/Ubuntu
dpkg -l
apt list --installed

# RHEL/CentOS
rpm -qa
yum list installed

# Check for outdated packages
apt list --upgradable # Debian/Ubuntu (reads the local package lists)
yum -C check-update # RHEL/CentOS, cache only; without -C it refreshes repository metadata over the network

# Look for unnecessary packages (compilers, dev tools on prod)
dpkg -l | grep -E "gcc|g\+\+|build-essential|python-dev"

3. Configuration Review​

File & Directory Permissions​

Sensitive files to check:

# SSH configuration
ls -la /etc/ssh/sshd_config
cat /etc/ssh/sshd_config | grep -E "PermitRootLogin|PasswordAuthentication|PubkeyAuthentication|PermitEmptyPasswords"

# Shadow file (0640 root:shadow on Debian/Ubuntu, 0000 root:root on RHEL/Fedora — anything world-readable or user-writable is a finding)
ls -la /etc/shadow

# Sudoers (should be 440)
ls -la /etc/sudoers
ls -la /etc/sudoers.d/

# Cron files
ls -la /etc/cron*
ls -la /var/spool/cron/crontabs/ /var/spool/cron/ 2>/dev/null # Debian/Ubuntu ; RHEL/Fedora (cronie)

# World-writable files (dangerous)
find / -type f -perm -002 -ls 2>/dev/null

# World-writable directories
find / -type d -perm -002 -ls 2>/dev/null

# SUID/SGID binaries (privilege escalation vectors)
find / -type f \( -perm -4000 -o -perm -2000 \) -ls 2>/dev/null

# World-writable directories without the sticky bit (any user can delete or replace others' files)
find / -type d -perm -0002 ! -perm -1000 -ls 2>/dev/null

SSH Hardening Checks​

TARGET_HOST="target.example" # in-scope SSH server for ssh-audit

# OpenSSH version (the server banner also shows in ssh-audit output)
ssh -V 2>&1

# Show effective sshd config. Follows Include; Match blocks apply only when connection
# parameters are given with -C, e.g. sudo sshd -T -C user=alice,host=client.example,addr=192.0.2.10
sudo sshd -T 2>/dev/null | grep -Ei "permitroot|passwordauth|permitempty|kbdinteract|maxauth|kex|ciphers|macs|allowusers|allowgroups|x11|tcpforward|gatewayports|allowagent|clientalive|warnweakcrypto|agentsocketpath"
# OpenSSH >= 10.6 [verify 2026-11-05]: expect WarnWeakCrypto true (default; logs key agreement that is
# not post-quantum safe) and AgentSocketPath user:.ssh/agent (default); a shared: path needs a stated reason

# Per-directive checks on the raw files. These ignore Match blocks. sshd uses the first value it
# reads, and distro configs Include /etc/ssh/sshd_config.d/*.conf near the top, so a drop-in
# (e.g. cloud-init's 50-cloud-init.conf) can override the main file. Trust sshd -T over these greps.
SSHD_CFG=(/etc/ssh/sshd_config /etc/ssh/sshd_config.d/)
sudo grep -rEi "^PermitRootLogin" "${SSHD_CFG[@]}" # expected: no (or prohibit-password if using key-only root mgmt)
sudo grep -rEi "^PasswordAuthentication" "${SSHD_CFG[@]}" # expected: no when keys are mandatory
sudo grep -rEi "^KbdInteractiveAuthentication|^ChallengeResponseAuthentication" "${SSHD_CFG[@]}" # expected: no
sudo grep -rEi "^PermitEmptyPasswords" "${SSHD_CFG[@]}" # expected: no
sudo grep -rEi "^MaxAuthTries" "${SSHD_CFG[@]}" # expected: <= 4
sudo grep -rEi "^LoginGraceTime" "${SSHD_CFG[@]}" # expected: 60 or less
sudo grep -rEi "^X11Forwarding" "${SSHD_CFG[@]}" # expected: no unless required
sudo grep -rEi "^AllowAgentForwarding" "${SSHD_CFG[@]}" # expected: no unless required
sudo grep -rEi "^AllowTcpForwarding" "${SSHD_CFG[@]}" # expected: no unless required
sudo grep -rEi "^GatewayPorts" "${SSHD_CFG[@]}" # expected: no
sudo grep -rEi "^Allow(Users|Groups)|^Deny(Users|Groups)" "${SSHD_CFG[@]}" # principle of least access

# Algorithm strength: compare with ssh-audit's built-in policies (ssh-audit -L). Keep a post-quantum
# hybrid KEX (mlkem768x25519-sha256, the default since OpenSSH 10.0, or sntrup761x25519-sha512,
# named sntrup761x25519-sha512@openssh.com only before OpenSSH 9.9);
# ssh-audit >= 3.9.0 warns on every KEX that is not post-quantum safe [verify 2026-11-05]
sudo grep -rEi "^KexAlgorithms|^Ciphers|^MACs|^HostKeyAlgorithms|^PubkeyAcceptedAlgorithms" "${SSHD_CFG[@]}"

# NOTE: sshd dropped SSH protocol 1 in OpenSSH 7.4 (Dec 2016); the client followed in 7.6 (Oct 2017).
# The legacy "Protocol" keyword is silently ignored by modern sshd; do not rely on its presence or absence.

# External audit (recommended; github.com/jtesta/ssh-audit). List the built-in policies, then
# audit against the one that matches the target (names include the version, as printed by -L)
ssh-audit -L
ssh-audit -P "Hardened Ubuntu Server 26.04 LTS (version 1)" "$TARGET_HOST"
ssh-audit "$TARGET_HOST"

# Inventory authorized_keys (per-user, including root and service accounts).
# First check where sshd actually reads keys from (non-default paths, AuthorizedKeysCommand):
sudo sshd -T | grep -Ei '^authorizedkeys(file|command)'
# Walk every mounted filesystem (separate /home, /var, /srv mounts included), skipping /proc and /sys
sudo find / \( -path /proc -o -path /sys \) -prune -o -name 'authorized_keys*' -ls 2>/dev/null
# Inspect specific files only after scoping; printing keys to stdout is logged

Sudo Policy Review​

# Check sudoers for NOPASSWD (dangerous). Recurse inside the root process: /etc/sudoers.d is
# mode 0750 on Fedora/RHEL, so a sudoers.d/* glob expanded by your own shell silently matches nothing
sudo grep -r NOPASSWD /etc/sudoers /etc/sudoers.d/

# Check for overly permissive sudo (ALL=(ALL) ALL and ALL=(ALL:ALL) ALL)
sudo grep -r 'ALL=(ALL' /etc/sudoers /etc/sudoers.d/

# Users in sudo/wheel group
getent group sudo
getent group wheel

Service Configuration​

# Apache (Debian path /etc/apache2 ; RHEL path /etc/httpd)
grep -RIE "Indexes|ServerTokens|ServerSignature|TraceEnable" /etc/apache2/ /etc/httpd/ 2>/dev/null
# Expected: -Indexes, ServerTokens Prod, ServerSignature Off, TraceEnable Off

# Nginx
grep -RIE "server_tokens|autoindex|ssl_protocols|ssl_ciphers" /etc/nginx/ 2>/dev/null
# Expected: server_tokens off; autoindex off; TLS 1.2/1.3 only

# Check running services on unexpected ports (anything not on loopback)
ss -tulnp | awk 'NR==1 || ($5 !~ /^127\./ && $5 !~ /^\[::1\]/)'

# Check for credentials in config files (-I skips binary matches)
sudo grep -RIin -E "password|passwd|secret|api[_-]?key|token" /etc/ 2>/dev/null | head -50

Kernel attack-surface posture (read-only)​

# Knobs that gate unprivileged access to kernel surfaces behind recent LPEs (n/a = not on this kernel)
for k in crypto.af_alg_restrict kernel.io_uring_disabled kernel.unprivileged_bpf_disabled \
kernel.kptr_restrict kernel.dmesg_restrict kernel.perf_event_paranoid \
kernel.yama.ptrace_scope user.max_user_namespaces kernel.unprivileged_userns_clone \
kernel.apparmor_restrict_unprivileged_userns kernel.modules_disabled; do
printf '%-48s %s\n' "$k" "$(sysctl -n "$k" 2>/dev/null || echo n/a)"
done

# Mandatory access control state (AppArmor / SELinux)
sudo aa-status 2>/dev/null | head -5 ; getenforce 2>/dev/null

# Module blocklists (e.g. "install algif_aead /bin/false")
grep -rshE '^(install|blacklist)' /etc/modprobe.d /lib/modprobe.d /usr/lib/modprobe.d 2>/dev/null

# /proc/&lt;pid&gt;/mem write-override policy (kernels that have the option)
grep -E 'CONFIG_PROC_MEM_(ALWAYS_FORCE|FORCE_PTRACE|NO_FORCE)=y' "/boot/config-$(uname -r)" 2>/dev/null

Record each value in the report. A permissive value is not a vulnerability on its own; it widens the unprivileged path to the kernel bugs in the §4 LPE table:

  • Unprivileged user namespaces (user.max_user_namespaces, Debian/Ubuntu kernel.unprivileged_userns_clone, Ubuntu kernel.apparmor_restrict_unprivileged_userns) for the nf_tables, OverlayFS and ESP (CVE-2026-46300) rows [verify 2026-11-05].
  • Module blocklists for the AF_ALG rows: algif_aead covers Copy Fail, but CVE-2025-39964 is in af_alg_sendmsg(), which both algif_skcipher and algif_aead call, so it needs both blocked [verify 2026-11-05].
  • crypto.af_alg_restrict (Linux 7.3+; default 1 = limited algorithm list, 2 = AF_ALG disabled) is hardening against future AF_ALG bugs; upstream 7.3 already carries the Copy Fail and CVE-2025-39964 fixes [verify 2026-11-05].

4. Privilege Escalation Vectors (Non-Destructive Checks)​

PATH Hijacking​

# Check PATH for writable directories
echo $PATH | tr ':' '\n' | while read dir; do ls -ld "$dir" 2>/dev/null; done

# Check if the current directory is in PATH (dangerous): "." or an empty entry (leading/trailing ":" or "::")
printf '%s\n' "$PATH" | grep -nE '(^|:)(\.)?(:|$)' && echo 'cwd (. or empty entry) in PATH'

Writable Scripts/Binaries in Privileged Locations​

# Check if user can write to system binaries
find /usr/bin /usr/sbin /bin /sbin -writable 2>/dev/null

# Check for writable scripts called by root cron
cat /etc/crontab
ls -la /etc/cron.d/
ls -la /etc/cron.daily/

Kernel & userland LPE (Version Check Only)​

Only enumerate. Do not run public exploit binaries on production hosts — many are noisy, panic-prone, or backdoored. If exploitation is in scope, copy the host kernel/glibc/sudo/polkit versions into a sandbox and reproduce there.

# Distribution + kernel + relevant userland (sudo, glibc, polkit, runc)
cat /etc/os-release
uname -a # kernel version + build
ldd --version | head -1 # glibc
sudo --version | head -1 # sudo
pkexec --version 2>/dev/null # polkit
runc --version 2>/dev/null # container runtime

# Auditing tools (read-only, heuristic)
linux-exploit-suggester.sh # github.com/The-Z-Labs/linux-exploit-suggester
linux-exploit-suggester-2.pl # github.com/jondonas/linux-exploit-suggester-2 (legacy cross-check only:
# DB stops at 2018 CVEs, so it flags nothing in the table below)

# Installed kernels (multi-kernel hosts may boot a stale image)
dpkg -l | grep -E "^ii\s+linux-image" # Debian/Ubuntu
rpm -qa | grep -E "^kernel-" # RHEL/Fedora

Recent illustrative LPE primitives (verify each against the running kernel/userland — most distros ship patches):

CVEComponent (upstream affected → fixed)Trigger surfaceCISA KEV addedQuick check
CVE-2021-4034 (PwnKit)polkit pkexec < 121 (fixed upstream in 121) [verify 2026-11-05]SUID pkexec + crafted argv/env2022-06-27ls -l $(command -v pkexec) ; pkexec --version — distros back-ported the fix into older versions (e.g. Ubuntu 20.04 policykit-1 0.105-26ubuntu1.2), so check the distro tracker, not the version string
CVE-2022-0847 (DirtyPipe)Linux kernel 5.8 → fixed 5.10.102 / 5.15.25 / 5.16.11 [verify 2026-11-05]splice() into pipe, write to read-only file2022-04-25uname -r below the fixed stable for its branch (distro back-ports differ)
CVE-2026-31431 ("Copy Fail")Linux kernel algif_aead (AF_ALG) 4.14 → fixed 5.10.254 / 5.15.204 / 6.1.170 / 6.6.137 / 6.12.85 / 6.18.22 / 6.19.12 / 7.0 [verify 2026-11-05]Unprivileged AF_ALG socket → page-cache write (DirtyPipe class)2026-05-01uname -r vs fixed stable ; lsmod | grep -E '^(algif_aead|af_alg)' ; grep -rsE 'algif_aead|af_alg' /etc/modprobe.d /lib/modprobe.d /usr/lib/modprobe.d (install algif_aead /bin/false blocks loading) ; cat /proc/sys/crypto/af_alg_restrict (7.3+: 1 = limited algorithm list, the default; 2 = AF_ALG disabled)
CVE-2025-39964Linux kernel af_alg (concurrent af_alg_sendmsg) 2.6.38 → fixed 5.10.245 / 5.15.194 / 6.1.154 / 6.6.108 / 6.12.49 / 6.16.9 / 6.17 [verify 2026-11-05]AF_ALG sockets: af_alg_sendmsg() is shared by algif_skcipher and algif_aead2026-09-18uname -r vs fixed stable ; lsmod | grep -E '^(af_alg|algif_skcipher|algif_aead)' ; the modprobe.d blocklist must cover algif_skcipher too: an algif_aead-only blocklist (the Copy Fail mitigation) does not cover this CVE
CVE-2026-46300Linux kernel net: skbuff (shared-frag marker lost on coalescing) 3.9 → fixed 5.15.208 / 6.1.174 / 6.6.141 / 6.12.91 / 6.18.33 / 7.0.10 / 7.1; NVD lists 5.10 up to 5.10.257 as affected [verify 2026-11-05]Modification of page-cache-backed data: coalescing drops the shared-frag marker, so ESP decrypts in place over page-cache pages2026-10-28uname -r vs fixed stable ; lsmod | grep -E '^(esp4|esp6)'
CVE-2026-53266Linux kernel netfilter bridge ebt_snat → fixed 5.10.259 / 5.15.210 / 6.1.176 / 6.6.143 / 6.12.94 / 6.18.36 / 7.0.13 / 7.1; NVD lists no 5.4 fix [verify 2026-11-05]The ARP sender-address rewrite writes into a socket-buffer fragment backed by a splice-imported file page2026-09-18uname -r vs fixed stable ; lsmod | grep -E '^(ebtables|ebt_snat)'
CVE-2026-53362Linux kernel IPv6 __ip6_append_data 6.0 → fixed 6.1.177 / 6.6.144 / 6.12.95 / 6.18.38 / 7.1.3 [verify 2026-11-05]IPv6 __ip6_append_data paged-allocation path; NVD says an unprivileged user can trigger it through a UDPv6 socket2026-08-27uname -r vs fixed stable
CVE-2022-0995Linux kernel watch_queue 5.8 → fixed 5.10.106 / 5.15.29 / 5.16.5 / 5.17 [verify 2026-11-05]Out-of-bounds write in the watch_queue notification subsystem2026-08-26uname -r vs fixed stable
CVE-2022-0492Linux kernel cgroup v1 release_agent 2.6.24 → fixed 4.9.301 / 4.14.266 / 4.19.229 / 5.4.177 / 5.10.97 / 5.15.20 / 5.16.6 / 5.17 [verify 2026-11-05]release_agent write → privilege escalation / namespace-isolation bypass2026-06-02uname -r vs fixed stable ; findmnt -t cgroup -o TARGET (no output = no cgroup v1 hierarchy mounted now; with CAP_SYS_ADMIN, also check /proc/cmdline for cgroup_no_v1=all,named, without which v1 can still be mounted)
CVE-2018-14634Linux kernel create_elf_tables() integer overflow; NVD lists 2.6.x up to 2.6.39.4, 3.10.x up to 3.10.102 and 4.14.x up to 4.14.54; its affected platforms include RHEL 6 / 7 [verify 2026-11-05]Unprivileged local user executing a SUID (or otherwise privileged) binary2026-01-26uname -r vs the vendor tracker's fixed kernel for that release (legacy hosts only)
CVE-2023-2640 / CVE-2023-32629 (GameOver(lay))Ubuntu OverlayFS (Ubuntu kernels only; fixed version differs per series) [verify 2026-11-05]Ubuntu-shipped OverlayFS patches—lsb_release -a (Ubuntu only) + full uname -r vs the Ubuntu CVE page's fixed version for that series ; unprivileged user namespaces allowed? (§3 Kernel attack-surface posture)
CVE-2023-4911 (Looney Tunables)glibc ld.so 2.34 → fixed 2.39 [verify 2026-11-05]ld.so overflow parsing GLIBC_TUNABLES at SUID-binary startup2023-11-21ldd --version (glibc 2.34–2.38 unpatched; distros back-port)
CVE-2023-22809 (sudoedit env-var)C sudo 1.8.0–1.9.12p1, fixed 1.9.12p2 (sudo.ws on Ubuntu ≥ 25.10; not sudo-rs) [verify 2026-11-05]EDITOR/VISUAL/SUDO_EDITOR argv injection—sudo --version ; sudo -l shows sudoedit rule
CVE-2021-3156 (Baron Samedit)C sudo 1.7.7–1.7.10p9, 1.8.2–1.8.31p2, 1.9.0–1.9.5p1; fixed 1.8.32 / 1.9.5p2 (sudo.ws on Ubuntu ≥ 25.10; not sudo-rs) [verify 2026-11-05]Heap overflow via sudoedit -s argv2022-04-06sudo --version ; reproduce only in sandbox
CVE-2025-32463 (sudo chroot)C sudo 1.9.14–1.9.17, fixed 1.9.17p1 (sudo.ws on Ubuntu ≥ 25.10; not sudo-rs) [verify 2026-11-05]sudo -R / --chroot loads nsswitch.conf from the user-chosen root; no sudoers rule for the command is needed2025-09-29sudo --version (distros back-port) ; reproduce only in sandbox
CVE-2023-32233Linux kernel nf_tables 3.13 → fixed 4.14.315 / 4.19.283 / 5.4.243 / 5.10.180 / 5.15.111 / 6.1.28 / 6.2.15 / 6.3.2 [verify 2026-11-05]Anonymous-set UAF—uname -r vs fixed stable ; unprivileged user namespaces allowed? (§3 Kernel attack-surface posture) ; grep CONFIG_NF_TABLES= /boot/config-$(uname -r) — the module autoloads on demand, so absence from lsmod is not a mitigation
CVE-2024-1086Linux kernel nf_tables 3.15 → fixed 5.15.149 / 6.1.76 / 6.6.15 / 6.7.3 (mainline commit f342de4e2f33) [verify 2026-11-05]UAF via nft_verdict_init2024-05-30uname -r vs fixed stable ; unprivileged user namespaces allowed? (§3 Kernel attack-surface posture) ; grep CONFIG_NF_TABLES= /boot/config-$(uname -r) — the module autoloads on demand, so absence from lsmod is not a mitigation
CVE-2024-21626 (Leaky Vessels)runc 1.0.0-rc93 → 1.1.11, fixed 1.1.12 [verify 2026-11-05]FD leak → host filesystem in container—runc --version ; container engines bundle runc — check the runc component in docker version / the containerd build
CVE-2015-3246 / CVE-2015-5287Legacy RHEL/CentOS userland: libuser < 0.56.13-8 and 0.60 < 0.60-7 (via userhelper); ABRT abrt-hook-ccpp < 2.7.1 [verify 2026-11-05]Race that corrupts /etc/passwd; symlink attack on a predictable file name2026-08-26rpm -q libuser usermode abrt (legacy RHEL/CentOS only)

Fixed versions are upstream releases per NVD and CISA KEV dates per the KEV catalog [verify 2026-11-05]. Distro kernels and packages carry back-ports under their own version strings, and NVD lists no fix for end-of-life branches (e.g. 5.16–6.0 for CVE-2024-1086), so treat those as affected unless the vendor tracker says otherwise. Cross-check with the vendor security tracker (https://ubuntu.com/security/&lt;id&gt;, https://access.redhat.com/security/cve/&lt;id&gt;, https://security-tracker.debian.org/tracker/&lt;id&gt;).

linux-exploit-suggester (v1) covers only some rows (CVE-2021-4034, CVE-2022-0847, CVE-2021-3156, CVE-2025-32463, CVE-2022-0995, CVE-2018-14634, CVE-2024-1086, CVE-2015-3246, CVE-2015-5287) and has no 2026 entries; check the others by version [verify 2026-11-05]. Several rows sit in modules that autoload on demand (AF_ALG, nf_tables, ebtables), so record lsmod and the /etc/modprobe.d blocklists alongside uname -r.

Capabilities (Linux File Capabilities)​

TARGET_PID=1 # process to inspect

# File capabilities across the entire mounted filesystem
getcap -r / 2>/dev/null

# Capabilities of the current process / shell / a target PID
capsh --print
getpcaps $$
getpcaps "$TARGET_PID"

# Per-thread capabilities (CapEff/CapPrm/CapBnd as bitmaps — decode with capsh)
grep ^Cap /proc/self/status
capsh --decode=$(awk '/^CapEff/{print $2}' /proc/self/status)

Dangerous capabilities (single-cap → root) — most have a documented GTFOBins-style escalation path; cross-reference GTFOBins → Capabilities:

CapabilityWhy it's root-equivalent
cap_setuid / cap_setgidDirect UID/GID change inside scripted interpreters that hold the cap
cap_dac_overrideBypass file read/write/execute permission checks (read /etc/shadow)
cap_dac_read_searchBypass file read + directory search checks
cap_chown / cap_fownerRe-own arbitrary files (chown root:root + chmod +s)
cap_sys_adminEffectively root: mount, BPF, kernel module ops, namespace setup
cap_sys_ptraceAttach to root processes; inject shellcode
cap_sys_moduleLoad kernel modules (drop a malicious .ko)
cap_bpf (kernel ≥ 5.8)Load BPF programs without cap_sys_admin

Not root-equivalent alone (lateral / MITM / chained):

CapabilityWhy it matters
cap_net_admin / cap_net_rawInterface/firewall/routing changes, raw sockets → sniffing/spoofing on the host network; not a direct path to UID 0 (cap_net_raw on ping is normal)
cap_sys_chrootchroot(2) / setns(2) into mount namespaces only; escape primitives need an additional cap such as cap_sys_admin

ATT&CK [verify 2026-11-05]: T1548 (Abuse Elevation Control Mechanism — file-capability abuse has no dedicated sub-technique), T1548.001 (Setuid and Setgid).

Container & runtime escape (If Applicable)​

# Am I in a container? (any of the following is a strong signal)
ls -la /.dockerenv /run/.containerenv 2>/dev/null # Docker ; Podman
grep -E "docker|kubepods|containerd|lxc|crio" /proc/1/cgroup /proc/self/cgroup 2>/dev/null
# cgroup v2 + private cgroup namespace shows only '0::/' — absence is not proof of host;
# corroborate with /proc/1/mountinfo (overlay root) and /.dockerenv / /run/.containerenv
tr '\0' '\n' < /proc/1/environ 2>/dev/null | grep '^container=' # value names the manager (lxc, systemd-nspawn, podman, …)
cat /proc/1/sched | head -1 # PID 1 not "init"/"systemd" → container

# What kind? (orchestrator hints)
mount | grep -E "overlay|aufs|fuse-overlayfs"
ls /var/run/secrets/kubernetes.io/serviceaccount/ 2>/dev/null # K8s pod
env | grep -E "KUBERNETES_|HOSTNAME|HOST_IP"
# === Docker socket mounted into container (host control plane exposed) ===
ls -la /var/run/docker.sock /run/docker.sock 2>/dev/null
# If readable, the container can drive the host's Docker daemon and request
# a new container with the host root mounted — equivalent to root on host.
# Equivalent for containerd / nerdctl / podman sockets:
ls -la /run/containerd/containerd.sock /run/podman/podman.sock 2>/dev/null

# === User in `docker` group (host) ===
id ; groups | grep -qw docker && echo "docker group → root-equivalent on host"

# === Privileged or over-capabilitied containers ===
# Inside container: check own capability set
capsh --print | grep -E "cap_sys_admin|cap_sys_module|cap_sys_ptrace|cap_dac_read_search"
# CAP_SYS_ADMIN + writable cgroup v1 → release_agent escape (legacy primitive; kernel bug
# CVE-2022-0492, CISA KEV 2026-06-02 [verify 2026-11-05]). Needs a cgroup v1 hierarchy:
# FSTYPE "cgroup" rows = v1 mounted now; only "cgroup2" = none mounted, but a CAP_SYS_ADMIN
# container can still mount v1 itself unless the kernel was booted with cgroup_no_v1=all,named
findmnt -t cgroup,cgroup2 -o TARGET,FSTYPE
grep -o 'cgroup_no_v1=[^ ]*' /proc/cmdline # needs both "all" and "named" to refuse every v1 mount

# === runc / Leaky Vessels (CVE-2024-21626) ===
runc --version 2>/dev/null
docker version --format '{{range .Server.Components}}{{.Name}} {{.Version}}{{"\n"}}{{end}}' 2>/dev/null
# runc 1.0.0-rc93 to 1.1.11 → FD leak escape; fixed in runc 1.1.12, bundled with Docker Engine
# 25.0.2 / 24.0.9 and containerd 1.7.13 / 1.6.28 [verify 2026-11-05]. Check the bundled runc, not the engine version.

# === Kubernetes pod context ===
SA=/var/run/secrets/kubernetes.io/serviceaccount
[ -d "$SA" ] && { cat "$SA/namespace"; head -c40 "$SA/token"; echo; cat "$SA/ca.crt" | head -2; }
# With token + API server reachable: `kubectl auth can-i --list` (requires kubectl in image
# or curl-able API). Look for: pods/exec, secrets, nodes/proxy, clusterrolebindings.

The runc versions above are the floor for CVE-2024-21626 only. runc, containerd and CRI-O have all published newer security advisories (2026 included), so check the vendors' GitHub security advisories and Container & K8s Pentest before reporting a runtime as patched.

T1611 (Escape to Host), T1610 (Deploy Container), T1613 (Container and Resource Discovery).

Sudo policy & sudo CVE surface​

# Which sudo is this? Ubuntu >= 25.10 (incl. 26.04 LTS) ships sudo-rs as `sudo`; C sudo is `sudo.ws`
sudo --version | head -1 # "sudo-rs 0.2.x" = sudo-rs ; "Sudo version 1.x" = C sudo
command -v sudo.ws && sudo.ws --version | head -1
readlink -f "$(command -v sudo)" # /usr/lib/cargo/bin/sudo = sudo-rs (Ubuntu alternatives)

# Effective sudo policy for current user (-n returns non-zero if a password is needed → still informative)
sudo -n -l 2>&1 || sudo -l

# Look for sudoers entries that map to GTFOBins escalation; matches (ALL), (root) and (ALL : ALL)
sudo -l | grep -E 'NOPASSWD|\((ALL|root)( : [^)]*)?\)|sudoedit'

# Sudoers files referenced (read-only — these are mode 440 root-owned). Recurse inside the root
# process: a sudoers.d/* glob expanded by your own shell silently misses a 0750 directory
sudo grep -rhvE '^\s*(#|$)' /etc/sudoers /etc/sudoers.d/

# Quick GTFOBins lookup for any binary in your sudo policy:
# https://gtfobins.org/gtfobins/&lt;binary&gt;/ (or filter: https://gtfobins.org/#^&lt;binary&gt;$//^sudo$)

Apply the C-sudo rows of the LPE table (CVE-2021-3156, CVE-2023-22809, CVE-2025-32463) only to sudo 1.x / sudo.ws. The sudo -l / GTFOBins workflow is the same for both. sudo-rs has its own security advisories, for example:

  • GHSA-f42v-x7gq-phc8: sudoedit TOCTOU local privilege escalation in sudo-rs 0.2.8 to 0.2.14, fixed in 0.2.15; it matters only where sudoers grants file-specific sudoedit [verify 2026-11-05].
    • Cite it by the GHSA ID. Its CVE ID, CVE-2026-120696, is only reserved, with no published CVE record and no NVD entry [verify 2026-11-05].
    • Ubuntu 26.04 back-ported the fix into its 0.2.13 package (rust-sudo-rs 0.2.13-0ubuntu1.2), so compare the package release (dpkg-query -W sudo-rs), not the upstream version [verify 2026-11-05].

Polkit / pkexec​

pkexec --version 2>/dev/null # PwnKit (CVE-2021-4034) fixed upstream in polkit 121 / distro back-ports
ls -l $(command -v pkexec) # SUID root — present on most desktop installs
pkaction | head -20 # registered actions (look for org.freedesktop.policykit.exec)
ls /etc/polkit-1/rules.d/ /run/polkit-1/rules.d/ /usr/local/share/polkit-1/rules.d/ /usr/share/polkit-1/rules.d/ /usr/share/polkit-1/actions/ 2>/dev/null

systemd unit & timer abuse​

# Writable units and drop-ins (override files in /etc/systemd are loaded with priority over /lib/systemd).
# Run as the assessed low-privileged user, NOT via sudo: -writable tests the current user, and root matches everything
find /etc/systemd /lib/systemd /usr/lib/systemd /run/systemd -type f \( -name '*.service' -o -name '*.timer' -o -name '*.socket' -o -name '*.conf' \) -writable 2>/dev/null

# Enumerate timers — alternative scheduler to cron
systemctl list-timers --all --no-pager
systemctl list-unit-files --type=service --state=enabled --no-pager

# User-level units; lingering users get a user manager at boot (their units run without a login session)
ls -la ~/.config/systemd/user/ 2>/dev/null
ls /var/lib/systemd/linger/ 2>/dev/null # one file per lingering user

NFS Shares (Privilege Escalation)​

NFS_SERVER="nfs.example" # NFS server in scope

# Check for NFS exports
cat /etc/exports 2>/dev/null
showmount -e "$NFS_SERVER" 2>/dev/null

# Look for no_root_squash (mount as remote root, drop SUID shell, exec as local user);
# no_all_squash is the default, so it is not flagged
grep -HE 'no_root_squash|insecure' /etc/exports /etc/exports.d/*.exports 2>/dev/null

User-mountable fstab entries​

# fstab entries that let ordinary users mount (user / users / owner / group): SUID mount(8) attack surface
grep -vE '^\s*#' /etc/fstab | grep -E '(^|[[:space:],])(user|users|owner|group)(,|[:space:](../../:space:)|$)'
mount --version | head -1 # util-linux version (compare with the advisories below)

util-linux published several mount(8) / libmount local-privilege-escalation advisories in 2026 (e.g. CVE-2026-78410, X-mount.owner/group/mode redirection through restricted bind mounts); all are fixed in util-linux 2.41.6 / 2.42.3 [verify 2026-11-05]. A user-mountable fstab entry (especially one with X-mount.* options) on an older build is the precondition to report; distro back-ports differ, so check the vendor tracker. Source: util-linux security advisories.


5. Logging & Monitoring Review​

Check Logging Status​

# Syslog/rsyslog status
systemctl status rsyslog
systemctl status syslog-ng

# Auth log (login attempts, sudo usage)
tail -100 /var/log/auth.log # Debian/Ubuntu
tail -100 /var/log/secure # RHEL/CentOS
# journald-only hosts (Debian 12+ installs no rsyslog by default, so no auth.log) [verify 2026-11-05]
sudo journalctl SYSLOG_FACILITY=4 SYSLOG_FACILITY=10 --since "-7d" --no-pager | tail -100 # auth + authpriv

# Check for log rotation
cat /etc/logrotate.conf
ls /etc/logrotate.d/

# Check log permissions (should not be world-readable)
ls -la /var/log/

Audit Daemon (auditd)​

# Check if auditd is running
systemctl status auditd

# Review audit rules
auditctl -l

# Check for monitoring of sensitive files
auditctl -l | grep -E "/etc/passwd|/etc/shadow|/etc/sudoers"

Failed Login Attempts​

# Check for brute force attempts
grep "Failed password" /var/log/auth.log | tail -50

# Count failed logins by IP
grep "Failed password" /var/log/auth.log | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn

# journald-only hosts
sudo journalctl SYSLOG_FACILITY=4 SYSLOG_FACILITY=10 --no-pager | grep "Failed password" | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn

ATT&CK [verify 2026-11-05]: a stopped auditd, deleted audit rules, or cleared/truncated logs found here map to T1685.004 (Disable or Modify Linux Audit System Log) and T1685.006 (Clear Linux or Mac System Logs), both Defense Impairment (TA0112).


6. Network Security​

Firewall Configuration​

# Check firewall status
sudo iptables -L -v -n
sudo ufw status verbose
sudo firewall-cmd --list-all-zones # --list-all alone shows only the default zone
sudo nft list ruleset # firewalld >= 0.6 writes native nft rules that iptables -L does not show

# Overly permissive iptables rules: default-ACCEPT policies, and ACCEPT rules with no source restriction
# (review the hits: loopback and ESTABLISHED,RELATED accepts are normal)
sudo iptables -S | grep -E '^-P (INPUT|FORWARD) ACCEPT|^-A .* -j ACCEPT' | grep -v -- ' -s '

Exposed Services​

TARGET_IP="192.0.2.10" # in-scope host address

# Check what's listening externally (drops 127.0.0.0/8 and [::1]; same filter as §3)
ss -tulnp | awk 'NR==1 || ($5 !~ /^127\./ && $5 !~ /^\[::1\]/)'

# Scan from external perspective (if authorized)
nmap -sV -p- "$TARGET_IP"

7. Automated Enumeration Tools​

Always download to disk and inspect before piping curl | sh on a target you do not control. The snippets below assume an authorized lab.

LinPEAS (PEASS-ng) — primary​

# Canonical org is now peass-ng/PEASS-ng (carlospolop/PEASS-ng redirects)
curl -fL -o /tmp/linpeas.sh https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh
sha256sum /tmp/linpeas.sh # record hash in evidence
chmod +x /tmp/linpeas.sh
/tmp/linpeas.sh -n > /tmp/linpeas.out # default checks; -n = no hostname/inventory POST to tools.hacktricks.wiki

# -a = all checks, which ALSO (a) brute-forces `su` for every shell user with null / username /
# top-2000 passwords (account lockout + auth-log noise: needs explicit RoE sign-off) and
# (b) turns on the same online lookup as -V, which uploads the hostname, OS/kernel release and up to
# 300 installed packages (HACKTRICKS_PACKAGE_LIMIT) to tools.hacktricks.wiki [verify 2026-11-05].
# If -a is authorized, run `-a -n` and tell the client's SOC first.
# Other flags: -s (stealth & faster), -e (extra enumeration), -o &lt;sections&gt; (comma list:
# system_information,container,cloud,procs_crons_timers_srvcs_sockets,network_information,
# users_information,software_information,interesting_perms_files,interesting_files,api_keys_regex),
# -P &lt;password&gt; (used for `sudo -l`, and added to the `su` brute-force when -a runs it), -T <ATT&CK IDs>.
# -n only disables the HackTricks host checker; the internet-access probes (TCP 80/443, ICMP, DNS) still run.

Copy Fail probe (releases from 20260430-8eec6923 on): the default run's System Information section includes a Copy Fail (CVE-2026-31431) check. When python3 or python is present it writes a probe script under /tmp and runs a self-described non-destructive AF_ALG/splice page-cache write against a temporary file it creates [verify 2026-11-05]. Clear that under the Pre-Engagement "Kernel-exploit detonation scope" item, or leave system_information out of an -o section list (which also drops the rest of that section), and warn the blue team that AF_ALG detection rules (e.g. Neo23x0/auditd) may fire.

Container probes: inside a container the default run's container section also attempts cgroup v1 mounts (directly and via unshare -UrmC) and zero-byte open-for-write tests on /proc and /sys files [verify 2026-11-05]. Clear these under the Pre-Engagement "Container escape boundary" item, or leave container out of an -o section list.

Linux Smart Enumeration (LSE) — secondary, color-graded​

# Tagged release asset only: master's CVE tests add a Copy Fail test that exploits the bug (see §14) [verify 2026-11-05]
curl -fL -o /tmp/lse.sh https://github.com/diego-treitos/linux-smart-enumeration/releases/latest/download/lse.sh
sha256sum /tmp/lse.sh # record hash in evidence
chmod +x /tmp/lse.sh
/tmp/lse.sh -l 2 -i > /tmp/lse.out # -l 2 = full verbosity, -i = non-interactive

linux-exploit-suggester(-2) — kernel-CVE heuristics (read-only)​

# v1 (The-Z-Labs / mzet). No releases: master is unpinned, so the hash is the only version record
curl -fL -o /tmp/les.sh https://raw.githubusercontent.com/The-Z-Labs/linux-exploit-suggester/master/linux-exploit-suggester.sh
sha256sum /tmp/les.sh # record hash in evidence
chmod +x /tmp/les.sh && /tmp/les.sh

# v2 (jondonas) — Perl rewrite; signature DB stops at 2018-era CVEs (last commit Jan 2022) [verify 2026-11-05]
# Only useful on legacy kernels; a clean result is NOT evidence of a patched kernel.
curl -fL -o /tmp/les2.pl https://raw.githubusercontent.com/jondonas/linux-exploit-suggester-2/master/linux-exploit-suggester-2.pl
sha256sum /tmp/les2.pl # record hash in evidence
perl /tmp/les2.pl # no -k: it rejects distro strings like 6.8.0-147-generic; auto-detects via uname -r | cut -d- -f1

LinEnum (legacy)​

# rebootuser/LinEnum — kept for parity with old playbooks; no releases, last commit Jan 2020 [verify 2026-11-05]
# LinPEAS / LSE supersede it. Use only if both refuse to run.
curl -fL -o /tmp/LinEnum.sh https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh
sha256sum /tmp/LinEnum.sh # record hash in evidence
bash /tmp/LinEnum.sh

pspy — process snooping without root​

# Reveals cron/systemd-driven root processes and their argv (file watch via inotify)
curl -fL -o /tmp/pspy https://github.com/DominicBreuker/pspy/releases/latest/download/pspy64
sha256sum /tmp/pspy # record hash in evidence
chmod +x /tmp/pspy && /tmp/pspy -pf -i 1000

Note: Review tool output manually; automated scanners generate false positives and miss context. Version-matching CVE heuristics (linux-exploit-suggester, especially the 2018-frozen LES2 DB) flag CVEs the distro kernel has already back-ported fixes for. Treat findings as leads, not verdicts.


8. Common Misconfigurations Checklist​

Authentication & SSH

  • Root login via SSH enabled (PermitRootLogin yes)
  • Password authentication enabled when keys should be used
  • PermitEmptyPasswords yes or KbdInteractiveAuthentication yes left on
  • Weak SSH KEX/Cipher/MAC (e.g. diffie-hellman-group1, arcfour, MD5/SHA-1 MACs) — confirm with ssh-audit
  • No post-quantum hybrid KEX offered (mlkem768x25519-sha256, sntrup761x25519-sha512, which is sntrup761x25519-sha512@openssh.com before OpenSSH 9.9); ssh-audit ≥ 3.9.0 warns on every KEX that is not post-quantum safe [verify 2026-11-05]
  • OpenSSH ≥ 10.6 with WarnWeakCrypto turned off, or AgentSocketPath set to a shared: directory without a stated reason (check sshd -T) [verify 2026-11-05]
  • Authorized keys present in unexpected accounts (root, service users, decommissioned employees)

Authorization

  • Users in sudoers with NOPASSWD, or (ALL) ALL for non-admins
  • Sudoers rule maps to a binary listed on GTFOBins (vi, find, awk, less, python, tar, nmap interactive mode, …)
  • sudo / sudoedit / polkit version still vulnerable to CVE-2021-3156, CVE-2023-22809, CVE-2025-32463, CVE-2021-4034 (the sudo CVEs apply to C sudo / sudo.ws; sudo-rs has its own advisories, see §4 Sudo) [verify 2026-11-05]

Filesystem permissions

  • World-writable files / directories in system paths (/etc, /usr, /opt, /srv)
  • SUID/SGID binaries outside the distro's expected baseline (compare with a known-good install)
  • Files with dangerous capabilities (cap_setuid+ep, cap_dac_read_search+ep, cap_sys_admin+ep)
  • Weak permissions on /etc/shadow, /etc/sudoers, /etc/sudoers.d/*, ~/.ssh/authorized_keys

Kernel attack surface (§3 posture block; informational alone, raise it when it opens the path to a §4 LPE row)

  • AF_ALG reachable on a kernel below the Copy Fail / CVE-2025-39964 fixes: no install … /bin/false blocklist for the relevant algif_* modules (algif_aead for Copy Fail; algif_skcipher and algif_aead for CVE-2025-39964) [verify 2026-11-05]
  • crypto.af_alg_restrict=0 on Linux 7.3+ (default 1); hardening only, as 7.3 already has both fixes [verify 2026-11-05]
  • kernel.modules_disabled=0 on a fixed-role host that loads all its modules at boot, or CONFIG_PROC_MEM_ALWAYS_FORCE=y (the upstream default) with no proc_mem.force_override=ptrace / never on the kernel command line [verify 2026-11-05]
  • Unprivileged user namespaces allowed where no workload needs them (userns knobs in §3)
  • Unprivileged bpf() enabled (kernel.unprivileged_bpf_disabled=0) or io_uring open to every process (kernel.io_uring_disabled=0, the upstream default) on hosts that do not need them
  • Kernel pointers / log / profiling open to users: kernel.kptr_restrict=0, kernel.dmesg_restrict=0, kernel.perf_event_paranoid below 2 (the upstream default)
  • kernel.yama.ptrace_scope=0 (classic ptrace: any process may attach to dumpable same-UID processes)
  • AppArmor / SELinux disabled, SELinux permissive, or AppArmor profiles left in complain mode

Scheduled execution

  • Writable cron jobs / /etc/cron.d/* / /etc/cron.{hourly,daily,weekly,monthly}/*
  • Writable systemd .service / .timer / .socket units (especially under /etc/systemd/system/)
  • PATH wildcards or relative paths in root-executed scripts

Network & services

  • Firewall disabled or overly permissive (default ACCEPT policy, or ACCEPT rules with no source restriction; check the nft ruleset too)
  • Unnecessary services running (FTP, Telnet, rsh, rlogin, tftp, NFSv2/3 without Kerberos)
  • Internal services (databases, Redis, Elasticsearch, Memcached) bound to 0.0.0.0 instead of loopback
  • Default credentials in config files / committed .env / ~/.aws/credentials readable by group

Containers & runtime

  • User in docker group (root-equivalent on host)
  • Mounted Docker / containerd / podman socket inside a container
  • Privileged container (--privileged) or container holding CAP_SYS_ADMIN/CAP_SYS_MODULE
  • runc 1.0.0-rc93 – 1.1.11 (CVE-2024-21626 Leaky Vessels). Fixed in runc 1.1.12, bundled in Docker 25.0.2 / 24.0.9 and containerd 1.7.13 / 1.6.28 release builds; distro packages ship runc separately, so check runc --version or the vendor tracker [verify 2026-11-05]
  • Container runtime older than the current vendor-patched release: runc, containerd and CRI-O all published advisories in 2026 (several containerd and CRI-O ones rated critical), so the Leaky Vessels versions are a floor, not a baseline; see Container & K8s Pentest [verify 2026-11-05]
  • Kubernetes pod with cluster-admin SA token, or hostPath/hostNetwork/hostPID exposed

Storage

  • NFS exports with no_root_squash / insecure
  • fstab grants user / users / owner / group mounts (especially with X-mount.* options) on util-linux older than 2.41.6 / 2.42.3 (2026 SUID mount(8) advisories; see §4 User-mountable fstab entries) [verify 2026-11-05]
  • World-readable backups (/var/backups, /root/*.bak, mysqldumps with passwords inline)

Logging & visibility

  • No central logging (rsyslog/journald → SIEM forwarder absent)
  • auditd not running or no rules covering /etc/passwd, /etc/shadow, /etc/sudoers
  • Log files world-readable (history of usernames, source IPs)

Patch posture

  • Kernel / glibc / sudo / polkit / OpenSSL / OpenSSH severely out of date
  • Kernel below the fixed stable (or the distro back-port) for a CISA KEV-listed LPE in the §4 table; its 2026 KEV additions are CVE-2026-31431 (Copy Fail), CVE-2026-46300, CVE-2026-53266, CVE-2026-53362, CVE-2025-39964, CVE-2022-0995, CVE-2022-0492, CVE-2018-14634 [verify 2026-11-05]
  • Kernel below the fix for CVE-2025-39682 (TLS receive path; KEV 2026-09-18; upstream 6.0 → fixed 6.1.149 / 6.6.103 / 6.12.44 / 6.16.4 / 6.17). It is the only 2026 KEV kernel addition missing from the §4 table, which lists LPEs only; neither KEV nor NVD describes this one as an LPE [verify 2026-11-05]
  • Release past end of life (e.g. Ubuntu 25.10 ended 2026-07-09; Debian 11 LTS ended 2026-08-31, extended support continues) [verify 2026-11-05]
  • Kernel on upstream 5.10 / 5.15 LTS, projected to reach end of life in December 2026 (kernel.org); after that only distro back-ports cover it [verify 2026-11-05]
  • Unattended upgrades disabled on internet-facing hosts

9. Evidence Collection​

For each finding, document:

  • Exact command used
  • Full output (sanitize sensitive data)
  • Timestamp (UTC)
  • Affected hosts/files
  • Screenshot if GUI-based

File structure:

/Evidence/{engagement_id}/Linux/
├── enumeration/
│ ├── 20251005_uname_output.txt
│ ├── 20251005_ps_aux.txt
│ ├── 20251005_ss_tulnp.txt
│ └── 20251005_linpeas.out
├── configs/
│ ├── 20251005_sshd_config.txt
│ ├── 20251005_sudoers.txt
│ └── 20251005_iptables.txt
├── permissions/
│ ├── 20251005_suid_binaries.txt
│ └── 20251005_world_writable.txt
└── screenshots/ # GUI-only evidence; keep tool output as text

Hash all files (recursive, every file type; same manifest pattern as Collection Log):

ENGAGEMENT_ID="2025-001" # engagement identifier used in the evidence path
cd "/Evidence/${ENGAGEMENT_ID}/Linux" && find . -type f -not -name "MANIFEST*" -exec sha256sum {} + > MANIFEST_SHA256SUMS.txt

10. Reporting​

Finding Format​

Title: SSH Root Login Enabled
Severity: Critical
Affected Hosts: server01.example.com, server02.example.com
Description: SSH daemon permits direct root login (PermitRootLogin yes)
Impact: Attackers can brute-force or use leaked credentials to gain root access
Evidence: `sudo sshd -T | grep -i permitrootlogin` → "permitrootlogin yes"
(source: /etc/ssh/sshd_config:32 or a drop-in in /etc/ssh/sshd_config.d/)
Remediation:
1. Edit the file that sets it (/etc/ssh/sshd_config or the drop-in)
2. Set: PermitRootLogin no
3. Validate, then restart: `sudo sshd -t && sudo systemctl restart ssh` (Debian/Ubuntu; on
socket-activated Ubuntu, if Port/ListenAddress changed: `sudo systemctl daemon-reload &&
sudo systemctl restart ssh.socket`) or `sudo sshd -t && sudo systemctl restart sshd`
(RHEL/Fedora). Keep an existing root/sudo session open until step 4 passes.
4. Test SSH access with non-root user + sudo
Verification: Re-check config and test login attempts as root (should fail)

Remediation Priorities​

  1. Critical: Root SSH, SUID exploits, kernel vulnerabilities
  2. High: Sudo NOPASSWD, world-writable system files, exposed services
  3. Medium: Weak logging, outdated packages, firewall gaps
  4. Low: Informational findings, hardening recommendations

  • Read-only first: Prefer enumeration over exploitation
  • No destructive actions without explicit approval (e.g., kernel exploits, DoS, fork bombs, kernel module loads)
  • No public exploit binaries on production: stage in a sandbox built from the host's distro / kernel / glibc / sudo / polkit / runc versions
  • Coordinate with sysadmins before running intensive scans
  • Stop immediately if you cause instability or user impact
  • Document everything for audit trail and legal defensibility (see Collection Log for chain-of-custody)
  • Respect scope: Do not pivot beyond authorized hosts; cloud workloads, managed-K8s control planes, and shared hypervisors are usually out-of-scope by default
  • Refer to Legal & Ethics (canonical) and OPSEC Plan for engagement-wide rules — this SOP does not re-derive them

12. Tools Reference​

Enumeration & privilege-escalation discovery

ToolPurposeInstall / Link
linpeas.shPrimary automated LPE enumeration (PEASS-ng)github.com/peass-ng/PEASS-ng
lse.shColor-graded LPE enumeration (verbosity 0–2)github.com/diego-treitos/linux-smart-enumeration
linux-exploit-suggesterKernel-CVE heuristic auditor (v1)github.com/The-Z-Labs/linux-exploit-suggester
linux-exploit-suggester-2Kernel-CVE heuristic auditor (v2, Perl; DB frozen at 2018-era CVEs, legacy kernels only)github.com/jondonas/linux-exploit-suggester-2
LinEnum.shLegacy Linux enumeration script (unmaintained since 2020 — fall back only)github.com/rebootuser/LinEnum
pspyMonitor processes / file events without rootgithub.com/DominicBreuker/pspy
GTFOBinsSUID / sudo / capabilities escalation databasegtfobins.org

Auditing & hardening baselines

ToolPurposeInstall / Link
lynisHost security auditapt install lynis ; dnf install lynis (RHEL: EPEL) ; latest from github.com/CISOfy/lynis
chkrootkit / rkhunterRootkit signature scannersapt install chkrootkit rkhunter
debsecan / dnf updateinfoOutstanding security advisories per hostapt install debsecan ; dnf updateinfo list --security (dnf4 and dnf5)
ssh-auditSSH server policy + algorithm auditgithub.com/jtesta/ssh-audit ; pip install ssh-audit
OpenSCAP / oscapCIS / STIG compliance scan; use ≥ 1.4.6 / 1.3.16 or a distro build with the CVE-2026-85518 path-traversal fix back-ported [verify 2026-11-05]apt install openscap-scanner (Ubuntu 24.04+; 22.04: libopenscap8) ; dnf install openscap-scanner scap-security-guide
auditd + auditctl / aureportKernel audit-rule enforcement & queryBundled with most distros

Capability / process / kernel introspection

ToolPurposeInstall / Link
getcap / setcap / capsh / getpcapsFile + process capability inspectionlibcap2-bin (Debian) / libcap (RHEL)
bpftraceLive kernel/user tracing (side-effect-free unless --unsafe is passed)apt install bpftrace
bpftopReal-time view of loaded eBPF programs (spot unexpected BPF on the host)apt install bpftop (Ubuntu 26.04+) or github.com/jfernandez/bpftop
auditd ruleset templatesAnomaly-detection baselinesgithub.com/Neo23x0/auditd

Container & Kubernetes

ToolPurposeInstall / Link
deepceDocker container enumeration & escape primitives auditgithub.com/stealthcopter/deepce
trivy k8sKubernetes misconfiguration + vulnerability scan (successor to the unmaintained kube-hunter)github.com/aquasecurity/trivy
kube-benchCIS Kubernetes Benchmark checks on nodes / control plane (kubeaudit is archived)github.com/aquasecurity/kube-bench
peiratesK8s post-exploitation toolkit (offensive)github.com/inguardians/peirates
amicontainedIdentify container runtime + capability set (unmaintained since 2020; deepce and the LinPEAS container section cover the same checks)github.com/genuinetools/amicontained

13. Common Pitfalls​

  • ❌ Running public exploit code on production (panic risk, backdoored PoCs)
  • ❌ Forgetting to sanitize sensitive data in reports (passwords, keys, tokens, JWTs from /var/run/secrets/...)
  • ❌ Not checking scope before scanning (out-of-scope hosts, shared K8s nodes, hypervisor)
  • ❌ Relying only on automated tools (miss context-specific issues; no scanner reads policy intent)
  • ❌ Not documenting commands/timestamps (breaks evidence chain — see Collection Log)
  • ❌ Ignoring false positives from tools (verify manually; version-based LES/LES2 heuristics over-flag back-ported distro kernels)
  • ❌ Assuming all SUID binaries are exploitable (check GTFOBins first; Linux ignores the SUID bit on shell scripts)
  • ❌ Treating CAP_*-marked binaries as benign because they aren't SUID (capabilities bypass the SUID check)
  • ❌ Inside a container, attacking the host without first verifying you actually left the container's namespaces — compare readlink /proc/self/ns/{pid,mnt,net,cgroup} with the values recorded on the host (the initial PID namespace is always pid:[4026531836]); /proc/1/cgroup and /proc/1/root look identical inside and outside on cgroup-v2 hosts with a private cgroup namespace (Docker's default)
  • ❌ Piping curl … | sh from a target you do not control; always download, hash, and inspect first
  • ❌ Failing to check kernel back-ports — Ubuntu/RHEL frequently patch a CVE without changing the upstream uname -r minor version

14. Reference Resources​

Comprehensive Knowledge Bases​

Enumeration & Scanning Tools​

  • LinPEAS Documentation - github.com/peass-ng/PEASS-ng/tree/master/linPEAS
    • Automated Linux privilege escalation enumeration (use latest release .sh)
  • Linux Smart Enumeration (LSE) - github.com/diego-treitos/linux-smart-enumeration
    • Color-coded enumeration with verbosity levels (latest tag 4.14nw, Dec 2023) [verify 2026-11-05]
    • Use only the tagged release asset. Master's CVE tests (packaged into lse.sh by tools/package_cvs_into_lse.sh) gained a Copy Fail test in May 2026 that runs at the default level [verify 2026-11-05].
    • That test is an exploit, not a version check: it modifies the page cache of a setuid binary and runs it. Run a master build only with explicit RoE sign-off for that test, under the Kernel-exploit detonation scope item.
  • linux-exploit-suggester - github.com/The-Z-Labs/linux-exploit-suggester
    • Heuristic kernel-CVE auditor (v1, shell)
  • linux-exploit-suggester-2 - github.com/jondonas/linux-exploit-suggester-2
    • Perl rewrite; signature DB frozen at 2018-era CVEs (last commit Jan 2022) — legacy kernels only
  • LinEnum - github.com/rebootuser/LinEnum
    • Legacy enumeration script — no published releases, unmaintained since Jan 2020 [verify 2026-11-05]
  • pspy - github.com/DominicBreuker/pspy
    • Monitor processes / file events without root (find cron jobs, root processes)

Hardening & Security Benchmarks​

  • CIS Benchmarks - Linux - cisecurity.org/cis-benchmarks
    • Security configuration benchmarks for Linux distributions
  • STIG (Security Technical Implementation Guides) - stigviewer.com/stigs
    • DoD STIGs for RHEL, Ubuntu, SLES and other platforms (third-party viewer; authoritative downloads at DISA cyber.mil)
  • SCAP Security Guide (ComplianceAsCode) - github.com/ComplianceAsCode/content
    • CIS / STIG profiles for oscap; v0.1.82 (Sep 2026) ships RHEL 10 STIG V1R2, RHEL 9 V2R9, RHEL 8 V2R8, Ubuntu 24.04 V1R5 and a new Ubuntu 26.04 product [verify 2026-11-05]
  • Lynis Documentation - cisofy.com/lynis
    • Security auditing tool for Linux/Unix systems

Exploit Databases​

  • Exploit Database - exploit-db.com
    • Searchable exploit database (searchsploit CLI tool)
  • CVE Details - cvedetails.com
    • Search CVEs by product/version

Kernel Exploitation Resources​

Docker & Container Security​

Vendor security trackers (kernel + userland CVE back-ports)​

Notable LPE write-ups (illustrative, not exhaustive)​

SSH & Authentication Resources​

Post-Exploitation & Persistence​

Cheat Sheets & Quick References​

Logging & Monitoring​

Practice Platforms​

Books & Courses​

Community & Forums​


Linux host testing runs with credentials on systems that hold other people's data. The canonical legal framework is Legal & Ethics; §11 lists the operational guardrails. The Linux-specific exposures:

  • Enumeration tools are not all passive. Without -n, linPEAS sends the target's hostname to a HackTricks web service; -a also brute-forces su against every shell account and uploads package inventory; LSE's untagged master branch runs a Copy Fail test at its default level (§7). Name each tool, release and flag set in the Rules of Engagement.
  • A CVE match is not authorization to trigger it. The §4 kernel, sudo and polkit checks stay version-only; running a privilege-escalation exploit on a production host needs separate written approval and a rollback plan.
  • Collected files can be credentials or personal data. Configuration, history and key material gathered during enumeration enters the evidence chain (Collection Log), is encrypted at rest, and is destroyed per the engagement letter.
  • Shared infrastructure belongs to someone else. Container hosts, managed Kubernetes control planes and hypervisors stay out of scope unless their owner signed the Rules of Engagement.

OPSEC framing lives in OPSEC Plan.


Engagement governance:

  • Legal & Ethics - Authorization, scope, evidence handling, jurisdictional rules (canonical)
  • OPSEC Plan - Operator and infrastructure OPSEC during the engagement
  • Collection Log - Evidence chain-of-custody pattern referenced by §9 above

Analysis:

Pentesting & Security:


Version: 1.1 · Last Updated: 2026-11-05 · Review Frequency: Quarterly (medium-rot tooling SOP — kernel/userland CVE landscape and PEASS-ng release cadence drive churn)