Domain 2Web App AttacksCORE

Web Application Attack Surface Mapping

Systematic web application attack surface mapping covering reconnaissance workflow, enumeration tools, content discovery, prioritization, and methodology for OSCP assessments.

Domain: Domain 2: Web Application Penetration Testing•Updated: 2026-09-01
#attack-surface#reconnaissance#enumeration#mapping#oscp

Web Application Attack Surface Mapping

1. Attack Surface Categories

Before beginning reconnaissance, understand the categories of attack surface you need to map:

Category Description Examples
URLs/Endpoints All accessible URLs and API endpoints /login, /api/users, /admin
Parameters All input parameters (GET, POST, headers, cookies) id, user, file, redirect
Authentication Auth mechanisms, session management, tokens JWT, session cookies, API keys
File Upload File upload functionality and storage /upload, /avatar, /documents
APIs REST, SOAP, GraphQL endpoints /api/v1/, /graphql, .wsdl
Third-Party External services, CDNs, widgets Analytics, chat widgets, payment
Infrastructure Servers, load balancers, DNS Subdomains, ports, certificates

2. Reconnaissance Workflow

Phase Overview

Phase 1: Target Identification
    ↓
Phase 2: Subdomain Enumeration + Port Scanning + Tech Detection
    ↓
Phase 3: Content Discovery (directories, files, parameters)
    ↓
Phase 4: Parameter Identification + API Discovery
    ↓
Phase 5: Vulnerability Testing
    ↓
Phase 6: Exploitation
    ↓
Phase 7: Post-Exploitation

Phase 1: Target Identification

# Document the target
echo "Target: target.com"
echo "IP: $(dig +short target.com)"
echo "ASN: $(whois target.com | grep -i 'asn\|netname')"
echo "Organization: $(whois target.com | grep -i 'org\|descr')"

# Check DNS records
dig target.com ANY +noall +answer
dig target.com TXT +noall +answer
dig target.com MX +noall +answer
dig target.com NS +noall +answer

Phase 2: Subdomain Enumeration + Port Scanning + Tech Detection

Subdomain Enumeration

# subfinder
subfinder -d target.com -o subdomains.txt

# amass
amass enum -d target.com -o amass_subdomains.txt

# gobuster DNS mode
gobuster dns -d target.com -w /opt/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt

# ffuf for subdomains
ffuf -u http://FUZZ.target.com \
  -w /opt/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt \
  -mc 200,301,302,403 -fc 404

# crt.sh (certificate transparency)
curl -s "https://crt.sh/?q=%25.target.com&output=json" | \
  python3 -c "
import json, sys
data = json.load(sys.stdin)
names = set()
for entry in data:
    names.add(entry['name_value'])
for name in sorted(names):
    print(name)
"

# Combine all sources
cat subdomains.txt amass_subdomains.txt | sort -u > all_subdomains.txt

Port Scanning

# Quick scan of common ports
nmap -sV -p 21,22,25,53,80,110,143,443,445,993,995,1433,1521,3306,3389,5432,5900,6379,8080,8443,9200,27017 target.com

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

# Aggressive scan
nmap -A -p- target.com

# Scan all subdomains
for sub in $(cat all_subdomains.txt); do
  echo "=== $sub ==="
  nmap -sV -p 80,443,8080,8443 "$sub" 2>/dev/null | \
    grep -E "PORT.*STATE.*SERVICE"
done

# Masscan for fast port discovery
masscan -p 1-65535 target.com --rate 1000 -oL masscan_results.txt

Technology Detection

# whatweb
whatweb http://target.com
whatweb -v http://target.com

# wappalyzer (via browser extension or CLI)
wappalyzer http://target.com

# Nmap scripting engine
nmap --script http-enum,http-title,http-server-header -p 80,443 target.com

# BuiltWith API (if available)
curl -s "http://target.com/" | \
  grep -oP '(?:jquery|angular|react|vue|bootstrap|wordpress|drupal)[^"'\''<>]*'

# Check specific technologies
curl -sI http://target.com/ | grep -iE "server|powered|x-"

Phase 3: Content Discovery

Directory and File Enumeration

# Gobuster (recommended)
gobuster dir -u http://target.com \
  -w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
  -t 50 \
  -x php,asp,aspx,jsp,html,txt,conf,cfg,ini,orig,backup,bak,swp,tar,gz,zip,sql \
  -o gobuster_results.txt

