July 23, 20269 min readBy Infiniti Tech Partners
API Security: Defending Against the OWASP API Top 10

APIs are now the primary attack surface for most SaaS products, and they fail differently than the web apps security teams grew up defending. The classic threats — SQL injection, XSS — are increasingly handled by frameworks, but the vulnerabilities that actually breach modern APIs are authorization flaws: the endpoint works exactly as coded, returns a clean 200, and hands the wrong user someone else's data. That's why the OWASP API Security Top 10 exists as a separate list from the web app one, and why a WAF and a penny of TLS don't cover you. The good news is that the highest-impact API vulnerabilities are a short, well-understood list, and defending against them is mostly about discipline applied consistently at every endpoint rather than any exotic tooling.

BOLA: the number-one API vulnerability

Broken Object Level Authorization — asking for `/api/orders/1043` and getting back an order that isn't yours — is the single most common and most damaging API flaw, and it's devastating precisely because nothing looks wrong. The endpoint authenticates you correctly, so you're a valid logged-in user; it just never checks that the specific object you requested actually belongs to you. An attacker simply increments IDs and walks your entire dataset, one clean 200 at a time. The defense is unglamorous and absolute: every single endpoint that loads an object by ID must verify that the authenticated caller is authorized for that specific object, enforced server-side, every time, with no exceptions. Don't rely on the client not showing a button, and don't scatter the check — centralize authorization so it can't be forgotten on the one new endpoint a rushed engineer added on a Friday. Using opaque, non-sequential identifiers raises the bar by making objects hard to enumerate, but it is defense in depth, not a substitute for the authorization check itself.

Broken authentication and token handling

If BOLA is 'who are you allowed to see,' broken authentication is 'are you really who you say you are,' and APIs get this wrong in characteristic ways. Weak or missing rate limits on login and token endpoints invite credential stuffing from breach dumps; JWTs are mishandled by trusting the token's own `alg` header, skipping signature verification, or setting expiries so long that a stolen token is useful for weeks. The fixes are well established: verify signatures with a pinned algorithm, keep access tokens short-lived and pair them with revocable refresh tokens, rate-limit and monitor auth endpoints, and move high-value accounts toward phishing-resistant passwordless auth and passkeys so there's no shared secret to steal in the first place. Treat every token as a credential that will eventually leak, and design so that when one does, the blast radius and the useful lifetime are both small.

Leaking data: excessive exposure and mass assignment

Two failures sit on opposite ends of the same mistake — trusting the object shape instead of controlling it explicitly. Excessive data exposure is the response side: an endpoint returns the whole user record — password hashes, internal flags, another person's email — because it serializes the database object directly and relies on the frontend to only display the safe fields, which of course an attacker reading the raw JSON ignores. Mass assignment is the request side: an endpoint binds incoming JSON straight onto your model, so a caller adds `"role": "admin"` or `"account_id": 7` to the payload and updates fields you never meant to expose. Both are fixed by the same principle — never bind or serialize whole objects at the API boundary. Define explicit input schemas that accept only the fields a caller may set, and explicit output shapes that return only the fields a caller may see, per role. It's slightly more code than passing the raw object through, and it's the code that stops your API from quietly handing out admin or dumping private data.

Resource consumption and abuse

An API that will do unlimited work for anyone who asks is a denial-of-service and a cost incident waiting to happen, whether the trigger is malice or a buggy client in a retry loop. Unrestricted resource consumption covers the endpoint with no rate limit, the list call that returns a million rows because the `limit` parameter isn't capped, the file upload with no size bound, and the query that lets a caller request expensive nested data without restriction. Each is a lever an attacker (or an accident) uses to exhaust your database, your bandwidth, or — increasingly — your bill, since a single unbounded endpoint hitting a metered downstream service can run up real money fast. The defenses are concrete and layered: rate limits per client and per endpoint, hard caps on page sizes and payload sizes, timeouts and pagination on expensive queries, and quotas on anything that fans out to a paid dependency. This is table-stakes hygiene, but it's the hygiene that's missing from the endpoints that take systems down.

You can't secure the APIs you don't know about

The last and most underrated risk is inventory: the old `v1` endpoint still live after everyone moved to `v2`, the staging API exposed to the internet, the internal service quietly reachable from outside, the undocumented endpoint a mobile app still calls. These shadow and zombie APIs are dangerous exactly because no one is watching them — they miss the security fixes applied to the 'real' API and become the soft entry point. Defending against this is an operational practice, not a code change: keep an accurate, automatically-updated inventory of every deployed API and version, retire old versions on a real deprecation schedule instead of leaving them running forever, and route everything through a gateway so authentication, rate limiting, and logging are enforced uniformly rather than reimplemented (and forgotten) per service. Consistent, centrally-enforced controls plus knowing what you actually expose is also precisely the kind of evidence a SOC 2 audit wants to see — good API security and provable API security turn out to be the same work.

How Infiniti Tech Partners secures APIs

We secure APIs against the failures that actually breach them, starting with authorization: centralized, server-side object-level checks on every endpoint so BOLA can't slip through, not client-side hiding. We harden authentication with proper token handling, short-lived credentials, rate-limited auth endpoints, and a path to passwordless; and we close the data-leak failure modes with explicit input schemas and output shapes so nothing gets mass-assigned or over-exposed. On top of that we put the operational controls — rate and resource limits, a gateway enforcing consistent policy, and a live inventory that kills shadow and zombie endpoints — that keep the whole surface defensible as it grows. The outcome is an API that stands up to the OWASP API Top 10 in practice, with the consistent, auditable controls that also satisfy your compliance obligations.

Frequently asked questions

What is BOLA and why is it the top API vulnerability?

Broken Object Level Authorization (BOLA) is when an API authenticates you correctly but never checks that the specific object you requested actually belongs to you — so requesting /api/orders/1043 returns someone else's order with a clean 200. It's the most common and damaging API flaw because nothing looks wrong and an attacker simply increments IDs to walk your whole dataset. The fix is absolute: every endpoint that loads an object by ID must verify server-side that the authenticated caller is authorized for that specific object, every time, ideally via centralized authorization.

How do you prevent excessive data exposure and mass assignment in an API?

Never bind or serialize whole objects at the API boundary. For responses, define explicit output shapes that return only the fields a caller may see per role, instead of serializing the database object and trusting the frontend to hide the rest. For requests, define explicit input schemas that accept only the fields a caller may set, so an attacker can't add "role": "admin" to the payload and have it stick. It's slightly more code than passing the raw object through, and it's what stops your API from leaking private data or granting privileges.

What are shadow APIs and how do you manage them?

Shadow and zombie APIs are the old v1 endpoint still live after everyone moved to v2, the internet-exposed staging API, and undocumented endpoints a mobile app still calls — dangerous because no one is watching them and they miss the security fixes applied to the main API. Managing them is operational: keep an automatically-updated inventory of every deployed API and version, retire old versions on a real deprecation schedule, and route everything through a gateway so authentication, rate limiting, and logging are enforced uniformly. You can't secure the APIs you don't know about.

Have a related problem you're working on?

Talk to a senior engineer — usually within one business day.

Start a conversation