AI pentesting guides / What to test

REST APIs

REST API pentesting

REST API pentesting means testing each resource and HTTP method of a RESTful API for authorisation, authentication and input-handling flaws, and proving every finding with a reproducible request. REST's predictable structure (resources at URLs, actions as verbs, IDs in the path) makes it easy to enumerate and, for the same reason, easy to attack.

A REST test differs from a generic web test in what it pays attention to: the combination of path, verb, content type and identifier, and whether the server checks authorisation for every combination rather than just the ones the client uses.

REST-specific attack surface

  • Identifiers in paths: /orders/1042 invites changing 1042. Sequential integers are easier to guess, but UUIDs do not prevent BOLA if they leak elsewhere.
  • Verb coverage: an endpoint may check authorisation on GET but not on PUT, PATCH or DELETE.
  • Version drift: /api/v1 often survives after /api/v2 adds checks.
  • Content-type handling: an endpoint that also accepts XML can open XXE; one that accepts form data may bypass JSON schema validation.
  • Nested resources: /users/7/orders/1042 should check that order 1042 belongs to user 7 and that the caller is user 7.

A practical test sequence

Import the specification, authenticate as at least two users per role, and record a baseline of every call. Then, for each resource, replay requests across users (horizontal), across roles (vertical) and without credentials. Next, tamper with bodies: add fields from the response schema, change types, send arrays where objects are expected. Finally, run injection checks on parameters that reach databases, file systems, shells or outbound HTTP clients.

Evidence a developer can act on

Write each finding as a minimal pair: the attack request and response, the control request and response, and the identities used. For example: user A's token on GET /api/v2/orders/2213 returns order data belonging to user B (200), while GET /api/v2/orders/999999 returns 404. That pair proves the object exists, belongs to someone else and is returned without an ownership check.

Fixing common REST findings

Centralise authorisation in middleware or a policy layer that runs for every route and verb. Retire old versions or apply the same controls to them. Map request bodies onto explicit input types. Reject unexpected content types. Return the same error for not-found and not-yours where enumeration matters.

With Pentest-Swarm

How Pentest-Swarm tests REST APIs

Pentest-Swarm treats REST APIs as a first-class target, combining recon with exploit agents that try to prove each class rather than flag it.

  • Endpoint and parameter discovery with katana, gau, ffuf and arjun to find routes outside the documented surface.
  • Differential oracles prove cross-user object access, mass assignment and 403-to-200 bypasses through path-normalisation and header variants.
  • sqlmap-confirmed injection is re-proven with a timing ladder, so the delay has to scale with the injected SLEEP.
  • Shipped chains on VAmPI demonstrate BOLA, BFLA password reset and register-as-admin mass assignment end to end.

Where it falls short

Coverage depends on discovery: endpoints the swarm never sees are never tested, so supply a specification where you have one. Pentest-Swarm does not currently test rate limiting, race conditions or business-flow abuse automatically. Where a REST API underpins a regulated process, a manual tester should review state transitions and multi-step workflows.

Questions

Do UUIDs prevent IDOR in REST APIs?

No. They make guessing harder, but IDs often leak in other responses, URLs, logs or shared links. Only a server-side ownership check prevents BOLA.

Should I test every HTTP method on every endpoint?

Yes. Authorisation checks are frequently applied per method, and unused methods such as PUT or DELETE are a common source of findings.

Can a REST API pentest run in CI?

Parts of it can. Pentest-Swarm has a ci-cd-security playbook and can emit SARIF, so findings appear alongside other CI results.

Sources

  1. OWASP REST Security Cheat Sheet
  2. OWASP API Security Top 10 (2023)