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.

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 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.

Sources