liveBook · Manning

Pagination attack

As explained in Secure APIs

A pagination attack abuses collection-pagination inputs to request excessive amounts of data or work from an API.

A pagination attack abuses unconstrained collection parameters to make an API return or process excessive data. For example, an attacker can request millions of items in one call, overwhelming servers and threatening performance or availability. section 12.2

Unbounded course requests

The GET /courses endpoint uses page and per_page parameters. If the API specification sets no minimum or maximum values, an attacker can submit extreme values and request millions of courses at once. A related risk occurs when a course response returns an unbounded lessons array; a malicious actor could create a course with many lessons and force expensive responses. section 12.2 section 12.2

Reduce the attack surface by:

  • Setting minimum and maximum boundaries for pagination parameters such as page and per_page. section 12.2
  • Paginating large collections, including nested read-only collections when returning everything could pressure server performance. section 12.2
  • Reviewing API specification detections and using observability to detect and prevent threats in real time. section 12.2
93:22    error  owasp:api4:2023-integer-limit Schema of type integer must
specify minimum and maximum. paths./courses.get.parameters[0].schema

Spectral flags the GET /courses page parameter because its integer schema lacks minimum and maximum constraints. section 12.2

How Secure APIs covers it

How deep it goes
Explains the missing-boundary failure mode and its consequences, but stops short of implementation code or detailed attack procedures.
Examples
Uses GET /courses page and per_page parameters plus an unbounded course lessons array as concrete risk examples.
What you can do after
Evaluate API specifications for unconstrained pagination and configure collection boundaries that limit excessive responses.
How it connects
Connects pagination attacks with API security, OpenAPI specifications, observability, collection pagination, and service availability.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secure APIs. The section links point to the parts of the book it draws on.