Skip to content
routebase
API Testing12 chapters

Chapter 08 of 12

API Security Testing

The OWASP API Security Top 10 from 2023 as a working map, authorization testing with two identities, fuzzing, and where automated scanning stops.

API security testing looks for a control that is missing, not a feature that is present, and that inversion is what makes it feel different from the rest of a suite. A functional test asks whether the endpoint does what it should, while a security test asks whether it also does something it should not.

This chapter is the short version, covering how security testing fits into a suite. The API security guide takes the same ground one category at a time, with a chapter per OWASP identifier and separate chapters on running a scan, triaging what comes back and where automation stops.

The map, not the checklist

The OWASP API Security Top 10 from 2023 is the standard reference, and it is most useful as a map of where to look, not a list to tick off.

CategoryThe question to ask
API1 Broken Object Level AuthorizationCan one user read or change another user's object by changing an identifier
API2 Broken AuthenticationCan the authentication itself be bypassed, brute-forced or replayed
API3 Broken Object Property Level AuthorizationDoes a response expose fields this caller should not see, or accept fields they should not set
API4 Unrestricted Resource ConsumptionCan one caller exhaust memory, connections, cost or rate budget
API5 Broken Function Level AuthorizationCan a normal user call an administrative operation
API6 Unrestricted Access to Sensitive Business FlowsCan a flow be automated at a scale the business did not intend
API7 Server-Side Request ForgeryCan a URL in a request make the server fetch something internal
API8 Security MisconfigurationAre there defaults, headers, error details or TLS settings that give ground away
API9 Improper Inventory ManagementAre old versions, staging hosts or undocumented endpoints still reachable
API10 Unsafe Consumption of APIsDoes the service trust the upstream APIs it calls more than it should

Three of those ten are access-control failures, and they sit at the top because that is where the breaches are. If you do one thing from this chapter, make it the authorization work below.

Authorization needs two identities

This is the part a single-user test suite structurally cannot do. Every test in an ordinary suite authenticates as one identity, and an endpoint that returns everything to everybody looks perfect from inside one account.

The method is to hold two identities and cross them.

As user A   POST /orders            → 201, id = ord_a1
As user B   GET  /orders/ord_a1     → must be 404 or 403, never 200

Two details decide whether the test is meaningful.

Pick identities from different tenants. Two users in the same organisation may legitimately see each other's data, so a positive result there is noise. A user from another customer entirely is the case that matters.

Prefer 404 over 403 for objects that are not yours. A 403 confirms the object exists, which hands an attacker a free existence oracle. Returning 404 for both "does not exist" and "not yours" gives nothing away.

The same technique covers function-level authorization, with a privilege gap in place of a tenant gap. Call the administrative endpoint as a plain member and assert that it refuses.

Property-level authorization is the third variation, and it runs in both directions. Read an object as a low-privilege user and check the response for fields they should not see. Then send an update containing a field they should not be allowed to set, and check that the service ignores it instead of applying it.

Fuzzing finds what nobody thought to send

Every input validation test you write covers a case somebody imagined. Fuzzing covers the ones you did not, by sending values that are structurally wrong for the schema and watching what happens.

Two flavours behave differently. Schema fuzzing generates payloads that violate the documented types, lengths and formats, so it asks whether validation actually runs. Mutation fuzzing takes a valid payload and corrupts parts of it, which finds the handlers that validate the outer object and trust its contents.

The signal to look for is not a 400. A 400 means validation worked. The signal is a 500, a stack trace in the body, a timeout, or a 200 that accepted something impossible.

Fuzzing generates load, so point it only at environments you own, and give it a request budget.

Where automated scanning stops

Be clear about the boundary, because a green scan report is easy to over-read.

A scanner reliably covers the mechanical categories, meaning missing authorization checks, weak input handling, misconfiguration, exposed inventory and the injection surfaces. It does this on every endpoint on every run, which no human does.

It cannot model your business. A refund endpoint that lets any authenticated user refund any order they are allowed to view is a serious flaw, and it looks like correct behaviour to a scanner. Every request is authorized and every response matches the contract. Sequences that can be driven out of order, prices that can be manipulated between steps, and quotas that reset in a way somebody can exploit all live in the same blind spot.

That gap is covered by people, either as a threat-modelling exercise on the flows that carry money or as a penetration test. Automated scanning is what makes their time worth spending, because it clears the mechanical findings first.

Triage, or the scan stops being read

