Skip to main content
Everything here assumes the leads already gathered on the Linux OS Enumeration page, a sudo rule, a SUID binary, a writable file, a capability. This page is what to actually do with each one. Kernel-version-specific exploits (Dirty Cow, Dirty Pipe, Pwnkit, and similar) have their own page, see Linux Exploits, and privileged group membership (docker, lxd, disk, adm) has its own page too, see Linux Privileged Groups. This page covers the misconfigurations in between: sudo rules, file permissions, capabilities, and library loading.

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 what sudo -l showed during enumeration. Three separate things to check for:
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 (find, vim, less, python3, tar…) has a known escape listed there. A few of the most common language interpreters, directly:
If the allowed command is a text editor with no further restriction, edit /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

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.
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.
If something like 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.
This is a destructive change to a system file, fine in a lab, worth a second thought on anything you need to hand back in a clean state afterward.

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 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 with no_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

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.
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
Several techniques here (writable /etc/passwd, logrotten, LD_PRELOAD against a live sudo rule) modify system state or spawn a root shell directly. Confirm scope, and know how to undo a change before making it on anything beyond a disposable lab box.