Login
ChallengesLearn
Scoreboard
Teams
SPNZ

LearnAPI SecurityAPI Reconnaissance
API Security·Lesson 2 of 11

API Reconnaissance

Discovering API endpoints, parameters, authentication schemes, and data structures. Swagger/OpenAPI docs, GraphQL introspection, directory brute-force, response fingerprinting — the recon toolkit for API testing.

Beginner12 min
APIReconDiscovery
Loading lesson…
PreviousAPI Security OverviewNextBroken Object Level Authorization

© 2026 SPNZ.

Terms of ServicePrivacy PolicyCookie Policy

Before an attacker can exploit an API, they must understand its surface area. API reconnaissance is the process of discovering endpoints, mapping parameters, identifying authentication schemes, and fingerprinting the technology stack. Every undocumented endpoint, every disabled introspection query, and every verbose error message is a gift to an attacker.

What you'll be able to do
  • Use OpenAPI/Swagger docs and GraphQL introspection to map an API surface.
  • Perform directory brute-force to discover hidden endpoints.
  • Identify technology stacks through response fingerprinting.
  • Apply parameter fuzzing to find undocumented behaviour and injection points.
Prerequisites
Read these lessons first:
  • L1API Security Overview
  • L2HTTP Basics
Key terms
OpenAPI / Swagger
A standard format for describing REST APIs. Exposes every endpoint, parameter, request body, and response schema - a complete attack surface map.
GraphQL introspection
A built-in GraphQL query that returns the full schema definition. When enabled in production, it lets anyone discover all types, fields, mutations, and subscriptions.
Directory brute-force
An automated technique that sends requests to a wordlist of common paths (/admin, /debug, /internal) to discover undocumented or forgotten endpoints.
Parameter fuzzing
The practice of sending unexpected parameter values to API endpoints to uncover hidden functionality, injection points, or crash-inducing inputs.
Response fingerprinting
Identifying the technology stack from HTTP response headers (X-Powered-By, Server), error messages, stack traces, and response formatting patterns.
What is it?

Mapping the unknown

API reconnaissance is an information-gathering phase that happens before any exploit is attempted. It answers four questions: what endpoints exist, what parameters do they accept, what authentication do they require, and what technology runs behind them. The depth of reconnaissance available depends on how much the API reveals about itself.

OpenAPI / Swagger documentation

Many APIs expose documentation at predictable paths: /api/docs, /swagger.json, /openapi.json. An OpenAPI spec lists every endpoint, its HTTP method, query parameters, request body schema, and response structure. This is the single most valuable file an attacker can find - it is a complete map of the API surface, often including internal or deprecated endpoints that should never have been documented.

GraphQL introspection

GraphQL APIs expose a single endpoint (usually /graphql) but the entire schema is available through introspection. Sending the __schema meta-query returns every type, field, argument, mutation, and subscription. This includes fields marked as deprecated, internal, or experimental. Many production GraphQL APIs disable introspection, but a surprising number leave it enabled.

graphqlvulnerable
# Introspection query — returns the entire schema
query {
  __schema {
    types {
      name
      fields {
        name
        type { name }
        description
        isDeprecated
      }
    }
  }
}

# Common dangerous fields found via introspection:
# user(id: ID!, resetToken: String)  — password reset
# creditCard(last4: String)          — payment data
# internalNotes                      — private data
# __internalSchema                   — hidden operations

Directory brute-force and fingerprinting

When documentation is not available, attackers use wordlist-based brute-force tools (like ffuf, gobuster, or dirb) to discover endpoints. A tool sends thousands of requests with paths from a wordlist and flags any that return a non-404 response. Common discoveries include /admin, /internal, /debug, /v2, and /.env.

Response fingerprinting uses HTTP headers and error messages to identify the technology stack. A X-Powered-By: Express header, a Server: gunicorn header, or a Python stack trace in an error response all reveal backend technology. This information guides the attacker toward framework-specific exploits.