# Gobuster with larger wordlist
gobuster dir -u http://target.com \
  -w /opt/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt \
  -t 50 \
  -x php,asp,aspx,jsp,html,txt \
  -o gobuster_medium.txt

# ffuf (fast alternative)
ffuf -u http://target.com/FUZZ \
  -w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
  -t 50 \
  -e .php,.asp,.aspx,.jsp,.html,.txt,.bak,.sql,.zip \
  -mc 200,201,204,301,302,307,403,500 \
  -fc 404 \
  -of json -o ffuf_results.json

# ffuf with recursive discovery
ffuf -u http://target.com/FUZZ \
  -w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
  -recursion -recursion-depth 2 \
  -t 50

# Dirsearch (Python-based)
dirsearch -u http://target.com \
  -w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
  -e php,asp,aspx,jsp,html,txt,bak,sql,zip \
  -r -R 2 \
  -o dirsearch_results.txt

Favicon and Hash Identification

# Download favicon and compute hash
curl -s http://target.com/favicon.ico -o favicon.ico
md5sum favicon.ico

# Use favicon hash to identify technology
# Common hashes:
# d79e6c2fde38e56ad425be6d8f3a5c4e -> WordPress
# 9760434f6854c9e9d5b4e55c5a4e7bb2 -> Django
# 4c8e84e7f770e5a4a3a4b0e4e5c5a4e7 -> Laravel

Phase 4: Parameter Identification + API Discovery

Parameter Discovery

# Arjun - parameter discovery
arjun -u http://target.com/page
arjun -u http://target.com/page -m POST
arjun -u http://target.com/page -oT arjun_results.txt

# ParamSpider - extract parameters from multiple sources
git clone https://github.com/techgaun/ParamSpider
python3 paramspider.py -d target.com -s 1

# Extract parameters from JavaScript files
curl -s http://target.com/app.js | \
  grep -oP '(?:get|post|fetch)\s*\(\s*["'\''`][^"'\''`]*["'\''`]' | \
  grep -oP '[?&][a-zA-Z_]+=' | \
  sed 's/[?&]//;s/=//' | \
  sort -u

# Extract parameters from HTML forms
curl -s http://target.com/ | \
  grep -oP 'name="[^"]*"' | \
  sed 's/name="//;s/"//' | \
  sort -u

API Discovery

# Check for API documentation
for path in /swagger.json /openapi.json /api-docs /swagger-ui.html /redoc /api/docs /api/v1/docs; do
  STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://target.com$path")
  if [ "$STATUS" != "404" ]; then
    echo "FOUND: http://target.com$path (Status: $STATUS)"
  fi
done

# Check for GraphQL
curl -s -X POST http://target.com/graphql \
  -H "Content-Type: application/json" \
  -d '{"query":"{__schema{types{name}}}"}'

# Check for SOAP
for path in /service.wsdl /services/service.wsdl /api/service?wsdl /soap/service.wsdl; do
  STATUS=$(curl -s -o /dev/null -w "%{http_code}" "http://target.com$path")
  if [ "$STATUS" != "404" ]; then
    echo "FOUND WSDL: http://target.com$path"
  fi
done

# API endpoint brute-force
gobuster dir -u http://target.com/api \
  -w /opt/wordlists/seclists/Discovery/Web-Content/api/api.txt \
  -t 50 \
  -x json,xml

# API version discovery
ffuf -u http://target.com/api/FUZZ/ \
  -w <(echo -e "v1\nv2\nv3\nlatest\nbeta\nalpha") \
  -mc 200,201,401,403

JavaScript Analysis

# LinkFinder - extract endpoints from JavaScript
pip install linkfinder
python3 -m LinkFinder -i http://target.com/app.js -o cli

# SecretFinder - extract secrets from JavaScript
git clone https://github.com/m4ll0k/SecretFinder
python3 SecretFinder.py -h http://target.com/app.js

# Extract all URLs from JavaScript
curl -s http://target.com/app.js | \
  grep -oP 'https?://[^"'\''<>\s]+' | \
  sort -u

# Extract API endpoints from JavaScript
curl -s http://target.com/app.js | \
  grep -oP '"/api/[^"]*"' | \
  sort -u

# Extract email addresses from JavaScript
curl -s http://target.com/app.js | \
  grep -oP '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' | \
  sort -u

Phase 5: Vulnerability Testing

Quick Vulnerability Checks

# SQLi quick test
for param in id user page search q; do
  curl -s "http://target.com/page?$param=1' OR '1'='1" -o /dev/null -w "%{http_code} $param\n"
