Page cover

linuxBreaking Root: The Ultimate Linux Priv Esc Handbook



Overview

Privilege escalation on Linux is both an art and a science. For red teamers, penetration testers, and CTF players, it’s the moment of truth — the final step where a low-privileged foothold morphs into full system compromise.

This post is your definitive breakdown — a field guide combining automation, manual tactics, CVEs, and post-exploitation persistence techniques. Every command here has been field-tested in live labs, CTFs, and real-world assessments.

Automated Enumeration Tools

Let’s start with the recon phase. Before exploiting, enumerate everything — system, users, cron jobs, SUIDs, capabilities, kernel, network, and more.

LinPEAS — The King of Enumeration

LinPEAS dives through configs, sudo rules, cron jobs, kernel exploits, and more. Always run it first.

Linux Exploit Suggester

Find potential kernel exploits based on your version.

Version 2 adds even more CVE mappings:

Linux Smart Enumeration (LSE)

pspy — Process Snooping without Root

Detects running cron jobs and background tasks.

GTFONow — Automated Exploitation

Automates GTFOBins attacks (SUIDs, capabilities, sudo).


Manual Enumeration

Once you’ve automated, dive deep manually.

System Information

User Enumeration

Process and Network Recon

Environment and History

Sudo Exploitation

Check Privileges

Common Exploits via GTFOBins

LD_PRELOAD Exploit

LD_LIBRARY_PATH Hijack

CVE-2019–14287 — Sudo Bypass


SUID / SGID Exploitation

Find Binaries

Exploit Examples

Create your own SUID binary:


Capabilities

Find all:

Exploit cap_setuid:

Exploit cap_dac_override:


Cron Jobs & Timers

Enumerate

If writable:

Wildcard Injection:


NFS no_root_squash Exploit


Writable /etc/passwd

Add Root User


Kernel Exploits

Dirty COW (CVE-2016–5195)

PwnKit (CVE-2021–4034)


Docker & LXD Escalation

If user in docker group:

If LXD:


Persistence Techniques

SSH Key

Cron Backdoor

Systemd Service


Password & Credential Discovery


Clean-Up & Stealth

Use LinPEAS -s mode for stealth and clean any binaries or exploits post-use.


Resources


Final Words

Privilege escalation isn’t about memorizing commands — it’s about understanding how misconfigurations become weapons. Each vector — from a simple SUID bit to a misconfigured NFS share — represents a story of trust broken and control seized.

Last updated