Linux Privilege Escalation
Overview
Linux privilege escalation elevates access from a low-privileged user to root. After gaining initial access (web shell, SSH, reverse shell), escalation targets misconfigurations in file permissions, sudo rules, scheduled tasks, services, and kernel vulnerabilities. The methodology is systematic: enumerate, identify vectors, exploit, and verify elevated access.
Topics in This Section
- SUID/SGID Exploitation
- Sudo Abuse
- Kernel Exploits
- Cron Job Exploitation
- Linux Capabilities
- Container Breakout
General Approach
- Run automated enumeration — linpeas.sh to identify all potential vectors at once
- Check sudo permissions —
sudo -lis the single highest-value command - Check SUID/SGID binaries — find non-standard SUID binaries
- Check capabilities —
getcap -r /for binaries with elevated capabilities - Check cron jobs — writable scripts, wildcard injection, PATH manipulation
- Check writable files — service configs, scripts executed by root, PATH directories
- Check kernel version — last resort, kernel exploits can crash the system
- Check container context — if in Docker/LXC, look for breakout paths