done

# XSS quick test
for param in id user page search q; do
  curl -s "http://target.com/page?$param=<script>alert(1)</script>" -o /dev/null -w "%{http_code} $param\n"
done

# LFI quick test
for param in file page include path; do
  curl -s "http://target.com/page?$param=../../etc/passwd" -o /dev/null -w "%{http_code} $param\n"
done

# Command injection quick test
for param in ip host url cmd; do
  curl -s "http://target.com/page?$param=;id" -o /dev/null -w "%{http_code} $param\n"
done

Automated Scanning

# Nikto
nikto -h http://target.com

# Nmap vulnerability scripts
nmap --script vuln -p 80,443 target.com

# OWASP ZAP (headless)
zap-baseline.py -t http://target.com/

# Burp Suite (manual)
# 1. Configure browser proxy to Burp
# 2. Crawl the application
# 3. Send interesting requests to Repeater/Intruder
# 4. Run active scanner on in-scope URLs

Phase 6: Exploitation

# SQLi exploitation
sqlmap -u "http://target.com/page?id=1" --batch --dbs
sqlmap -u "http://target.com/page?id=1" -D db_name --tables
sqlmap -u "http://target.com/page?id=1" -D db_name -T users --dump

# XSS exploitation
# 1. Identify reflected parameter
# 2. Test with various payloads
# 3. Confirm DOM-based vs reflected
# 4. Develop exploitation payload

# Command injection exploitation
# 1. Identify injectable parameter
# 2. Test with ; id, | id, `id`, $(id)
# 3. Escalate to reverse shell
# 4. Establish persistent access

# SSRF exploitation
# 1. Identify URL parameter
# 2. Test with internal IPs
# 3. Test with cloud metadata URLs
# 4. Access internal services

Phase 7: Post-Exploitation

# Privilege escalation
# 1. Check current user
whoami
id

# 2. Check sudo permissions
sudo -l

# 3. Check for SUID binaries
find / -perm -4000 -type f 2>/dev/null

# 4. Check for writable files
find / -writable -type f 2>/dev/null | head -20

# 5. Check for cron jobs
crontab -l
cat /etc/crontab

# 6. Check for SSH keys
cat ~/.ssh/id_rsa 2>/dev/null
cat ~/.ssh/authorized_keys 2>/dev/null

# 7. Check for credentials in files
grep -r "password\|secret\|api_key" /var/www/ 2>/dev/null
grep -r "DB_PASS\|DATABASE_URL" /var/www/ 2>/dev/null

# 8. Lateral movement
# Check network interfaces
ip addr
# Check for other hosts
nmap -sV 10.10.10.0/24

3. Enumeration Tools Reference

Subdomain Enumeration

Tool Command Description
subfinder subfinder -d target.com Fast subdomain enumeration
amass amass enum -d target.com Comprehensive subdomain discovery
gobuster gobuster dns -d target.com -w wordlist.txt DNS brute-force
ffuf ffuf -u http://FUZZ.target.com -w wordlist.txt Fast subdomain fuzzing
crt.sh crt.sh/?q=%25.target.com Certificate transparency logs

Port Scanning

Tool Command Description
nmap nmap -sV -p- target.com Full port scan with version detection
masscan masscan -p 1-65535 target.com --rate 1000 Fast port scanning
rustscan rustscan -a target.com -t 5000 Rust-based fast scanner

Content Discovery

Tool Command Description
gobuster gobuster dir -u http://target.com -w wordlist.txt Directory/file enumeration
ffuf ffuf -u http://target.com/FUZZ -w wordlist.txt Fast fuzzing
dirsearch dirsearch -u http://target.com -w wordlist.txt Python directory scanner
feroxbuster feroxbuster -u http://target.com -w wordlist.txt Rust-based directory scanner

Technology Detection

Tool Command Description
whatweb whatweb http://target.com Technology identification
wappalyzer wappalyzer http://target.com Web app technology detection
nmap scripts nmap --script http-enum target.com NSE technology detection

Parameter Discovery

Tool Command Description
Arjun arjun -u http://target.com/page Hidden parameter discovery
ParamSpider paramspider.py -d target.com Parameter extraction from multiple sources
x8 x8 -u http://target.com Parameter brute-force

JavaScript Analysis

