This article is a detailed technical guide to Linux privilege escalation covering four primary attack vectors: SUID binary exploitation, sudo misconfiguration, cron job abuse, and PATH hijacking. The guide establishes that initial low-privilege shell access is insufficient—the real penetration testing objective is achieving root-level access by identifying and exploiting privilege escalation weaknesses that exist on most compromised Linux systems. The material matters because it bridges the gap between initial compromise and full system control, which is essential for establishing persistent access and demonstrating complete system compromise in penetration testing engagements.
- Four Primary Escalation VectorsThe article identifies SUID binaries, misconfigured sudo rules, writable cron job scripts, and PATH hijacking as the most common Linux privilege escalation techniques. SUID binaries run as their owner (typically root) regardless of executor and can be exploited through interpreters like Python, Perl, and editors like vim. Sudo misconfiguration allows restricted binaries to be run as root without password, and common editors like nano and vim can spawn shells via built-in command execution features despite file path restrictions in sudo rules.
- LinPEAS Enumeration MethodologyThe article emphasizes running LinPEAS first to automatically scan hundreds of escalation vectors and colour-code findings by criticality: RED indicates critical exploitable flaws while YELLOW flags interesting but less direct paths. Manual checks complement automated enumeration through commands like find / -perm -4000 for SUID binaries, sudo -l for escalation rules, and inspection of /etc/crontab for scheduled jobs. LinPEAS output should be saved and reviewed systematically before attempting exploitation.
- GTFOBins as Exploitation ReferenceThe article repeatedly directs readers to GTFOBins (gtfobins.github.io) as the essential curated reference documenting exploitable techniques for every Unix binary that can be abused for SUID escalation, sudo escalation, file operations, and shell spawning. Each identified SUID binary or sudo-allowed command must be checked against GTFOBins for exact exploitation syntax rather than attempting manual exploitation without reference.
- SUID Binary Exploitation TechniquesExploitable SUID binaries include Python (python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'), find (find . -exec /bin/sh -p ; -quit), vim (vim -c ':!/bin/bash'), and nmap in versions with interactive mode (nmap --interactive followed by !sh). The article's training exercise identifies SUID Python as the fastest vector providing immediate interactive root shell, while noting that SUID nmap v5.21 is also effective through interactive mode exploitation.
- Sudo Misconfiguration and In-Binary ExecutionThe article demonstrates that sudo rules restricting specific files do not prevent shell spawning through built-in editor features—for example, sudo nano /var/log/app.log restricts which file opens but nano's command execution feature (Ctrl+R followed by Ctrl+X) can still spawn root shells. Similar techniques apply to vim, less, and python when allowed through sudo rules, documented in GTFOBins' sudo section for each binary.
- Cron Job and PATH Hijacking Attack ChainThe article shows that world-writable cron scripts running as root can be replaced with reverse shell payloads, with exploitation delayed until the next scheduled execution (up to 5 minutes in the given example). PATH hijacking occurs when root-run scripts use relative command paths (such as ping without full path) and the compromised user can write to a directory in the root's PATH, allowing malicious binary execution when the root script runs—the article's real-world example describes creating a malicious 'df' binary in /usr/local/bin to hijack a root-owned script running at 02:00.
- Evidence Documentation and ReportingThe article emphasizes that penetration testing escalation findings require documented proof, not just achieving root access—screenshots showing uid=0, access to /etc/shadow, and full command chains from initial shell to root confirmation are required for credible reporting. Each finding should reference its MITRE ATT&CK technique ID (T1548.001 for SUID, T1053.003 for cron, T1548.003 for sudo, T1574.007 for PATH hijacking) to enable clients to map findings to threat intelligence and detection capabilities.
- Practical Lab Workflow on MetasploitableThe article provides a complete workflow: initial low-privilege SSH access → manual verification checks (whoami, sudo -l, SUID enumeration) → LinPEAS execution with output saved → RED finding extraction and GTFOBins consultation → exploitation (nmap --interactive → !sh on Metasploitable) → proof of root access through id and shadow file inspection. This mirrors real penetration testing procedures and demonstrates that exploiting obvious SUID binaries like nmap --interactive provides immediate root access on vulnerable systems.
Bottom line: Linux privilege escalation requires systematic enumeration using LinPEAS to identify vectors, verification against the GTFOBins reference for exploitation syntax, and exploitation prioritization based on speed and reliability—SUID Python offers immediate root shells while cron jobs guarantee root but require waiting. Documentation with MITRE ATT&CK technique IDs and proof of uid=0 access transforms an escalation from a technical achievement into a credible penetration testing finding.
Part of the 100-Day Ethical Hacking Course
🎯 What You’ll Master in Day 31
⏱️ 50 min read · 3 exercises
📋 Linux Privilege Escalation 2026
In Day 30 you established persistence mechanisms on Windows. Day 31 returns to a critical earlier phase: escalating from initial access to full system compromise on Linux. You cannot establish persistent access with real impact until you have root-level privileges — persistence and escalation always work together in the 100-Day Ethical Hacking Course.
Enumeration First — LinPEAS and Manual Checks
⏱️ Time: 8 minutes · No tools required
these findings (colour-coded: RED=critical, YELLOW=interesting):
[RED] SUID files found:
/usr/bin/python3.9 (owned by root)
/usr/bin/find
/usr/bin/nmap (version 5.21)
[RED] Sudo rules (sudo -l output):
(root) NOPASSWD: /usr/bin/vim /var/www/html/config.php
[YELLOW] Cron jobs (running as root):
*/5 * * * * /opt/backup/run_backup.sh
File permissions: -rwxrwxrwx (world-writable!)
[YELLOW] PATH-dependent script (owned by root, runs at login):
/usr/local/bin/system-check
Content: “ping -c 1 localhost” (uses relative path for ping)
/usr/local/bin is in your PATH and is world-writable
For each finding:
1. Which escalation technique applies?
2. What is the exact command or payload?
3. How quickly would this give you root?
4. Which finding would you exploit FIRST? Why?
📸 Share your prioritised exploitation plan in your notes.
SUID Binary Exploitation
Sudo Misconfiguration Exploitation
Cron Job Abuse
⏱️ Time: 25 minutes · Free TryHackMe account
Step 2: Search: “Linux Privilege Escalation” room
Open: “Linux PrivEsc” or “Linux Privilege Escalation”
Step 3: Deploy machine and connect via VPN or AttackBox
Step 4: The room covers each vector — complete:
a) SUID/SGID escalation task
→ find the SUID binary, check GTFOBins, get root
b) Sudo escalation task
→ sudo -l, exploit the listed command, get root
c) Cron job task
→ find the writable cron script, replace with payload
Step 5: For each successful escalation, note:
– The exact binary/rule/script that was vulnerable
– The exploit command used
– The MITRE ATT&CK technique ID
(T1548.001 = SUID, T1053.003 = Cron, T1548.003 = Sudo)
Step 6: Screenshot each “root shell obtained” moment
with whoami output visible
📸 Share root shell screenshots from all three escalation techniques in your notes.
PATH Hijacking
⏱️ Time: 15 minutes · Kali · Metasploitable or TryHackMe
📸 Screenshot the full chain from initial shell to root whoami in your notes
🧠 QUICK CHECK — Day 31
📋 Linux Privilege Escalation Quick Reference — Day 31
🏆 Mark Day 31 as Complete
Linux privilege escalation completes the post-exploitation picture on Linux targets. SUID, sudo, cron, and PATH hijacking cover the vast majority of real-world escalation vectors. Day 32 applies the equivalent techniques to Windows — unquoted service paths, weak service permissions, and token impersonation.
❓ Frequently Asked Questions
What is Linux privilege escalation?
What is a SUID binary and how is it exploited?
What is GTFOBins?
What is LinPEAS?
What comes after Day 31?
Day 30: Post-Exploitation Persistence 2026
Day 32: Windows Privilege Escalation 2026
📚 Further Reading
- Post-Exploitation Persistence 2026 — Day 30 covers Windows persistence — complements Day 31 by covering the post-escalation phase: once you have root, persistence ensures you keep it.
- Privilege Escalation Hub — Complete SecurityElites privilege escalation category covering Linux SUID/sudo/cron, Windows service exploits, and cross-platform escalation techniques.
- 100-Day Ethical Hacking Course — The complete course hub — Day 31 privilege escalation is the start of the post-exploitation specialisation phase covering Days 31-45.
- GTFOBins — The essential privilege escalation reference — every Unix binary that can be exploited for SUID abuse, sudo escalation, file read/write, and shell spawning with exact command examples.
- LinPEAS — PEASS-ng GitHub — The LinPEAS automated privilege escalation enumeration script — download link, full documentation, and the complete list of checks the script performs with explanations of each finding category.

