API Pen Testing
Testing REST and GraphQL APIs against the OWASP API Top 10
APIs carry the data behind every web and mobile app, and attackers call them directly. An API pen test maps every endpoint, then works through authentication, object- and function-level authorization, data exposure, resource limits and business flows, using the OWASP API Security Top 10 as the checklist.
Intermediate · 6 steps
| Checklist | OWASP API Security Top 10 (2023) |
|---|---|
| Inputs | OpenAPI spec, Postman collection, proxied traffic |
| Tools | Burp Suite, Postman, OWASP ZAP |
| Most common finding | API1 Broken Object Level Authorization |
| Also test | Old versions (API9 Improper Inventory) |
| Accounts needed | At least two users per role |
Step by step
Map every endpoint Spec, collection and traffic
The client provides an OpenAPI specification. The tester imports it into Burp and Postman, then also records the real traffic from the web and mobile apps. Comparing the two finds endpoints that aren't documented, including an old
/v1/version that is still reachable.Authentication API2 Broken Authentication
The tester checks how tokens are handled: is the signature verified, is an expired token rejected, is the audience checked, are login and password reset rate-limited? Version 2 rejects an expired token, but version 1 still accepts it.
Object and function authorization API1 BOLA and API5 BFLA
With customer A's token, the tester requests customer B's order by ID (both test accounts): the API correctly returns 403. Then, still as a customer, they call an admin function,
POST /v2/orders/{id}/refund, which should be admin-only. It succeeds: a function-level authorization flaw.Data in and out API3 Broken Object Property Level Authorization
Responses are checked for fields the app never shows, and requests for fields a user shouldn't be able to set. The profile response includes another field,
internalNotes, and sending"role":"admin"in a profile update is silently accepted (mass assignment). Inputs are also tested for injection, and GraphQL endpoints for open introspection.Limits and business flows API4 and API6
Can one client ask for everything at once, or automate a sensitive flow?
GET /v2/products?limit=100000returns the whole catalogue in one call, and the "apply discount code" endpoint has no rate limit, so codes could be guessed by a script.Report against the API Top 10 Findings developers can act on
Every finding is mapped to the OWASP API Security Top 10 category, with the exact request and response from Burp as evidence and a specific fix. The biggest fix is architectural: retire v1, and enforce role checks in one shared authorization layer.
Best practices
- Check authorization on every object and every function, on the server
- Validate tokens fully: signature, expiry, issuer and audience
- Return only the fields the client needs, and accept only the fields it may change
- Set limits on rate, page size and payload size
- Keep an inventory of API versions and retire old ones
More in Penetration Testing.
Packets
| No. | Time | Source | Destination | Protocol | Info | Size |
|---|