Tool Command Description
LinkFinder LinkFinder -i http://target.com/app.js Endpoint extraction from JS
SecretFinder SecretFinder.py -h http://target.com/app.js Secret extraction from JS
jsfuck Manual analysis Obfuscated JS detection

4. Content Discovery Targets

4.1 Admin Panels

/admin
/admin/login
/admin/dashboard
/administrator
/wp-admin
/wp-login.php
/phpmyadmin
/pma
/myadmin
/adminer
/manager/html
/jenkins
/gitlab
/cpanel
/webmail

4.2 API Endpoints

/api/
/api/v1/
/api/v2/
/api/docs
/api/swagger.json
/api/openapi.json
/swagger-ui.html
/redoc
/graphql
/graphiql
/playground

4.3 Backup Files

.bak
.old
.swp
.swo
.tmp
.copy
~
.orig
.sql
.zip
.tar
.tar.gz
.tar.bz2
.rar

4.4 Source Control

/.git/
/.git/config
/.git/HEAD
/.svn/
/.hg/
/.bzr/
/_darcs/

4.5 Configuration Files

/.env
/.env.local
/.env.production
/config.yml
/config.yaml
/config.json
/config.php
/web.config
/database.yml
/application.properties

4.6 Debug Pages

/debug/
/debug/var/
/debug/default
/server-status
/server-info
/trace
/actuator/
/actuator/env
/actuator/health
/actuator/info

4.7 Upload Directories

/uploads/
/files/
/images/
/assets/
/media/
/static/
/public/
/tmp/
/temp/

5. Attack Surface Prioritization

Priority Matrix

Priority Vulnerability Type Examples Action
Critical RCE, Auth Bypass Command injection, SQLi (RCE), JWT none alg Exploit immediately
High Data Exposure, Privilege Escalation IDOR, SSRF, XXE, Mass Assignment Exploit and document
Medium Information Disclosure Stack traces, .git exposure, backup files Collect and chain
Low Client-Side Issues XSS (non-exploitable), missing headers Document for report

Prioritization Workflow

1. Identify all endpoints and parameters
   ↓
2. Quick-test for critical vulnerabilities (RCE, SQLi)
   ↓
3. If critical found -> Exploit and pivot
   ↓
4. If no critical -> Test for high (IDOR, SSRF, XXE)
   ↓
5. Collect medium findings for chaining
   ↓
6. Document all findings regardless of priority

6. Complete Methodology

Step-by-Step Process

# STEP 1: Initial reconnaissance
echo "=== TARGET: target.com ==="
dig +short target.com
whois target.com | grep -E "OrgName|Address|City"

# STEP 2: Subdomain enumeration
subfinder -d target.com -o subdomains.txt
amass enum -d target.com -o amass_subs.txt
cat subdomains.txt amass_subs.txt | sort -u > all_subs.txt

# STEP 3: Port scanning
for sub in $(cat all_subs.txt); do
  nmap -sV -p 80,443,8080,8443 "$sub" -oN "nmap_$sub.txt" 2>/dev/null
done

# STEP 4: Technology detection
whatweb http://target.com > tech_detection.txt

# STEP 5: Content discovery
gobuster dir -u http://target.com \
  -w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
  -t 50 -x php,asp,aspx,jsp,html,txt,bak,sql,zip \
  -o content_discovery.txt

# STEP 6: Parameter discovery
arjun -u http://target.com -oT parameters.txt

# STEP 7: API discovery
for path in /swagger.json /openapi.json /api-docs /graphql; do
  curl -s -o /dev/null -w "%{http_code} http://target.com$path\n" \
    "http://target.com$path"
done

# STEP 8: JavaScript analysis
for js in $(curl -s http://target.com/ | grep -oP 'src="[^"]*\.js"' | sed 's/src="//;s/"//'); do
  echo "=== Analyzing: $js ==="
  curl -s "http://target.com$js" | \
    grep -oP 'https?://[^"'\''<>\s]+' | sort -u
done

# STEP 9: Quick vulnerability checks
echo "=== SQLi Test ==="
curl -s "http://target.com/page?id=1' OR '1'='1" -o /dev/null -w "%{http_code}\n"

echo "=== XSS Test ==="
curl -s "http://target.com/page?q=<script>alert(1)</script>" -o /dev/null -w "%{http_code}\n"

echo "=== LFI Test ==="
curl -s "http://target.com/page?file=../../etc/passwd" -o /dev/null -w "%{http_code}\n"

