API Security
11/16/2026

API Security Vulnerabilities: 12 Common Flaws, With Examples and Fixes

What each flaw looks like in a real request, how to test for it, and how to fix it.

Written byAnıl Yüksel

An API vulnerability is a flaw in how an API authenticates callers, authorizes access to data and functions, validates input, or limits usage, which lets an attacker read, change, or abuse something they should not reach. Most of these flaws are not exotic. They come from one missing check on one endpoint, one field, or one parameter.

APIs fail differently from traditional web pages. They expose object IDs and business functions directly to machine clients. There is no user interface to hide a field or a button. And many of the most damaging flaws return a perfectly normal 200 OK, so the attack looks like regular traffic.

The OWASP API Security Top 10 (2023) is the standard reference, and every flaw below is mapped to it. This guide is organized differently: by what you will actually find in code and requests, with an example, a way to test for it, and a fix for each.

Quick reference: 12 common API vulnerabilities

#VulnerabilityWhat goes wrongOWASP API Top 10 (2023)
1Broken Object Level Authorization (BOLA / IDOR)Changing an ID returns another user's dataAPI1
2Broken authenticationWeak login, token, or session handlingAPI2
3JWT validation flawsTokens accepted without proper signature or claim checksAPI2
4Broken Function Level Authorization (BFLA)Regular users can call admin functionsAPI5
5Excessive data exposureResponses carry fields the client should never seeAPI3
6Mass assignmentClients can set fields they should not controlAPI3
7Missing rate and resource limitsNo limits on requests, page size, or expensive operationsAPI4
8Business logic abuseLegitimate flows run at scale, out of order, or with odd valuesAPI6
9Server-side request forgery (SSRF)The API fetches a URL the attacker choosesAPI7
10InjectionUntrusted input reaches a query or commandNot a separate category in 2023 (was API8:2019)
11Security misconfigurationPermissive CORS, verbose errors, debug endpointsAPI8
12Shadow and zombie APIsUndocumented or retired endpoints are still reachableAPI9

1. Broken Object Level Authorization (BOLA / IDOR)

BOLA happens when an API accepts an object ID from the client and returns or changes that object without checking that the caller is allowed to access it. It is ranked first in the OWASP API Security Top 10 because it is easy to exploit and appears wherever an endpoint takes an ID from the request.

What it looks like

GET /api/v1/invoices/10452
Authorization: Bearer <token for user A>

The request succeeds for user A's invoice. Changing the ID to 10453, an invoice that belongs to user B, also returns 200 OK with user B's data. Nothing in the response looks like an error.

How to test for it. Create two accounts with the same role. Capture a request that reads or updates an object owned by account A, then replay it with account B's token. A secure API returns 403 or 404. Repeat for every endpoint that takes an ID in the path, query string, or body, including nested IDs such as /orgs/{orgId}/projects/{projectId}.

How to fix it. Enforce ownership in the data access layer, not in the client. Scope every query to the caller, for example WHERE id = ? AND tenant_id = ?. Random or UUID identifiers make guessing harder, but they are not an authorization control.

Go deeper: OWASP API1:2023 BOLA guide, or try it safely in the API security playground.

2. Broken authentication

Broken authentication covers any weakness in how the API verifies who is calling: login endpoints without throttling, long-lived or reusable tokens, tokens passed in URLs, weak password reset flows, and sensitive changes that do not ask the user to re-authenticate.

What it looks like

POST /api/v1/login
Content-Type: application/json

{"email": "[email protected]", "password": "Summer2026!"}

An attacker sends thousands of these requests with leaked passwords. The API answers each one without slowing down, locking the account, or returning 429 Too Many Requests.

How to test for it. Send a burst of failed logins and check for throttling or lockout. Check how long access tokens live and whether logout actually revokes them. Request two password reset tokens and see whether the first one still works. Look for tokens in query strings, which end up in logs and browser history.

How to fix it. Rate limit and add backoff on every authentication endpoint, including password reset and MFA verification. Use short-lived access tokens with rotating refresh tokens. Require re-authentication for email, password, and payment changes. Never accept credentials or tokens in the URL.

Go deeper: OWASP API2:2023 Broken Authentication guide and the API authentication guide.

3. JWT validation flaws

JSON Web Tokens are only as safe as the code that validates them. Common mistakes include accepting the none algorithm, letting the token choose its own algorithm, not verifying the signature at all, ignoring exp, and not checking iss and aud, so a token issued for one service is accepted by another.

