API Security (OWASP API Top 10)
APIs (REST, JSON, mobile, microservices, GraphQL) are today’s largest attack surface: they expose business logic directly, without the UI layer that sometimes hides endpoints. The attacker doesn’t see a website, they see data and verbs, and the dominant bugs aren’t classic injections but authorization flaws: objects and functions reachable by someone who shouldn’t. OWASP keeps an API-specific Top 10 precisely because the threat model differs from traditional web.
flowchart LR
A["Attacker (account B)"] -->|"GET /users/1337 with B's token"| API["API"]
API -->|"does it check B owns 1337?"| C{Authorization}
C -->|"no (BOLA)"| L["Victim A's data"]
C -->|"yes"| R["403"]
Threat model
Section titled “Threat model”In an API, the client (mobile app, SPA, another service) knows the endpoints and sends
identifiers directly. If the server authorizes “because you’re authenticated” but doesn’t
check that this user may touch this object or this function, it falls. The frontend
protects nothing: every endpoint is reachable with curl. The typical impact is mass access
to others’ data or privileged functions, not a one-off flaw.
Anatomy
Section titled “Anatomy”The difference from classic web is that authorization stops being “are you logged in?” and becomes two questions per request: may this user access this object (object level) and this function (function level)? The invariant BOLA and BFLA break: every endpoint makes, server-side, an authorization decision about this object and this function — by whatever policy applies: ownership, tenancy, ACL, relationship or scope — without trusting that the client “only” asks for its own. (Comparing the session user ID is just one such policy and misses shared, delegated or multi-tenant objects.) On top of that: not filtering which fields are returned (over-exposure) nor which are written (mass assignment).
OWASP API Security Top 10 (2023) — the essentials
Section titled “OWASP API Security Top 10 (2023) — the essentials”- API1 BOLA (Broken Object Level Authorization): the object
idis manipulable and ownership isn’t validated → the IDOR of APIs, the #1 bug. - API2 Broken Authentication: weak tokens, badly validated JWT, login with no rate limit.
- API3 BOPLA: merges excessive data exposure (the API returns more fields than the UI shows) and mass assignment (accepts fields it shouldn’t write).
- API4 Unrestricted Resource Consumption: no rate limit or size limits → DoS and cost (SMS/email abuse included).
- API5 BFLA (Broken Function Level Authorization): reaching another role’s functions (admin endpoints) by not checking the role.
- API6 Unrestricted Access to Sensitive Business Flows: sensitive flows automatable without friction (bulk buying, reservations) — see business logic.
- API7 SSRF: the API fetches URLs the user sets (see SSRF).
- API8 Security Misconfiguration: lax CORS, extra verbs, missing headers, open debug.
- API9 Improper Inventory Management: old versions (
/v1/) and shadow/deprecated endpoints left unpatched. - API10 Unsafe Consumption of APIs: blindly trusting third-party APIs you integrate.
Red Team
Section titled “Red Team”Discovery
Section titled “Discovery”- Capture the mobile/SPA traffic (Burp + proxy) to enumerate real endpoints.
- Look for the spec:
/swagger.json,/openapi.json,/api-docs,/graphql,/v1/,/v2/routes. - Enumerate old versions and undocumented endpoints (API wordlist fuzzing: kiterunner,
SecLists
api/). - In GraphQL, try introspection (
__schema) to dump the whole type and mutation schema.
BOLA / API1
Section titled “BOLA / API1”The #1 bug. With two accounts, do the action with A, capture the request and replay it with B’s token pointing at A’s objects:
GET /api/v1/users/1337/orders HTTP/1.1Authorization: Bearer <B's_token>If it returns A’s orders, it’s BOLA. Try sequential IDs, UUIDs leaked in other responses, and identifiers in body, headers and parameters, not just the URL.
Excessive data exposure / mass assignment (API3)
Section titled “Excessive data exposure / mass assignment (API3)”Look at all fields of the JSON, not just the ones the UI paints, and try writing the privileged ones:
GET /api/v1/users/me → does it return passwordHash, isAdmin, internal tokens?PATCH /api/v1/users/me {"role":"admin","verified":true}(see mass assignment for the field-discovery methodology.)
BFLA / API5
Section titled “BFLA / API5”Try admin verbs and routes with a user-role token:
DELETE /api/v1/users/1 HTTP/1.1POST /api/v1/admin/promote {"user":2}Also change the method (GET→PUT/DELETE) on the same resource: sometimes authorization
only covers the “expected” verb.
Consumption and inventory (API4 / API9)
Section titled “Consumption and inventory (API4 / API9)”Check for rate limits and pagination/size limits (API4), and compare versions:
GET /api/v1/... vs /api/v2/... # is the old v1 still live and unpatched?By hand (the researcher’s flow)
Section titled “By hand (the researcher’s flow)”- Enumerate real endpoints (traffic + spec + version fuzzing).
- For each, the two questions: someone else’s object? (BOLA) another role’s function? (BFLA).
- Review the full JSON response (over-exposure) and try writing fields.
- Automate the authorization check with two sessions and prove impact with a minimal PoC on your own accounts.
Tooling
Section titled “Tooling”- Burp Suite + Autorize (automatic authorization-flaw detection with two sessions) and Auth Analyzer.
- Postman / Insomnia to build requests; kiterunner and ffuf with API route wordlists; Arjun/param-miner for parameters.
- nuclei with API-misconfig templates; a GraphQL client with introspection (GraphQL Voyager, InQL).
Impact
Section titled “Impact”Read/write of any user’s data (BOLA), escalation to admin (BFLA), PII leakage via over-exposure, account takeover, and DoS/cost from missing limits.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- One token accessing many distinct object IDs (BOLA/scraping pattern).
- Calls to admin endpoints with user-role tokens (BFLA).
- Volume spikes with no rate limit; access to deprecated
/v1/versions. - GraphQL introspection from untrusted clients.
Telemetry and sources
Section titled “Telemetry and sources”Log user, object/ID and function per request and correlate identity ↔ accessed resources; per-endpoint and per-token metrics (volume, 403/404 ratio); API-gateway and WAF logs; inventory of endpoints and versions in production.
Hardening
Section titled “Hardening”- Object- and function-level authorization on every endpoint: check server-side that the authenticated user is authorized for that action on that resource by whatever policy applies (ownership, tenancy, ACL, relationship or scope), not merely authenticated.
- Return only the needed fields (explicit DTOs/serializers); allow-list of writable fields (against mass assignment).
- Rate-limiting and size/pagination limits on every endpoint; protect sensitive flows.
- API inventory: retire old versions, document and patch; close shadow endpoints.
- Secure config: strict CORS, minimal verbs, no debug in production; validate input against a schema; disable GraphQL introspection in production.
- Robust authentication (well-validated JWT, expiring tokens, login rate limit).
Response
Section titled “Response”Revoke tokens, audit which objects/functions were accessed improperly, fix the missing authorization and retire vulnerable versions.
CVEs and real-world cases
Section titled “CVEs and real-world cases”- Peloton (2021) — BOLA exposing any user’s profile data via the API.
- USPS Informed Visibility (2018) — an API with no authorization exposed ~60M users’ data.
- Optus (2022) — an API reachable without authentication leaked millions of records; a reference case of BOLA/misconfig.
- T-Mobile / Experian / several — breaches from API endpoints lacking proper access control.
Specific CVEs/incidents in NVD (https://nvd.nist.gov/vuln/search) and GitHub Advisories (https://github.com/advisories).
Testing checklist
Section titled “Testing checklist”- Are object IDs manipulable without an ownership check? (BOLA)
- Does the JSON return extra sensitive fields? (excessive exposure)
- Can privileged fields be written? (mass assignment)
- Admin functions/verbs reachable with a normal token? (BFLA)
- Are there rate limits and size/pagination limits? (resource consumption)
- Old versions (
/v1/) or shadow endpoints left unpatched? - Is authentication (JWT/token) validated correctly? GraphQL introspection open?
- Is the config (CORS, verbs, debug, headers) secure?