API Security Testing Guide

API security testing explained through the OWASP API Security Top 10 (2023): what each risk means, how testers look for it, and how to prepare for a test.

GuideAPI Security8 min readIntermediate

API security testing checks whether every endpoint enforces authentication, authorization and sensible limits for every caller, usually against the OWASP API Security Top 10 (2023). Most of the work is manual authorization testing, because scanners can’t tell which data belongs to whom.

Most modern products are APIs with interfaces on top. Your web app, your mobile apps, your integrations and your partners all talk to the same endpoints, which makes the API the most direct route to your data and your business logic.

The usual safety nets disappear at the API. No interface hides a button and no form limits what can be sent. An attacker talks to the API exactly as your own front end does, and tries everything the front end never would.

Why does API security need its own focus?

API security needs its own focus because APIs have grown well beyond the calls a browser makes, which web application testing has always included.

  • Old versions, admin routes and internal endpoints often remain reachable, so there are more endpoints than any interface uses.
  • Requests carry IDs for invoices, users and files, and every one of them is a potential authorization check.
  • Mobile apps, integrations and partners call APIs in bulk, so rate limits and business-flow controls matter more.
  • REST, GraphQL and gRPC each bring their own quirks.

The OWASP API Security Top 10 exists because these risks differ from those in the general web Top 10.

What is in the OWASP API Security Top 10 (2023)?

The OWASP API Security Top 10 (2023) lists ten categories of API risk, and three of them are about authorization.

ID Risk In plain English
API1 Broken Object Level Authorization You can access a record that isn’t yours by changing its ID
API2 Broken Authentication Logins, tokens or sessions can be guessed, forged or reused
API3 Broken Object Property Level Authorization You can see or change fields you shouldn’t, even on your own records
API4 Unrestricted Resource Consumption Nothing stops requests that are too many, too big or too expensive
API5 Broken Function Level Authorization You can call functions meant for a more privileged role
API6 Unrestricted Access to Sensitive Business Flows A legitimate feature can be abused at a scale that hurts the business
API7 Server Side Request Forgery You can make the server fetch a URL of your choosing
API8 Security Misconfiguration Defaults, verbose errors, missing headers or permissive CORS
API9 Improper Inventory Management Old, undocumented or forgotten APIs are still exposed
API10 Unsafe Consumption of APIs Your API trusts data from third-party APIs too much

API1: Broken Object Level Authorization

Broken Object Level Authorization is ranked first by OWASP, and it is often the most damaging API flaw. A request like GET /api/invoices/1042 returns invoice 1042, but the API never checks that the invoice belongs to the caller. Change the number and you see someone else’s data. In a multi-tenant product, this is an insecure direct object reference (IDOR) between tenants.

Testers look for it with accounts in two tenants, requesting every object one account owns while signed in as the other, across every endpoint and method.

API2: Broken Authentication

Broken authentication covers weaknesses in how the API confirms who you are: tokens that never expire, JSON Web Tokens (JWTs) whose signatures aren’t verified, password reset flows that can be abused, or login endpoints without protection against guessing.

Testers examine token structure and lifetime, tamper with tokens, and test every authentication-related endpoint, not just login.

API3: Broken Object Property Level Authorization

Even when you may access an object, you may not be allowed to see or change every field. The two classic forms are:

  • Excessive data exposure, where the API returns fields the interface never shows, such as internal flags or other users’ email addresses.
  • Mass assignment, where the API accepts fields it shouldn’t, so adding "role": "admin" to a profile update actually works.

Testers compare responses with what each role should see, and send extra properties in write requests.

API4: Unrestricted Resource Consumption

Unrestricted resource consumption means an API has no limits on request rate, payload size, page size or expensive operations. This can cause outages, run up infrastructure bills, or make brute-force attacks practical.

Testers check for it carefully, within agreed rules of engagement, looking for limits rather than trying to exhaust your systems.

API5: Broken Function Level Authorization

Broken function level authorization is about which actions a user can call. A regular user can call DELETE /api/users/{id} or /api/admin/export because the endpoint checks that the user is logged in but not that they are an admin.

Testers map every function available to the highest-privileged role, then call each one as lower-privileged users.

API6: Unrestricted Access to Sensitive Business Flows

Here a feature works exactly as designed, but nothing stops it being automated at scale: bulk-buying limited stock, mass-creating accounts to abuse a referral offer, or scraping every listing.

Testers identify the flows that would hurt the business if abused, then check what limits, if any, apply to them.

API7: Server Side Request Forgery

Server-side request forgery (SSRF) happens when features that fetch a URL on the user’s behalf, such as webhooks, imports or link previews, can be pointed at internal services or cloud metadata endpoints.

Testers supply URLs that target internal addresses and observe how the server responds, using safe, non-destructive payloads.