What it looks like

{"alg": "none", "typ": "JWT"}
{"sub": "1042", "role": "admin", "exp": 1999999999}

The attacker edits the payload to "role": "admin", sets the algorithm to none, and removes the signature. A misconfigured API accepts it.

How to test for it. Change a claim and resend the token without re-signing it. Try alg: none. Send an expired token. Send a valid token that was issued for a different audience or environment. Each of these should be rejected with 401.

How to fix it. Use a well-maintained JWT library. Pin the allowed algorithms on the server instead of trusting the token header. Always verify the signature with the expected key, and validate exp, nbf, iss, and aud. Use long random secrets for HMAC, or asymmetric keys.

Go deeper: API authentication guide and how API scanners should handle OAuth2 and OIDC.

4. Broken Function Level Authorization (BFLA)

BFLA is the function-level sibling of BOLA. Instead of reaching another user's object, a regular user reaches a function meant for another role, usually an admin or internal operation. It often hides behind an assumption that "nobody will find that endpoint because the UI never shows it."

What it looks like

DELETE /api/v1/users/882
Authorization: Bearer <token for a regular user>

The endpoint was built for the admin panel. It checks that the caller is logged in, but not that the caller is an admin, so the request deletes the account.

How to test for it. List the privileged endpoints from your OpenAPI spec or front-end code. Call each one with a low-privilege token. Also try other HTTP methods on endpoints you can read: if GET /api/v1/users/882 is allowed, check PUT, PATCH, and DELETE too.

How to fix it. Deny by default. Enforce role checks centrally for every route and method, not inside individual handlers where they are easy to forget. Hiding a button is not access control.

Go deeper: OWASP API5:2023 BFLA guide and API Authorization 101: BOLA vs BOPLA vs BFLA.

5. Excessive data exposure

Excessive data exposure happens when the API returns more fields than the client needs and relies on the front end to hide them. Attackers do not use your front end. They read the raw response.

What it looks like

GET /api/v1/users/me
{
  "id": 1042,
  "name": "Ada",
  "email": "[email protected]",
  "passwordHash": "$2b$12$...",
  "resetToken": "b81f...",
  "isInternalTester": true
}

The profile page only shows the name and email, but the response includes a password hash, a live reset token, and an internal flag.

How to test for it. Inspect raw responses rather than what the UI renders. Compare the fields returned to different roles. Pay special attention to list endpoints, which often serialize every field of every object.

How to fix it. Define explicit response schemas for each endpoint and role, and return only allowlisted fields. Never serialize database or ORM models directly into responses.

Go deeper: OWASP API3:2023 BOPLA guide. In 2023, OWASP merged Excessive Data Exposure and Mass Assignment into this single category because they share a root cause: missing property-level authorization.

6. Mass assignment

Mass assignment is the write-side version of the same root cause. The API binds the whole request body to an object, so a client can set fields it should never control: roles, verification flags, balances, or ownership.

What it looks like

PATCH /api/v1/users/me
Content-Type: application/json

{"name": "Ada", "role": "admin", "isEmailVerified": true}

The form only sends name, but the API accepts and saves every field in the body.

How to test for it. Take fields you see in responses, especially sensitive ones, and add them to update and create requests. Then read the object back and check whether the change was saved.

How to fix it. Allowlist the writable fields for each endpoint and role. Use separate input models from your database models. Reject unknown fields instead of silently ignoring or saving them.

Go deeper: OWASP API3:2023 BOPLA guide.

7. Missing rate and resource limits

When an API puts no limits on how often or how heavily it can be called, attackers can exhaust it or run up your bills. This includes request rates, page sizes, upload sizes, deeply nested GraphQL queries, and operations that cost money, such as sending SMS or email.

What it looks like

GET /api/v1/orders?limit=1000000

One request asks the database for a million rows. A short loop of requests like this degrades the service for everyone. The same pattern on POST /api/v1/otp/send turns into an SMS bill.

How to test for it. Raise page sizes and payload sizes past normal values. Send short bursts and check for 429 responses. For GraphQL, send deeply nested queries and batched operations. Call cost-bearing endpoints repeatedly in a test environment.

