# 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 for `api|gateway|backend|internal|dev|staging|uat|sandbox`. - **Mobile apps:** decompile the APK (`apktool d app.apk`, jadx) and grep smali/resources for `https://` 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. `-risk` adds non-GET methods; `-b` fuzzes 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 of `verb+object` function names, plus `api_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. **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]] ([[raw/blog.arok.win/graphql-field-suggestion-abuse-rebuilding-a-hidden-schema-15821|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 `observers` table 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 - [[raw/wiz.io/api-discovery-how-it-works-best-practices-11948|API discovery: How it works best practices]] - [[raw/medium.com/api-security-testing-a-complete-guide-to-reconnaissance-hidden-endpoin-12806|API Security Testing: A Complete Guide to Reconnaissance, Hidden Endpoints, Mass Assignment, and…]] - [[raw/infosecwriteups.com/mastery-hunt-hidden-api-endpoints-a-deep-dive-into-api-bug-bounty-reco-9391|Mastery Hunt: Hidden API Endpoints — A Deep Dive into API Bug Bounty Recon & Exploitation]] - [[raw/bishopfox.com/swagger-jacker-auditing-openapi-definition-files-3992|Swagger Jacker: Auditing OpenAPI Definition Files]] - [[raw/darknet.org.uk/autoswagger-automated-discovery-and-testing-of-openapi-and-swagger-end-3991|Autoswagger: Automated Discovery and Testing of OpenAPI and Swagger Endpoints]] - [[raw/github.com/apidetector-scan-for-exposed-swagger-endpoints-3990|APIDetector: Scan for Exposed Swagger Endpoints]] - [[raw/danaepp.com/hacking-api-discovery-with-a-custom-burp-extension-5558|Hacking API discovery with a custom Burp extension]] - [[raw/github.com/api-wordlist-6028|api_wordlist]] - [[raw/blazeinfosec.com/how-to-prepare-for-an-api-penetration-test-2740|How To Prepare For An API Penetration Test]] - [[raw/bilal423.medium.com/reverse-engineering-an-api-building-api-documentation-with-postman-and-12958|Reverse Engineering an API: Building API Documentation with Postman and mitmproxy2swagger]] - [[raw/medium.com/exploiting-all-10-owasp-api-security-risks-in-vapi-bonus-arena-challen-14687|Exploiting All 10 OWASP API Security Risks in vAPI (+ Bonus Arena Challenges)]] - [[raw/blog.arok.win/graphql-field-suggestion-abuse-rebuilding-a-hidden-schema-15821|GraphQL field suggestion abuse: rebuilding a hidden schema]]