1. Build the inventory
- Collect specifications: OpenAPI or Swagger files, Postman collections, GraphQL schemas.
- Record real traffic from the web and mobile clients to catch undocumented endpoints.
- Look for old versions (/v1 alongside /v2) and debug or internal routes.
- For GraphQL, check whether introspection is enabled; if not, infer the schema from client queries.
2. Set up identities
Create at least two users in each role, and in multi-tenant systems, users in two different tenants. Most API authorisation tests are comparisons: does user A's token let you read, change or delete user B's object, or call a function only admins should reach? Without multiple identities you cannot run them. Record each user's token, role and the IDs of the objects they own in a simple table; it makes the comparisons quick and the eventual evidence much clearer. Refresh tokens before long sessions so expired credentials are not mistaken for working authorisation checks.
3. Authorisation: objects, properties and functions
- Broken object-level authorisation (BOLA): swap object IDs between users on every read, update and delete.
- Broken object property-level authorisation: look for sensitive fields in responses, and try setting fields such as role, is_admin or tenant_id in requests (mass assignment).
- Broken function-level authorisation (BFLA): call administrative endpoints and methods with an ordinary user's token.
4. Authentication, input and resources
- Authentication: token validation, JWT algorithm and signature handling, token lifetime and revocation, password reset.
- Injection: SQL, NoSQL and command injection in parameters and JSON bodies.
- SSRF: any field that takes a URL, webhook or file location.
- Resource consumption: missing rate limits, unbounded page sizes, and in GraphQL, deep nesting, aliases and batching.
5. Report with reproducible requests
For APIs, the best evidence is a pair of requests: the legitimate one and the one that should have been refused but was not, with both responses. Include the tokens' roles, the impact in business terms and a fix that names the specific authorisation check missing. Group findings by root cause where possible: twenty BOLA findings across twenty endpoints often share one missing middleware check, and saying so makes the fix faster.
API pentesting with Pentest-Swarm
APIs, both REST and GraphQL, are Pentest-Swarm's core target. Its playbooks and deterministic chains focus on exactly the authorisation classes above.
- REST:
pentestswarm playbook run api-security --target api.example.com. - GraphQL:
pentestswarm playbook run graphql-audit --target api.example.comlocates the endpoint, dumps the schema via introspection and probes field-level authorisation, IDOR, injection and batching. - Live-verified chains on VAmPI cover BOLA, BFLA account takeover and mass-assignment self-registration as admin.
- Practise on crAPI, VAmPI and DVGA:
pentestswarm scan --lab --lab-target crapi --swarm --tui.
Where it falls short
Pentest-Swarm tests APIs from the outside; it does not review your API source code for authorisation logic, for which code review or SAST is better suited. It cannot invent identities: for authorisation testing to be thorough, you need to provide or allow creation of multiple users per role. Complex business rules specific to your domain still need a human tester.
Questions
What is the most common API vulnerability?
Broken object-level authorisation (BOLA), which is first in the OWASP API Security Top 10 (2023).
Do I need an OpenAPI spec to pentest an API?
It helps a lot, but you can reconstruct endpoints from client traffic and JavaScript. Undocumented endpoints are often where the bugs are.
How is GraphQL pentesting different?
One endpoint serves many operations, so you test per field and per resolver, and add checks for introspection, query depth, aliases and batching.