echo "=== SSRF Test ==="
curl -s "http://target.com/proxy?url=http://169.254.169.254/" -o /dev/null -w "%{http_code}\n"

# STEP 10: Exploitation
# Based on findings from steps 1-9

7. OSCP Lab Scenarios

Scenario 1: Complete Web App Recon

Setup: Multi-page web application with hidden admin panel and API.

# Full reconnaissance
subfinder -d target.com -o subs.txt
nmap -sV -p- target.com -oN nmap_full.txt
whatweb http://target.com > tech.txt

# Content discovery
gobuster dir -u http://target.com \
  -w /opt/wordlists/seclists/Discovery/Web-Content/common.txt \
  -t 50 -x php,asp,aspx,jsp,html,txt,bak,sql,zip \
  -o gobuster.txt

# Found: /admin, /api/v1/, /backup/config.bak

# Check backup
curl -s http://target.com/backup/config.bak

# Check admin
curl -s http://target.com/admin/

# Check API
curl -s http://target.com/api/v1/users

# Parameter discovery
arjun -u http://target.com/page

# Exploit findings

Scenario 2: API-First Application

Setup: REST API with Swagger documentation exposed.

# Find API documentation
curl -s http://target.com/swagger.json | python3 -m json.tool | head -100

# Extract all endpoints
curl -s http://target.com/swagger.json | \
  python3 -c "
import json, sys
data = json.load(sys.stdin)
for path, methods in data.get('paths', {}).items():
    for method in methods:
        print(f'{method.upper()} {path}')
"

# Test each endpoint for vulnerabilities
# 1. IDOR on resource endpoints
# 2. Mass assignment on POST/PUT
# 3. Auth bypass on protected endpoints
# 4. Injection on search/filter parameters

Scenario 3: Hidden Infrastructure Discovery

Setup: Web app with internal microservices accessible via SSRF.

# Discover internal services via SSRF
curl -s "http://target.com/proxy?url=http://localhost:8080/health"
curl -s "http://target.com/proxy?url=http://localhost:3000/api/status"
curl -s "http://target.com/proxy?url=http://169.254.169.254/latest/meta-data/"

# Access internal admin panel
curl -s "http://target.com/proxy?url=http://localhost:9090/admin"

# Read internal configuration
curl -s "http://target.com/proxy?url=http://localhost:8080/config"

# Exploit internal service
curl -s "http://target.com/proxy?url=http://localhost:6379/ INFO"

8. Key Takeaways

For OSCP Exams

  1. Start broad, then narrow — Enumerate everything first, then focus on promising targets.
  2. Automate what you can — Use subfinder, gobuster, ffuf, and arjun for efficient enumeration.
  3. Document everything — Keep notes on every finding, even if it seems insignificant.
  4. Follow the chain — Information disclosure often leads to more severe vulnerabilities.
  5. Check JavaScript files — They often contain hidden endpoints, API keys, and logic flaws.
  6. Test every parameter — Each parameter is a potential injection point.
  7. API documentation is gold — Swagger/OpenAPI reveals the entire attack surface.
  8. Prioritize critical findings — RCE and auth bypass before XSS and info disclosure.
  9. Time management matters — Don’t spend hours on one vulnerability; move on and come back.
  10. Burp Suite is essential — Use it for proxying, repeating, intruding, and scanning.

Essential Commands Quick Reference

# Subdomains
subfinder -d target.com -o subs.txt

# Ports
nmap -sV -p- target.com

# Directories
gobuster dir -u http://target.com -w common.txt -t 50

# Parameters
arjun -u http://target.com/page

# Technology
whatweb http://target.com

# SQLi
sqlmap -u "http://target.com/page?id=1" --batch --dbs

# XSS
dalfox url "http://target.com/search?q=test"

# Full recon one-liner
subfinder -d target.com | httpx | cat

9. Summary

Web application attack surface mapping is the foundation of successful OSCP assessments. A systematic approach to reconnaissance — from subdomain enumeration to parameter discovery — ensures no attack surface is overlooked. The key tools (subfinder, amass, gobuster, ffuf, arjun, whatweb) automate much of the process, but manual analysis and creative thinking remain essential.

The most successful OSCP candidates follow a disciplined methodology: enumerate broadly, identify promising targets, test systematically, exploit efficiently, and document thoroughly. Remember that attack surface mapping is not a one-time activity — as you discover new endpoints and parameters during exploitation, continuously update your map and test new findings. The most valuable discoveries often come from following chains of information disclosure across multiple layers of the application.