Card 01/ 10

ConceptDifficulty: Beginner2 min

The OWASP API Security Top 10

Ten risks recur across real API breaches, and five of them are decided when the API is designed.

The OWASP API Security Top 10 is a list, last revised in 2023, of the risks behind most real API breaches, published by the Open Worldwide Application Security Project. Five of them are decided by how an API is designed, and this topic covers those five. Each card on a risk answers the same four questions in the same order: what goes wrong, a request that shows it, the fix, and how to test for it.

The five risks this topic covers, against the four questions, with their place on the 2023 list
RiskWhat goes wrongA request that shows itThe fixHow to test
Broken object level authorisation, API1A caller reads or changes another user's objectGET /orders/1002 by the owner of 1001Check ownership on every objectTwo accounts, swap ids
Broken object property level authorisation, API3A caller sets or sees fields they should notPATCH /users/me with role adminAllow-list fields in and outSend and look for extra fields
Unvalidated input, part of several entriesMalformed or huge values reach the codeA 50 MB name, a negative quantityValidate against a schema at the edgeBoundary and oversized values
Unrestricted resource consumption, API4One client exhausts the APITen thousand requests a minute, limit=1000000Rate limits, size and page limitsA load test past the limit
Security misconfiguration, API8, here CORSAny website can read responses in a browserA reflected Origin with credentialsAn allow-list of originsRequests with an unlisted Origin

The other five. Broken authentication (API2), unrestricted access to sensitive business flows (API6), server-side request forgery (API7), improper inventory management (API9) and unsafe consumption of other APIs (API10). Authentication has its own topic in this subject; the rest are operational as much as design, and are worth reading on the OWASP site.

Why these five are design decisions. Each is settled by a rule the endpoint follows on every request: whose object this is, which fields may change, what a valid value looks like, how much one client may ask for, and which websites may read the answer. Writing those rules into the contract is cheaper than finding them in a penetration test.

Authorisation leads the list. Two of the five are authorisation failures, and API1 has led the list since its first edition. Being signed in is where checking begins, not where it ends.

So review every endpoint against the same five questions, and write each answer into its contract.

← → move through sections and cards