Skip to content

Lesson 1 of 9 · 24m

Mapping the API Attack Surface Before You Attack It

Build a route-level map from clients, traffic, schemas, and documentation so object IDs, roles, versions, and hidden capabilities become obvious.

The first API test I ever ran badly started with a scanner. It found a missing header, missed the actual bug — users could read each other's invoices — and generated forty pages of confidence theater. APIs fail at relationships: user-to-object, object-to-tenant, client-to-version. Your first job is to draw those relationships before firing payloads.

Start with the client, not the wordlist

A browser app, mobile app, CLI, webhook consumer, and partner integration often call different slices of the same API. Capture real traffic first:

mitmproxy -p 8080 --set block_global=false
curl -x http://127.0.0.1:8080 https://api.target.local/v1/users/me

Look for the calls the frontend makes after login, after changing an account, and during administrative actions. Mobile applications are especially useful because feature flags and legacy endpoints survive there long after the web UI stops calling them.

Build the inventory as a table

A useful inventory is not a pile of URLs. For every route record:

method + path         object id?      role/scope       mutation?      notes
GET /v1/orders/{id}   order_id        customer         no             owner or support?
PUT /v1/users/{id}    user_id         self/admin       yes            profile fields?
POST /v1/api-keys     account_id      owner            yes            key lifecycle?
GET /v2/reports/{id}  report_id       tenant           no             v1 still alive?

When an endpoint accepts an identifier, ask what protects the relationship between this identifier and the caller? That question drives almost every serious API finding.

Schemas are treasure maps

OpenAPI documents, GraphQL introspection, protobuf files, generated TypeScript clients, and mobile API models all reveal fields the UI never exposes:

curl -s https://api.target.local/openapi.json | jq '.paths | keys[]'
curl -s https://api.target.local/graphql   -H 'content-type: application/json'   -d '{"query":"{ __schema { queryType { name } mutationType { name } } }"}'

If introspection is disabled, generated client packages still leak mutation names, parameter types, and enum values. Sourcemaps can be even better: reverse them and read the original client code.

Do not ignore versioning and deployment drift

/v1, /v2, /internal, /beta, /v1.1, host-based versions, and feature flags routinely disagree about authorization. When a route exists in two versions, replay the exact same object access in both. Older versions often predate a tenant-isolation fix.

Field notes

  • A 404 can mean "route absent," "object absent," or "not authorized." Record behavior differences instead of treating them as noise.
  • Read error messages literally; framework errors often reveal whether parsing, validation, or authorization ran first.
  • Save requests in a repeatable collection. Memory is not evidence, and you will need the same object IDs again.
  • Never brute-force a production tenant because the surface map looks thin. Thin means incomplete recon, not proof of safety.

Was this lesson helpful?

Sign in to rate