A scanner that raises fifty findings on its first run against an existing API is normal, and the next thing that normally happens is that nobody looks at run two.

Three habits prevent that.

Give every finding a status and a note. Fixed, false positive and accepted risk are all legitimate outcomes, and each of them needs a sentence saying why. The sentence is what stops the same argument happening again in three months.

Gate on severity, and start high. A build that fails on critical findings from day one is a build that stays green after the first fix. A build that fails on every low-severity informational finding is a build somebody disables in week two.

Let the tool reopen what returns. A finding you marked fixed should come back automatically when a later scan sees it again. A fix that was quietly reverted is exactly the case nobody re-checks by hand.

Where security testing runs

CadenceProfileTarget
Every pull requestPassive scanners, modest time budgetPreview or staging
Nightly or weeklyFull profile including authorization scanners and fuzzingStaging you own
Before a releaseThe full profile plus manual review of anything newStaging

Keep the pull-request pass small enough to finish inside a normal review wait. The thorough pass has time overnight. That is where the fuzzers belong.

In Routebase

Routebase includes a scanner that tests running APIs against the OWASP API Security Top 10 from 2023. Because it reads your specification, it sends targeted probes at documented endpoints, parameters and request bodies instead of crawling blindly. That keeps the false-positive rate down and maps every finding back to the endpoint that produced it.

Security findings table listing critical findings for unsigned JWT acceptance and cross-tenant reads, each with a method, a path and a status.
Scanner findings carry a severity, the method and path they were found on, and a status you can triage.

Thirteen scanners cover the categories, and the authorization ones work exactly as described above. The BOLA scanner creates a resource as one persona and reads it back as another. It skips endpoints without a matching create call instead of guessing. An enumeration fallback covers the read-only endpoints, with three guards that stop public catalogues being reported as breaches. The function-level scanner calls administrative-looking endpoints as a normal user, and the property-level scanner inspects responses per identity for fields that should not be there. Two fuzzers cover schema and mutation payloads, and they stay silent until you raise the fuzzing intensity above off.

The identities are personas, meaning stored credentials with any of the supported auth schemes. A persona must carry real credentials, because a persona with none tests nothing. The guidance to use personas from different tenants for object-level checks is written down in the docs and not left as folklore.

Findings carry a severity and a confidence, a reproduction curl command, the raw scanner evidence and remediation guidance for the category with code examples. Triage moves a finding through in progress, fixed, false positive, accepted risk or duplicate. Every resolving status requires a note. A later scan that sees the issue again reopens it automatically.

Scans run from a profile, on a cron schedule or from a pipeline over the REST API or the CLI, and findings export as SARIF 2.1.0 for a code-scanning tool. The gate threshold is yours to choose, and the guidance is to start at critical on an existing API and tighten later. See Security Overview, Scanner Reference, Personas and Security in CI/CD.

Frequently asked questions

What is API security testing?

API security testing probes an interface for behaviour nobody intended, which covers authorization that is not enforced per object, input handling that accepts what it should reject, and configuration that exposes more than it should. It differs from functional testing because it looks for the absence of a control instead of the presence of a feature. Most of it can be automated, and the part that cannot is business-logic abuse, which needs someone who understands what the API is for.

What is the OWASP API Security Top 10?

It is a list of the ten risk categories that appear most often in real API breaches, maintained by the Open Worldwide Application Security Project and last revised in 2023. The 2023 edition leads with broken object level authorization, broken authentication and broken object property level authorization, because access-control failures dominate the data. Treating it as a checklist misses the point, and treating it as a map of where to look is exactly right.

What is broken object level authorization?

It is an endpoint that checks whether you are logged in but not whether the object you asked for is yours. Swapping an identifier in the URL then returns somebody else's record. It tops the OWASP API Security Top 10 because it is easy to introduce, invisible in a single-user test, and directly exploitable by anyone who can count.

Can automated scanning replace a penetration test?

No, because the two cover different ground. A scanner reliably finds the mechanical categories. Those are missing authorization checks, weak input handling, misconfiguration and information exposure, and it finds them on every endpoint on every run. A penetration test finds the flaws that need a model of your business, such as a workflow that can be driven out of order to obtain something for free. Run the scanner continuously and bring in people for the rest.

Last reviewed by The Routebase Team.

Ready to ship on it?

Routebase is live. Design your API once — docs, mocks, tests, and monitoring all follow from the same source.

14-day Pro trial — no credit card required.