OWASP WSTG: Part 2 - Information Gathering
WSTG v4.2 section 4.1 explained: search engine reconnaissance, web server and framework fingerprinting, metafiles, virtual hosts, page content leaks, entry points and mapping the application, with commands and fixes for each test.
Every successful web test starts the same way: understand the target before attacking it. Information gathering (WSTG section 4.1, IDs WSTG-INFO-*) is the passive and lightly active phase where you learn what the application is built on, what it exposes and where its inputs are.
Most findings here are not vulnerabilities by themselves. A server banner or a comment in the HTML is rarely critical. But they decide where you look next: a version number points to a known CVE, a forgotten virtual host points to an unpatched admin panel, and the map of entry points becomes the to-do list for every later category.
Source: WSTG v4.2 §4.1 Information Gathering (CC BY-SA 4.0), explained and expanded. Only test systems you are authorised to test.
Key Takeaways
- Recon decides the quality of the whole test. Endpoints you never find are endpoints you never test.
- Fingerprint everything: web server, framework, CMS, libraries and versions. Each one maps to known vulnerabilities.
- Look where developers forget:
robots.txt, sitemaps, HTML comments, JavaScript bundles and source maps. - One IP can host many applications. Enumerate virtual hosts, non-standard ports and paths.
- Write the map down. Entry points, workflows and architecture feed every later category.
The Information Gathering Workflow
flowchart TD
A["Passive OSINT<br/>search engines, archives (INFO-01)"] --> B["Fingerprint the server<br/>(INFO-02)"]
B --> C["Read metafiles<br/>robots.txt, sitemap, security.txt (INFO-03)"]
C --> D["Enumerate applications<br/>paths, ports, virtual hosts (INFO-04)"]
D --> E["Review page content<br/>comments, JS, source maps (INFO-05)"]
E --> F["Identify entry points<br/>parameters, headers, cookies (INFO-06)"]
F --> G["Map execution paths<br/>workflows, spidering (INFO-07)"]
G --> H["Fingerprint framework & app<br/>(INFO-08 / INFO-09)"]
H --> I["Map the architecture<br/>WAF, CDN, load balancers, DB (INFO-10)"]
I --> J["Attack surface map<br/>input for every later category"]
WSTG-INFO-01: Search Engine Discovery and Reconnaissance
What it checks: whether sensitive information about the application or organisation is exposed through search engines, caches, archives and third-party sites, without touching the target.
Why it matters: search engines index things that were never meant to be public: login pages, staging environments, error messages with stack traces, backup files, internal documents, API keys in public repositories.
How to test: combine search operators (“Google dorking”):
1
2
3
4
5
6
7
8
site:example.com # everything indexed for the domain
site:example.com -www # subdomains other than www
site:example.com inurl:admin | inurl:login
site:example.com ext:sql | ext:bak | ext:log | ext:env
site:example.com intitle:"index of" # open directory listings
site:example.com "error" | "warning" | "stack trace"
site:pastebin.com "example.com"
site:github.com "example.com" password | api_key | secret
Also check:
- Cached and archived copies: the Wayback Machine (
web.archive.org) often holds old endpoints and files that were removed. - Other engines: Bing, DuckDuckGo, Shodan (services and banners), Censys (certificates and hosts).
- Code and paste sites: GitHub, GitLab, Pastebin.
1
2
3
# Collect historical URLs for the domain from archives
waybackurls example.com | sort -u > wayback.txt
grep -Ei '\.(bak|old|sql|zip|env|config)$' wayback.txt
What a finding looks like: an indexed /backup/db_2019.sql, a public .env file in a GitHub repository, or a staging subdomain that shows stack traces.
Fix: review what is public before publishing it, remove sensitive content and request removal from caches (Google Search Console), keep secrets out of repositories (use secret scanning), and protect non-production environments with authentication.
WSTG-INFO-02: Fingerprint Web Server
What it checks: the type and version of the web server (Apache, nginx, IIS, LiteSpeed, etc.).
Why it matters: a precise version maps directly to published vulnerabilities and default behaviour.
How to test:
- Banner grabbing: read the
Serverheader and other headers.
1
2
curl -sI https://example.com
nc example.com 80 <<< $'HEAD / HTTP/1.0\r\n\r\n'
1
2
3
HTTP/1.1 200 OK
Server: Apache/2.4.41 (Unix)
X-Powered-By: PHP/7.2.24
- Malformed requests: servers answer invalid requests differently, which helps even when the banner is hidden or faked.
1
2
printf 'GET / HTTP/3.0\r\n\r\n' | nc example.com 80
printf 'GET /%%%% HTTP/1.1\r\nHost: example.com\r\n\r\n' | nc example.com 80
Compare the status code, the error page, header order and capitalisation (Apache, nginx and IIS each have characteristic error pages).
- Automated tools:
1
2
3
whatweb -a 3 https://example.com
nmap -sV -p 80,443 --script http-headers,http-server-header example.com
nikto -h https://example.com
Fix: remove or genericise version banners (ServerTokens Prod and ServerSignature Off in Apache, server_tokens off; in nginx, removeServerHeader in IIS), and above all keep the server patched. Hiding the version only slows attackers down.
WSTG-INFO-03: Review Webserver Metafiles
What it checks: files that describe the site to crawlers and humans, and may reveal hidden paths.
How to test: request each file and read it.
1
2
3
for f in robots.txt sitemap.xml sitemap_index.xml .well-known/security.txt humans.txt crossdomain.xml; do
echo "== $f"; curl -s "https://example.com/$f" | head -20
done
robots.txt:Disallowlines tell crawlers what not to index, which is often exactly what an attacker wants:/admin/,/backup/,/internal-api/. It is a list of interesting paths, not a security control.sitemap.xml: the full list of pages the owners want indexed, useful for mapping.security.txt(RFC 9116) in/.well-known/: contact details and the disclosure policy. Its absence is worth noting.- HTML
<meta>tags:robots,generator(often reveals the CMS and version), and others. - Other
/.well-known/files:openid-configuration,assetlinks.json,apple-app-site-associationreveal identity providers and linked mobile apps.
What a finding looks like: Disallow: /old-admin/ leading to an unauthenticated legacy admin panel.
Fix: never rely on robots.txt to protect anything; protect sensitive paths with authentication. Remove generator tags that disclose versions. Publish a security.txt.
WSTG-INFO-04: Enumerate Applications on the Webserver
What it checks: every application hosted on the target, not only the obvious one at https://example.com/.
Why it matters: forgotten applications are rarely patched. The guide describes three ways they hide:
- Non-standard URLs:
https://example.com/webmail/,/jenkins/,/phpmyadmin/. - Non-standard ports: an admin interface on
:8443or:10000. - Virtual hosts: many sites on the same IP, selected by the
Hostheader.
How to test:
1
2
3
4
5
6
7
8
9
10
11
12
# 1. Paths: brute-force directories and known applications
ffuf -u https://example.com/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt -mc 200,204,301,302,401,403
# 2. Ports: scan all TCP ports and identify web services
nmap -p- -sV --open example.com
nmap -sV -p 8000-9000 --script http-title example.com
# 3. Virtual hosts: DNS records, certificates, then Host-header brute forcing
host -t ns example.com
dig axfr example.com @ns1.example.com # zone transfer (usually refused)
curl -s "https://crt.sh/?q=%25.example.com&output=json" | jq -r '.[].name_value' | sort -u
ffuf -u https://example.com -H "Host: FUZZ.example.com" -w subdomains.txt -fs 1234
Reverse-IP services and certificate transparency logs (crt.sh) are often the fastest way to find other hostnames on the same server.
Fix: keep an inventory of everything exposed, remove what is not needed, restrict admin interfaces to a VPN or allow-list, and make sure the default virtual host does not serve an internal application.
WSTG-INFO-05: Review Webpage Content for Information Leakage
What it checks: comments, metadata, JavaScript and debug files that leak internal information.
How to test:
- HTML comments and metadata: view the source of every page.
1
2
<!-- TODO: remove before go-live. DB admin password for testing: f@keP@ss -->
<!-- Query: SELECT * FROM users WHERE role='admin' -->
- JavaScript files: modern single-page apps ship their whole client logic, often including API routes, feature flags and keys.
1
2
3
4
# Collect JS files and search them for endpoints and secrets
curl -s https://example.com | grep -oE 'src="[^"]+\.js"' | cut -d'"' -f2
grep -Eo '(api|v[0-9])/[A-Za-z0-9_/.-]+' main.js | sort -u
grep -Ei 'api[_-]?key|secret|token|password|aws_access' main.js
- Source maps: if
main.js.mapis reachable, the original, unminified source code (with comments) can be rebuilt.
1
curl -sI https://example.com/static/js/main.js.map
What a finding looks like: a Google Maps or Firebase API key with no restrictions, an internal hostname, or a full source map that exposes the admin routes.
Fix: strip comments in production builds, do not deploy source maps publicly, restrict third-party API keys (HTTP referrer, IP, API scope), and never ship secrets to the browser: anything in client code is public.
WSTG-INFO-06: Identify Application Entry Points
What it checks: every place where user-controlled data enters the application. These are the targets of every injection, authentication and authorization test that follows.
How to test: browse the whole application through Burp or ZAP and record, for each request:
- GET parameters in the URL and POST parameters in the body (form, JSON, XML, multipart).
- Hidden form fields and parameters that look like they control logic:
debug=true,role=user,price=62.50,isAdmin=false. - Cookies, including custom ones, and how they change.
- Custom headers the application reads:
X-Forwarded-For,X-Api-Version,Authorization. - In responses:
Set-Cookie, redirects (3xxwithLocation), error codes (4xx/5xx) and their messages.
1
2
3
4
5
POST /shop/checkout HTTP/1.1
Host: example.com
Cookie: SESSIONID=Z29vZCBqb2I...; trustedIP=10.0.0.5
item=z101a&qty=1&price=62.50&debug=true
Every value there is an entry point. The price and debug parameters are especially interesting: they suggest the server trusts the client for things it should decide itself.
Gray-box option: OWASP Attack Surface Detector reads source code and lists all endpoints and their parameters.
Fix: this is a mapping step, but it often reveals design problems: never trust client-supplied prices, roles or debug flags, and remove debug parameters from production.
WSTG-INFO-07: Map Execution Paths Through the Application
What it checks: the main workflows of the application (sign-up, login, checkout, password reset, admin actions) and the paths through them.
How to test:
- Spider automatically (Burp crawler, ZAP spider and AJAX spider for JavaScript-heavy apps) to find linked content.
- Walk the workflows manually, as each role, and note the order of requests and the state each step depends on.
- Track coverage in a spreadsheet or a mind map: every path, which roles can reach it, and whether you tested it.
The guide suggests three coverage strategies: path (every route through the app), data flow (how each input travels through the system) and race (multiple instances acting on the same data at once).
Fix: none by itself; this produces the map used by later tests, especially Business Logic (Part 11).
WSTG-INFO-08: Fingerprint Web Application Framework
What it checks: the frameworks and components behind the application (Laravel, Django, Spring, ASP.NET, Express, React, WordPress, Drupal, etc.) and their versions.
How to test: look at several independent signals:
| Signal | Examples |
|---|---|
| HTTP headers | X-Powered-By: Express, X-AspNet-Version: 4.0.30319, X-Generator: Drupal 9 |
| Cookies | laravel_session, JSESSIONID (Java), ASP.NET_SessionId, PHPSESSID, csrftoken (Django), wp-settings-* (WordPress) |
| HTML source | <meta name="generator">, framework-specific markup, script paths like /wp-content/ or /_next/ |
| Specific files | /wp-login.php, /administrator/ (Joomla), /CHANGELOG.txt, /readme.html |
| File extensions | .php, .aspx, .jsp, .do |
| Error messages | default 404/500 pages that name the framework |
1
2
3
whatweb https://example.com
wpscan --url https://example.com --enumerate vp,vt,u # WordPress
# Browser extension: Wappalyzer
WSTG-INFO-09 (Fingerprint Web Application) was merged into INFO-08 in v4.2: identifying the application and identifying its framework are now one test.
Fix: removing headers and renaming cookies is security through obscurity; it only slows down unskilled attackers. The real fix is patching: keep frameworks, plugins and themes up to date and remove unused components.
WSTG-INFO-10: Map Application Architecture
What it checks: the infrastructure between you and the application: CDN, WAF, load balancers, reverse proxies, application servers, databases and third-party services.
How to test:
- DNS and IP ownership: does the domain resolve to Cloudflare, Akamai, AWS CloudFront? Then there is a CDN/WAF in front.
- Headers and cookies:
cf-ray,x-amz-cf-id,x-cache,Via,X-Varnish, load-balancer cookies such asAWSALBorBIGipServer. - WAF detection: send an obviously malicious payload and see whether a block page appears.
1
2
wafw00f https://example.com
curl -sI "https://example.com/?q=<script>alert(1)</script>" | head -5
- Behaviour: different response times or headers on repeated requests can reveal several back-end servers behind a load balancer.
- Third parties: payment providers, analytics, authentication (OAuth/SSO), cloud storage buckets.
Draw the result as a simple diagram. It tells you, for example, that a WAF may block your payloads (so test from an allow-listed IP with permission), or that the origin server might be reachable directly by IP, bypassing the WAF.
Fix: make sure the origin only accepts traffic from the CDN/WAF, remove internal details from headers, and document the architecture so that every component is in the security scope.
Worked Example: Turning Recon into an Entry Point
Recon rarely gives you the vulnerability directly; it gives you the thread to pull. Here is the full chain for a single finding, a source map leak (WSTG-INFO-05) that reveals a hidden admin API.
1. The leak — a production build still ships its source map:
1
2
3
$ curl -sI https://shop.example.com/static/js/main.4f2a.js.map
HTTP/2 200
content-type: application/json
2. Rebuild the original source from the minified bundle + map:
1
2
3
4
5
6
7
8
9
10
11
12
# unpack a .js.map into the original tree of source files
npx source-map-explorer main.4f2a.js main.4f2a.js.map # visualise
# or extract the original sources programmatically:
python3 - <<'PY'
import json, os, urllib.request
m = json.load(urllib.request.urlopen("https://shop.example.com/static/js/main.4f2a.js.map"))
for path, src in zip(m["sources"], m["sourcesContent"]):
out = "recovered/" + path.replace("../", "").lstrip("/")
os.makedirs(os.path.dirname(out), exist_ok=True)
open(out, "w").write(src or "")
print(f"recovered {len(m['sources'])} source files")
PY
3. Mine the recovered source for routes and secrets the UI never shows:
1
2
3
grep -rEn "/api/(admin|internal|v[0-9])" recovered/ | sort -u
# recovered/src/services/admin.ts:12: const ADMIN = "/api/internal/admin/users";
grep -rEin "api[_-]?key|secret|token|firebase|password" recovered/
That single admin.ts file hands you an endpoint to take into Part 6 (Authorization) and any key into Part 10 (crypto). This is why recon findings, individually “low”, compound.
Real-world case — Uber source map leak (2016/2019). Researchers repeatedly recovered internal JavaScript and endpoint maps from Uber and other large apps because production builds shipped
.mapfiles. Attackers do not need to guess your API when your bundle describes it for them.
Hands-on Practice
Reproduce these tests safely before using them on a real engagement:
- OWASP Juice Shop — the “Confidential Document”, “Error Handling” and “Access a developer’s forgotten file” challenges exercise metafiles, directory listing and leaked files.
- PortSwigger Web Security Academy — the Information disclosure labs (free) cover source maps, debug pages, backup files and version disclosure.
- Your own lab — stand up DVWA/WebGoat behind nginx and practise
whatweb,ffufdirectory brute-forcing, andcrt.shsubdomain discovery against them.
Checklist: Information Gathering
| ID | Test | Main tools |
|---|---|---|
| WSTG-INFO-01 | Search engine discovery and reconnaissance | Google dorks, Wayback Machine, waybackurls, Shodan, GitHub search |
| WSTG-INFO-02 | Fingerprint web server | curl, netcat, whatweb, nmap, nikto |
| WSTG-INFO-03 | Review webserver metafiles | curl (robots.txt, sitemap.xml, security.txt) |
| WSTG-INFO-04 | Enumerate applications on the webserver | ffuf, gobuster, nmap, crt.sh, dig |
| WSTG-INFO-05 | Review webpage content for leakage | Browser view-source, grep, source maps |
| WSTG-INFO-06 | Identify application entry points | Burp Suite, OWASP ZAP, Attack Surface Detector |
| WSTG-INFO-07 | Map execution paths | Burp crawler, ZAP spider, mind maps |
| WSTG-INFO-08 | Fingerprint web application framework (incl. INFO-09) | whatweb, Wappalyzer, wpscan |
| WSTG-INFO-10 | Map application architecture | wafw00f, DNS lookups, headers |
Next: Part 3 - Configuration and Deployment Management, where the recon results turn into tests of how the platform is configured.
References
- WSTG-INFO-01 Search Engine Discovery
- WSTG-INFO-02 Fingerprint Web Server
- WSTG-INFO-03 Review Webserver Metafiles
- WSTG-INFO-04 Enumerate Applications on Webserver
- WSTG-INFO-05 Review Webpage Content
- WSTG-INFO-06 Identify Application Entry Points
- WSTG-INFO-07 Map Execution Paths
- WSTG-INFO-08 Fingerprint Web Application Framework
- WSTG-INFO-10 Map Application Architecture
- RFC 9116: security.txt
- SecLists wordlists
Further reading
- The Web Application Hacker’s Handbook (Stuttard & Pinto) — ch. 4, “Mapping the Application”, is the classic treatment of recon.
- Real-World Bug Hunting (Peter Yaworski) — how disclosed reports start from exactly this kind of recon.
- PortSwigger Web Security Academy — free, hands-on, maps closely to WSTG.
- OWASP Amass and Project Discovery tools (subfinder, httpx, nuclei) — modern recon tooling.
- HackerOne & Bugcrowd disclosed reports — real recon-to-finding chains.
Comments
Questions, corrections or another approach? Comment with your GitHub account.