liveBook · Manning

Vulnerable api design

As explained in Secure APIs

Vulnerable API design is an API design that contains security weaknesses inherent in its specified behavior or constraints.

Vulnerable API design contains security weaknesses in an API’s specified behavior or constraints. Attackers exploit requests that look legitimate, so the problem belongs in design—not only implementation. section 6.1 section 6.7

Unconstrained pagination

A GET /products endpoint might accept optional integer parameters named page and perPage. Without minimum and maximum limits, an attacker can request 100 million products, creating severe server performance problems. Constrain page to 1–100 and perPage to 10–100. section 6.1

Figure 6.1 We use pagination to slice a large collection of items into smaller chunks. On an e-commerce website, for example, we use pagination to let users retrieve a few products at a time when browsing the catalog.
figure

Shows how pagination divides a large product collection into smaller responses, making the design trade-off concrete. section 6.1

Check API designs for weaknesses such as:

  • Predictable identifiers that enable resource scanning. section 6.7
  • Unconstrained strings, optional model properties, additional payload properties, or shared input/output schemas. section 6.7
  • Business flows that can be abused to produce undesired outcomes; enforce the flow and track API interactions. section 6.7

How Secure APIs covers it

How deep it goes
Explains pagination failures and summarizes identifiers, schemas, inputs, payloads, and business flows with mitigations.
Examples
Uses an e-commerce product catalog, pagination parameters, OpenAPI schemas, and a request for 100 million items.
What you can do after
Evaluate API designs and constrain parameters, schemas, identifiers, payloads, and business flows before implementation.
How it connects
Connects pagination with resource identifiers, schemas, SQL injection, mass assignment, and business-flow abuse.

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.