Module 11: API Security · 7 min read

APIs and the number one API bug

An API is a set of addresses an app calls to read and change data. The app on your phone shows buttons and lists; behind them, it sends requests like GET /api/v1/users/1042/orders and gets JSON back.

A request and its answer

GET /api/v1/users/1042/orders
Authorization: Bearer eyJhbGciOi...

200 OK
[ { "order": 88123, "total": 18.5 } ]

Anyone can send these requests themselves, with their own changes. So the server must check every request: who is asking, and may they access this exact object?

Tip: Broken object level authorization (BOLA): the API checks that you're logged in, but not that order 88119 is yours. Change the number, get someone else's data.

Check yourself: Where must the check "is this order yours?" happen?

Practice: See whether an API checks whose orders you ask for.