How to fix it. Set per-client rate limits, maximum page and payload sizes, and timeouts. Limit GraphQL query depth and cost. Put spending limits and per-account quotas on any endpoint that triggers a paid third-party call.

Go deeper: OWASP API4:2023 Unrestricted Resource Consumption guide.

8. Business logic abuse

Some of the most expensive API flaws involve no broken code at all. The flow works as designed, but an attacker runs it at a scale, in an order, or with values the designers never expected: buying out limited stock with bots, reusing a one-time coupon, confirming an order without paying, or sending a negative quantity.

What it looks like

POST /api/v1/checkout/confirm
Content-Type: application/json

{"cartId": "c_771", "paymentStatus": "paid"}

The client is supposed to call the payment step first. The confirm endpoint trusts the paymentStatus the client sends, so skipping payment still ships the order.

How to test for it. Map each multi-step flow and call the steps out of order. Repeat actions that should only happen once. Try negative, zero, and very large values. Automate a high-value flow and see whether anything stops it.

How to fix it. Keep flow state on the server and enforce the allowed transitions there. Use idempotency keys for one-time actions. Add per-account limits and anti-automation controls to flows that move money, stock, or rewards.

Go deeper: OWASP API6:2023 Unrestricted Access to Sensitive Business Flows guide.

9. Server-side request forgery (SSRF)

SSRF happens when an API fetches a URL that the client supplies, as with webhooks, file imports, link previews, or avatar URLs, without restricting where that URL can point. The attacker uses your server to reach internal services it can see and they cannot.

What it looks like

POST /api/v1/profile/avatar
Content-Type: application/json

{"avatarUrl": "http://169.254.169.254/latest/meta-data/"}

The server fetches the cloud metadata endpoint and may return or store its contents, which can include credentials.

How to test for it. Wherever the API accepts a URL, supply internal addresses, localhost ports, cloud metadata addresses, and hostnames that redirect to internal targets. Watch for differences in response content, errors, or timing.

How to fix it. Allowlist the destinations the feature needs. Resolve the hostname and block private, loopback, and link-local ranges after resolution. Disable redirects or re-check every hop. Restrict outbound network access from the service, and use hardened metadata services such as AWS IMDSv2.

Go deeper: OWASP API7:2023 SSRF guide and API trust boundaries.

10. Injection

Injection happens when untrusted input reaches a database query, a shell command, or another interpreter without being separated from the code. It was its own category in the 2019 OWASP API list (API8:2019). OWASP left it out of the 2023 list because injection does not behave differently in APIs than in other applications. It still affects APIs, and JSON bodies add their own variants.

What it looks like

POST /api/v1/login
Content-Type: application/json

{"email": "[email protected]", "password": {"$ne": null}}

A MongoDB-backed login passes the password value straight into the query. The object {"$ne": null} matches any password, so the attacker logs in as the admin.

How to test for it. Send objects and arrays where the API expects strings. Send quotes, operators, and time-based payloads to a test environment. Watch for errors that reveal query fragments, and for differences in response timing.

How to fix it. Use parameterized queries and safe query builders. Validate request bodies against a strict schema that rejects objects where strings are expected. Never pass user input to a shell.

11. Security misconfiguration

Security misconfiguration covers settings around the API rather than its business logic: CORS that trusts any origin, error messages that leak stack traces, debug and admin endpoints left enabled, default credentials, and unnecessary HTTP methods.

What it looks like

GET /api/v1/account
Origin: https://attacker.example
HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://attacker.example
Access-Control-Allow-Credentials: true

The API reflects any Origin and allows credentials, so a malicious site can read logged-in users' account data from their browser.

How to test for it. Send requests with an arbitrary Origin and inspect the CORS headers. Trigger errors with malformed input and read the error body. Probe common debug and management paths. Compare your production configuration with your hardening baseline.

How to fix it. Use an explicit CORS allowlist and never combine a reflected origin with credentials. Return generic error messages and log details server-side. Disable debug features in production, and check configuration in CI so drift is caught before release.

Go deeper: OWASP API8:2023 Security Misconfiguration guide and CORS misconfigurations.

12. Shadow and zombie APIs

You cannot secure endpoints you do not know about. Shadow APIs are live endpoints that are missing from your documentation. Zombie APIs are old versions that were replaced but never turned off. Both tend to miss the security fixes added elsewhere.

What it looks like

GET /api/v1/users/882