API reconnaissance workflow
Mini Map
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Try it

API Reconnaissance Simulator

Use the reconnaissance tool below to enumerate endpoints, run GraphQL introspection, and fuzz parameters. Each tab simulates a real recon technique against a mock API.

~/projects/api-recondev
/recon

No scan data

Click "Discover" to scan the API surface.

Real-world relevance

Facebook 2018 "View As" bug

In September 2018, Facebook disclosed a vulnerability that affected 50 million user accounts. The bug was discovered through API reconnaissance - specifically, endpoint enumeration and parameter fuzzing of Facebook's GraphQL API. The feature in question was "View As", which let users see their own profile as it appeared to a specific friend.

The "View As" feature generated a video upload interface that included a Happy Birthday greeting. The vulnerability was triggered by a combination of three separate issues: (1) an API endpoint that accepted a user ID parameter without validating the relationship, (2) a parameter fuzzing opportunity in the video upload flow that accepted unexpected input, and (3) the generated access token was scoped to the wrong user. An attacker who discovered this combination could steal access tokens and take over any Facebook account.

The Facebook case demonstrates a key principle: API recon is rarely about finding a single smoking-gun endpoint. It is about chaining together small discoveries - an undocumented parameter here, a missing validation there, a verbose error message over there - to build a working exploit. Each piece of information gathered during recon contributes to the attacker's understanding of the API's hidden behaviour.

Mitigation

Locking down your API surface

Every piece of information an API reveals during recon makes the attacker's job easier. Mitigation focuses on minimising what the API exposes before authentication:

typescriptsafe
// VULNERABLE — exposed documentation and introspection
app.use('/api/docs', swaggerUi.serve, swaggerUi.setup(openapiSpec));

// VULNERABLE — GraphQL introspection enabled in production
const server = new ApolloServer({ schema, introspection: true });

// VULNERABLE — verbose error messages leak stack traces
app.use((err, req, res, next) => {
  res.status(500).json({ error: err.stack }); // stack trace leaked
});

// SAFE — disable docs and introspection in production
const isProd = process.env.NODE_ENV === 'production';
if (isProd) app.use('/api/docs', (req, res) => res.status(404).end());
const server = new ApolloServer({
  schema,
  introspection: !isProd,
});

// SAFE — generic error responses
app.use((err, req, res, next) => {
  res.status(500).json({ error: 'Internal server error' });
});

// SAFE — remove fingerprinting headers
app.disable('x-powered-by');
app.use((req, res, next) => {
  res.removeHeader('Server');
  next();
});

Additional defences include: returning 404 instead of 403 for unauthorised access to hidden endpoints (so the attacker cannot distinguish between "exists but forbidden" and "does not exist"), using consistent error formats that do not reveal the technology stack, disabling directory listing on all servers, and implementing API discovery monitoring that alerts when a client requests many non-existent paths (a sign of directory brute-force).

Further reading
  • Facebook "View As" bug technical analysis(Facebook)
  • GraphQL introspection - why you should disable it(GraphQL Foundation)
  • ffuf - fast web fuzzer(GitHub)
  • API penetration testing guide(OWASP)
Key takeaways

What to remember

  • OpenAPI specs and GraphQL introspection give attackers a complete map of the API surface - disable both in production.
  • Directory brute-force discovers hidden endpoints like /admin, /internal, /debug, and /v2 that developers forgot to secure.
  • Response headers (X-Powered-By, Server) and verbose errors leak the technology stack, guiding framework-specific attacks.
  • Parameter fuzzing finds undocumented parameters, mass-assignment opportunities, and injection points.
  • Return 404 (not 403) for hidden endpoints to prevent attackers from confirming existence through response codes.

Knowledge check

0/3 answered · 0 correct
  1. 1.What is the most valuable piece of information an attacker can find during API reconnaissance?

  2. 2.Why should production GraphQL APIs disable introspection?

  3. 3.Why is it better to return a 404 status code instead of 403 for unauthorised access to a hidden endpoint?