Page cover

linuxBreaking Root: The Ultimate Linux Priv Esc Handbook | Cyber Codex

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 a 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

Copy

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

Linux Exploit Suggester

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).

Copy


Manual Enumeration

Once you’ve automated, dive deep manually.

System Information

Copy

User Enumeration

Copy

Process and Network Recon

Copy

Environment and History

Copy

Sudo Exploitation

Check Privileges

Copy

Common Exploits via GTFOBins

Copy

LD_PRELOAD Exploit

Copy

LD_LIBRARY_PATH Hijack

Copy

CVE-2019-14287 — Sudo Bypass

Copy


SUID / SGID Exploitation

Find Binaries

Copy

Exploit Examples

Copy

Create your own SUID binary:

Copy


Capabilities

Find all:

Copy

Exploit cap_setuid:

Copy

Exploit cap_dac_override:

Copy


Cron Jobs & Timers

Enumerate

Copy

If writable:

Copy

Wildcard Injection:

Copy


NFS no_root_squash Exploit

Copy


Writable /etc/passwd

Add Root User

Copy


Kernel Exploits

Dirty COW (CVE-2016-5195)

Copy

PwnKit (CVE-2021-4034)

Copy


Docker & LXD Escalation

If user in docker group:

Copy

If LXD:

Copy


Persistence Techniques

SSH Key

Copy

Cron Backdoor

Copy

Systemd Service

Copy


Password & Credential Discovery

Copy


Clean-Up & Stealth

Copy

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

Resources

  • https://gtfobins.github.io/

  • https://book.hacktricks.xyz/linux-hardening/privilege-escalation

  • https://github.com/swisskyrepo/PayloadsAllTheThings

  • https://swisskyrepo.github.io/InternalAllTheThings/

  • https://www.hackingarticles.in/privilege-escalation-cheatsheet-vulnhub/

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

Was this helpful?