Misconfiguration-Based
A sudo rule, a writable file, or a capability that was set too loosely. No exploit code needed, just the right command.
Code-Execution Primitives
Library/module hijacking and similar techniques, these need a small C or Python payload compiled or dropped in the right place.
Sudo Abuse
Start from whatsudo -l showed during enumeration. Three separate things to check for:
- Allowed to run as root directly
- Allowed to run as another user
- No password required at all (NOPASSWD)
If a binary is allowed to run as root, GTFOBins is the place to check whether that binary can be abused to get a shell, read a file, or write a file as root, almost every common binary (If the allowed command is a text editor with no further restriction, edit
find, vim, less, python3, tar…) has a known escape listed there. A few of the most common language interpreters, directly:/etc/sudoers directly and grant full access:If
sudo -l shows env_keep+=LD_PRELOAD on any rule, skip ahead to the Library Hijacking section below, that single setting is a direct path to root regardless of which binary the rule is actually for.PATH & Wildcard Abuse
PATH hijacking
PATH hijacking
If a privileged script or cron job calls a common command (
ls, cp) without a full path, and a directory earlier in $PATH than the real binary’s location is writable, dropping a malicious file with that name there gets it run instead, as whatever user runs the script.Wildcard abuse (tar/rsync checkpoint trick)
Wildcard abuse (tar/rsync checkpoint trick)
Some privileged scripts run a command like
tar czf backup.tar.gz * over a directory you can write to. GNU tar’s --checkpoint options are themselves valid filenames, if tar expands a wildcard that happens to match files named like tar flags, it executes them as flags instead of treating them as filenames. Dropping files with these exact names in the writable directory makes tar run arbitrary commands.Capability Abuse
Linux capabilities split up what used to be all-or-nothing root power into individual permissions a binary can hold without being fully SUID.cap_dac_override is the one that matters most here, it lets a binary bypass file read/write permission checks entirely.
vim.basic or python3 shows cap_dac_override=eip, it can read and write any file on the system regardless of permissions, including the ones that actually matter.
Writable /etc/passwd
If /etc/passwd is writable directly (via a capability above, a misconfigured ACL, or any other write primitive), appending a new line creates a fully-privileged user from scratch, no password cracking needed, since you choose the hash yourself.
Library and Module Hijacking
Three variations on the same idea: get code you control loaded and run in the context of a more privileged process, by abusing how the dynamic linker or an interpreter finds the libraries/modules it needs.- LD_PRELOAD
- Python Module Hijacking
LD_PRELOAD tells the dynamic linker to load a specified shared library before any others. If sudo -l shows env_keep+=LD_PRELOAD on a rule, pointing it at a malicious library gets that library’s code run as root the moment the sudo command executes.Weak NFS Export Permissions
An NFS share exported withno_root_squash lets a client-created SUID binary keep its SUID bit and root ownership, NFS normally maps remote root to an unprivileged user specifically to prevent this. Check /etc/exportsfor this setting before trying.
Abusing Writable Service Files
Logrotate (logrotten)
Logrotate (logrotten)
If
logrotate runs as root (the default on most distros) and you have write access to a log file it processes, logrotten can get a payload executed as root during the next rotation. Affects logrotate versions 3.8.6, 3.11.0, 3.15.0, and 3.18.0.Hijacking an abandoned tmux session
Hijacking an abandoned tmux session
A
tmux session someone left detached (rather than closed) stays fully active, if its socket is group-readable, reattaching to it drops you straight into that user’s shell with no credentials needed at all.Quick Reference Tools
GTFOBins
Lookup table for escaping restricted shells or escalating via sudo/SUID/capabilities on a known binary.
Linux OS Enumeration
Where the leads this page acts on (sudo -l, SUID/capability findings, NFS exports) are gathered.
Linux Exploits
Version-specific kernel/software CVEs (Dirty Cow, Dirty Pipe, Pwnkit), kept separate from the misconfiguration techniques here.
Linux Privileged Groups
What docker/lxd/disk/adm group membership alone can get you.
Hacktricks Linux Privilege Escalation
Hacktricks Linux Privilege Escalation Cheatsheet

