API Discovery
API discovery maps every endpoint an application exposes, including undocumented, legacy, staging and internal ones. It is the first phase of an API test and the root of OWASP API9:2023 (Improper Inventory Management): you cannot secure, and attackers routinely find, the shadow, orphaned and deprecated APIs that never make it into the inventory.
How it works
Three kinds of hidden surface matter (Wiz):
- Shadow APIs: undocumented endpoints created for a feature or debugging and never removed from production.
- Orphaned APIs: once documented, now disconnected from their source of truth and unmaintained.
- Deprecated/zombie APIs: old versions left reachable past their grace period, missing the fixes applied to the current version.
No single method finds everything, so testers layer spec parsing, client-side analysis, traffic capture and brute force. The deployed API also drifts from its spec, so live traffic and fuzzing catch what the spec misses.
Techniques / tooling
Passive / OSINT
- Wayback and archives:
gau --subs target.com | grep -E "\.json|/api/|/v[0-9]/|/graphql|/swagger",waymore. - Google dorks:
site:target.com inurl:"/api/",intitle:"Swagger UI",ext:json "swagger". - Certificate transparency (
crt.sh) and subdomain enum (subfinder | httpx) filtered forapi|gateway|backend|internal|dev|staging|uat|sandbox. - Mobile apps: decompile the APK (
apktool d app.apk, jadx) and grep smali/resources forhttps://and/api/. The vAPI api3 endpoint only existed in the shipped APK.
Spec and documentation discovery
- Common paths:
/openapi.json,/swagger.json,/v2/api-docs,/v3/api-docs,/swagger-ui.html,/api-docs,/redoc,/swagger-resources. - Tool wordlists beat generic ones. Swagger Jacker (sj) uses a dynamically generated wordlist (better coverage than SecLists
swagger.txt), parses the OpenAPI Info/Security objects for hardcoded dev keys and auth schemes, hits every documented route (flagging 200 vs 401/403), and emits curl commands for manual testing. - Autoswagger (Intruder) does multi-phase discovery (direct spec, Swagger UI scraping, common-spec brute force), tests endpoints concurrently, and flags PII/secrets via Presidio and regexes.
-riskadds non-GET methods;-bfuzzes parameter values. - APIDetector scans subdomain lists over HTTP+HTTPS for exposed Swagger endpoints and flags XSS-vulnerable Swagger UI versions.
- Dana Epp’s Burp extension recursively brute-forces API-doc artifacts on every new subdirectory Burp crawls (prefix dirs × doc endpoints × UI endpoints), because docs can be nested or in a separate vhost.
Reconstruct the spec when there is none
- Proxy the client and capture traffic, then
mitmproxy2swagger -i flows ...to generate an OpenAPI spec, or use Postman’s Capture requests feature to build a collection. crAPI is the usual practice target.
Active brute force
- Endpoint fuzzing with API-aware wordlists:
ffuf -u https://api.target.com/FUZZ -w common-api-endpoints.txt. The api_wordlist repo splits verbs (actions.txt) and nouns (objects.txt) for Intruder cluster-bomb fuzzing ofverb+objectfunction names, plusapi_seen_in_wild.txt. - Kiterunner (Assetnote): context-aware content discovery that brute-forces API routes using route+method+parameter shapes, not just directory names, which suits modern frameworks.
- Parameter discovery:
arjun,paramspider.
Version downgrade. Always try older versions of a found route. vAPI api9: /v2/user/login was rate-limited, /v1/user/login was not. Deprecated versions routinely miss the current version’s authz and throttling fixes.
gRPC-Web clients. The generated gRPC-Web JavaScript embeds service routes and message field definitions. The gRPC-Web Coder BApp (“Analyze gRPC-Web Endpoints”) extracts them, which reveals methods no part of the UI calls, and exports JSON, CSV, a reconstructed .proto for protoc/grpcurl, or type definitions. Field names are not on the wire, so without them payloads decode only by field number (BApp Store).
GraphQL with introspection off. “Did you mean” validation errors leak root fields, mutations and argument names; harvest them recursively or with Clairvoyance to rebuild the schema. See GraphQL Introspection (arok.win).
Notable cases
- Moltbook (Wiz). Supabase project URL and public key hardcoded in the frontend JS; querying nonexistent table names through PostgREST leaked the real schema; GraphQL introspection surfaced an undocumented
observerstable with ~30,000 emails. The key was meant to be public — the gap was missing RLS. See Backend-as-a-Service Data Exposure. - T-Mobile
promotool. An internal care tool, indexed and reachable from the internet, was found simply by subdomain search; it returned full account data including the PIN. - snowpick (Bishop Fox). Enumerates ServiceNow exposure via the Service Portal widget API (
/api/now/sp/widget/{id}) and the Table REST API (/api/now/table/{table}), which have independent ACL paths, starting from a public session token.
Defenses
- Maintain a continuous inventory from spec parsing + live traffic + static code + OSINT; decommission deprecated versions and route any that must stay through the same security middleware as current ones.
- Don’t expose specs, debug routes or Swagger UI in production; capture security context (exposure, auth, data sensitivity) per endpoint, not just the path.
Related
- API Security
- OWASP API Security Top 10
- API Rate Limiting
- Excessive Data Exposure
- Backend-as-a-Service Data Exposure
- JavaScript Analysis
- Content Discovery
- GraphQL Introspection
Sources
- API discovery: How it works best practices · original
- API Security Testing: A Complete Guide to Reconnaissance, Hidden Endpoints, Mass Assignment, and… · original
- Mastery Hunt: Hidden API Endpoints — A Deep Dive into API Bug Bounty Recon & Exploitation · original
- Swagger Jacker: Auditing OpenAPI Definition Files · original
- Autoswagger: Automated Discovery and Testing of OpenAPI and Swagger Endpoints · original
- APIDetector: Scan for Exposed Swagger Endpoints · original
- Hacking API discovery with a custom Burp extension · original
- api_wordlist · original
- How To Prepare For An API Penetration Test · original
- Reverse Engineering an API: Building API Documentation with Postman and mitmproxy2swagger · original
- Exploiting All 10 OWASP API Security Risks in vAPI (+ Bonus Arena Challenges) · original
- GraphQL field suggestion abuse: rebuilding a hidden schema · original
- gRPC-Web Coder (BApp) · original