Version 2 of the API added proper authorization checks. Version 1 is no longer documented, but it is still deployed and still returns any user by ID.

How to test for it. Compare the routes that actually exist in code and traffic with your OpenAPI spec. Request older version prefixes and see what still answers. Look for endpoints referenced in front-end bundles and mobile apps but missing from the spec.

How to fix it. Build your API inventory from source code and real traffic, not only from documentation. Retire old versions on a schedule and remove them from routing. Flag spec drift in CI so new endpoints cannot ship undocumented. APIScout scans backend source code locally to find endpoints your documentation missed.

Go deeper: OWASP API9:2023 Improper Inventory Management guide.

Also watch: unsafe consumption of third-party APIs. Data from partner and third-party APIs is input too. If your API trusts it blindly, a compromised or malicious provider can reach your systems through you. See the OWASP API10:2023 guide.

How to prioritize API vulnerabilities

Not every finding deserves the same urgency. Rank each one by:

  • Exposure: Is the endpoint reachable from the internet, and does it need authentication?
  • Who can exploit it: A flaw that any valid account can trigger is more urgent than one that needs an admin token.
  • Data sensitivity: Personal, financial, health, and credential data raise the impact.
  • Blast radius: One object, one tenant, or every tenant?
  • Compensating controls: Rate limits, monitoring, and network restrictions can lower the urgency, but they do not remove the flaw.

In practice, authorization flaws such as BOLA, BFLA, and mass assignment on internet-facing endpoints usually belong at the top of the list. They need only an ordinary account and they expose other users' data.

How to find these vulnerabilities in your APIs

  1. Start with an inventory. Testing only what is documented leaves shadow and zombie endpoints untested.
  2. Test as more than one user. Authorization flaws are invisible when every request comes from the same account, because each request succeeds. Use at least two users per role, and at least two roles.
  3. Read raw responses. Excessive data exposure only shows up in the response body, not in the UI.
  4. Test flows, not just endpoints. Business logic flaws appear when steps are skipped, repeated, or reordered.
  5. Automate it in CI/CD. A flaw introduced on a Tuesday should not wait for next year's penetration test.

Use the API security checklist as a starting point for manual review. ApyGuard runs authenticated tests for BOLA, BFLA, BOPLA, authentication, and business-logic risks, and maps every finding to the OWASP API Top 10, so you can run these checks on every release.

Frequently Asked Questions

What is the most common API vulnerability?

Broken Object Level Authorization (BOLA) is ranked first in the OWASP API Security Top 10 2023. OWASP ranks categories by risk using its risk rating methodology rather than by raw frequency counts, but BOLA earns the top spot because it is easy to exploit and appears wherever an API accepts an object ID from the client.

What is the difference between BOLA and IDOR?

They describe the same root problem. IDOR (Insecure Direct Object Reference) is the older web application term. BOLA is the name OWASP uses for it in the API Security Top 10. Both mean the server returns or changes an object without checking that the caller is allowed to access it.

How are API vulnerabilities different from web application vulnerabilities?

Web application testing often focuses on browser-side issues such as cross-site scripting. API flaws are mostly about authorization, data exposure, and business logic, because APIs expose objects and functions directly to any client that can send a request. Many API attacks use valid credentials and return normal status codes.

Can automated scanners find API vulnerabilities?

Scanners reliably find many misconfigurations, injection points, and missing rate limits. Authorization flaws need a tester that understands users, roles, and object ownership, and business logic flaws need knowledge of how each flow is supposed to work. Combine automated, authenticated testing with periodic manual review.

Key Takeaways

  • Most API vulnerabilities come from one missing check on an endpoint, field, or parameter, and many of them return a normal 200 OK.
  • Authorization flaws (BOLA, BFLA, and property-level issues such as mass assignment) are the highest-priority class for most APIs.
  • Test as multiple users, read raw responses, and exercise complete flows. Single-user, endpoint-by-endpoint testing misses the most damaging flaws.
  • Build your inventory from code and traffic, not documentation, so shadow and zombie APIs get tested too.
  • Map findings to the OWASP API Security Top 10 to prioritize and communicate them.

Ready to secure your APIs?

Discover your API surface and test it for OWASP API Top 10 risks. 7-day free trial · No credit card required.

Subscribe to our newsletter

Get API security tips and ApyGuard updates straight to your inbox. No spam, just useful content.

You can unsubscribe at any time with one click.