API8: Security Misconfiguration

Security misconfiguration is a broad category: permissive CORS, verbose error messages that leak stack traces, unnecessary HTTP methods, missing transport security or default settings left on.

Testers use a mix of tooling and manual review across every environment in scope.

API9: Improper Inventory Management

Improper inventory management leaves old or forgotten APIs exposed. Version 1 of the API was replaced by version 2, but v1 is still running without the fixes. Or a staging API with real data is reachable from the internet.

Testers look for undocumented versions, environments and hosts, and check whether they share data or credentials with production.

API10: Unsafe Consumption of APIs

Unsafe consumption means your API calls third-party APIs and trusts their responses without validation. If a partner is compromised, or a response is manipulated, your system follows along.

Testers review how integration data is used and, where possible, test how your API handles unexpected responses.

How API testing differs for REST, GraphQL and gRPC

The Top 10 applies whatever technology your API uses, but each one shifts where testers look.

REST

REST APIs expose many endpoints, each with its own URL and method. Authorization has to be enforced on every one, which makes it easy for a single endpoint to be missed. Testers map every route and method combination, including PUT, PATCH and DELETE variants the interface never calls.

GraphQL

GraphQL usually exposes a single endpoint, and clients ask for exactly the data they want. That flexibility moves the risk:

  • Field-level authorization matters more, because one query can reach many types and fields at once.
  • Introspection, if enabled in production, hands an attacker a full map of your schema.
  • Query depth and complexity need limits, or a single nested query can consume large amounts of server resources (API4).
  • Batching can let an attacker try many passwords or codes in one request, sidestepping simple rate limits.

gRPC

gRPC services use binary messages defined in protocol buffer files. They’re often treated as internal and assumed to be safe, but if they’re reachable they need the same authentication and authorization as any public API. Testers work from your .proto definitions, which is one more reason to share documentation.

Whatever the technology, every request has to be checked against who is asking and what they’re allowed to do.

Why do scanners miss the most important API flaws?

Scanners miss the most important API flaws because they don’t know your business rules, so they can’t judge authorization. Automated API scanners are good at known misconfigurations and common injection patterns. A scanner sees that GET /api/invoices/1042 returns 200 OK, but it can’t tell that the invoice belongs to a different customer.

That’s why API testing is mostly manual. Testers build a picture of who should be able to do what, then check every combination that matters. Our post on why scanners miss broken authorization goes into more detail.

What to prepare for an API pentest

Before an API penetration test, have these ready:

  • API documentation, such as an OpenAPI (Swagger) file or a Postman collection. Without it, testers spend time mapping endpoints instead of testing them.
  • Credentials for each role, ideally in two separate tenants so cross-tenant access can be tested.
  • The base URL of the environment to test, and any data or rate limits to respect.
  • Any client apps in scope, such as the web or mobile apps that use the API.
  • A technical contact for questions during testing.
  • An agreed testing window.

What a good API test report includes

A good API test report gives, for each finding, the affected endpoint and method, the roles involved, the request and response that prove the issue, the impact in business terms, and a specific fix. Authorization findings should state which account accessed which object, so your developers can reproduce them in minutes.

After fixes, a retest confirms what is resolved. Our methodology explains how we rate severity, and our sample report shows how findings are presented.

Summary

The OWASP API Security Top 10 is a useful map, and three of its ten risks come down to one rule: every endpoint must enforce authorization for every object, property and function, every time. Testing that properly takes accounts for every role, good documentation, and people who understand what your product is meant to allow.

If you’re planning a test, see our API penetration testing service, or try our free scope estimator to size the effort.

Frequently asked questions

What is the OWASP API Security Top 10?

The OWASP API Security Top 10 is a list, maintained by OWASP, of the most significant categories of API security risk. The current edition was published in 2023. It's a widely used reference for designing and testing APIs, not a compliance standard in itself.

Does API security testing cover GraphQL and gRPC as well as REST?

Yes. The underlying risks are the same, such as broken authorization and excessive data exposure, but each technology has its own testing techniques, for example GraphQL introspection and query complexity.

Why does an API penetration test need accounts in two tenants?

Because the most damaging API flaws let one customer reach another customer's data. Testers can only check that properly with accounts in at least two separate customer accounts.

How is an API penetration test different from a web application test?

A dedicated API test covers every endpoint, including ones the interface never uses, as well as partner and public APIs. A web app test usually covers only the API calls the front end makes.

Can an API scanner replace manual API security testing?

No. Scanners are useful for known misconfigurations and injection checks, but they can't tell whether user A should be allowed to read invoice 42, and that kind of authorization flaw is among the most serious API issues.

Need a pentest for an audit, a customer, or peace of mind?

Tell us what you need tested. You’ll get a fixed-fee proposal with tester-days and timeline stated, usually within a few days of the scoping call.