All articles
12 min read

API Security Testing: How to Find Flaws Before Attackers Do

API security testing checks who can reach which data and actions through your APIs. List your endpoints, test authorisation before anything else, then tokens and input, automate repeat checks, and add manual testing for logic flaws.

By Sangam Goel, Founder & C.T.O · Updated 10 Nov 2026

A security tester sits at her desk in an office and reviews an application on a laptop, with a padlock and a keycard beside her.

Key takeaways

  • After listing your endpoints, test authorisation before anything else. Three of the ten risks in the OWASP API Security Top 10 (2023) are authorisation failures, and broken object level authorisation is first on the list.
  • A scan usually runs under one login. Object-level and function-level flaws need two accounts per role and a person reading the results.
  • Test annually and after major authentication or authorisation changes.
  • Before an outside tester starts, prepare scope, specifications, two test accounts per role, allowlisting and a named contact.
In this article
  1. 1What is API security testing, and how is it different from functional API testing?
  2. 2Start with an API inventory: find shadow, deprecated and undocumented endpoints
  3. 3Test authorisation first: who can reach which object, function and field
  4. 4Broken object level authorisation (BOLA)
  5. 5Broken function-level authorisation
  6. 6Broken object property-level authorisation
  7. 7Authentication and token testing: JWT, API keys, OAuth flows and rate limits
  8. 8Input handling, injection, SSRF and business-logic abuse
  9. 9Injection and SSRF
  10. 10Business-logic abuse
  11. 11What automation catches and what needs manual testing
  12. 12How often to test: CI checks, pre-release tests and periodic penetration tests
  13. 13What a useful API VAPT report contains
  14. 14API security testing checklist: what to prepare before an external test
  15. 15Black box, grey box or white box: what access to give a tester
  16. 16Test safely: staging versus production
  17. 17Next step: Scope your API test with GS2
  18. 18Frequently asked questions

The authorisation-first test order

1. Inventory List every host, version and endpoint, including forgotten ones
|
2. Object level Can user B read or change user A's records? (BOLA)
|
3. Function level Can a basic user call admin or higher-role actions?
|
4. Property level Can a user see or set fields they should not?
|
5. Authentication Tokens, API keys, OAuth flows, rate limits
|
6. Input and flows Injection, SSRF, abuse of business logic
|
7. Automation Repeat steps 2 to 6 on every build; keep manual tests periodic

BOLA means broken object level authorisation. Every term in the diagram is explained below.

An API can pass a full vulnerability scan and still hand one customer another customer's data. The request is valid, the login is valid and the response is a clean success. Nothing looks wrong unless the tester knows whose data it is.

Authorisation, the set of rules about who may do what, is therefore the first thing to test.

What is API security testing, and how is it different from functional API testing?

API security testing checks whether an application programming interface (API) lets only the right callers do the right things, and whether it survives hostile input. Functional testing asks whether the API does its job for a valid user. Security testing asks what a wrong user, a stolen token or a crafted request can make it do.

A passing Postman test suite therefore says little about security. Every functional test can pass while any user can read any record. Your collection is still useful, because it can serve as a specification for a tester.

The OWASP API Security Top 10 (2023) is the reference list of API risks. Its release notes call it "a forward-looking awareness document" and say the 2023 edition was built from the project team's experience and review, because no data was contributed. Use it to decide what to cover. It is not a test plan.

Start with an API inventory: find shadow, deprecated and undocumented endpoints

Start with a written list of every live API host, version and endpoint, because untested endpoints are where old flaws survive. The OWASP API Security Top 10 (2023) rates improper inventory management (API9) as Exploitability Easy, Prevalence Widespread and Detectability Average.

According to the Salt Security H2 2025 State of API Security Report, a survey of 386 security professionals, only 19% were “very confident” in the accuracy of their API inventory. If your team is not sure its list is complete, the first test is finding what is missing from it.

A shadow API runs in production without appearing in your documentation or gateway. A deprecated API is an old version that still answers requests. An undocumented endpoint exists in code or traffic but is missing from your specification, the OpenAPI file or Postman collection that describes your API.

Build the list by comparing the specification, gateway and load-balancer logs, route definitions in code, and Domain Name System (DNS) and cloud-account records. An endpoint in the logs but not in the specification is a shadow-API candidate.

Include the endpoints your mobile apps call. A tester can send requests the app never would, as our mobile app penetration testing guide explains.

  • Pass: every endpoint has an owner, an environment, a version and a stated authentication rule.
  • Fail: any entry nobody can explain. Remove it or put it in scope.

Your internal list covers what you know about. Our external attack surface management (EASM) service scans your internet-facing assets for exposures, which can show you exposed assets your own list may have missed.

An engineer walks along a row of server racks with a tablet and notices one forgotten rack hidden in the shadows.

Test authorisation first: who can reach which object, function and field

Authorisation testing asks three questions in order. Can one user reach another user's objects? Can a low-privilege user call higher-privilege functions? Can a user see or set fields they should not? Counting the ten risk titles in the OWASP list, three name authorisation: API1, API3 and API5.

Broken object level authorisation (BOLA)

BOLA is when an API returns or changes an object, such as an order, profile or invoice, for a caller who does not own it, because the server trusts the ID in the request. OWASP lists it first and rates it Exploitability Easy, Prevalence Widespread and Detectability Easy.

The two-account test:

  1. As account A, create an object and note its ID.
  2. As account B, in the same role, request A's object using B's token.
  3. Repeat with PUT, PATCH and DELETE, and with the ID in the path, the query string and the request body.
  • Fail: B reads or changes A's object.
  • Pass: the API answers 403 or 404 and nothing changes.

Broken function-level authorisation

Broken function-level authorisation (API5) is when a caller can invoke a function reserved for a higher role, such as deleting users, issuing refunds or changing roles. Sign in as the lowest-privilege role and call every admin and higher-role endpoint from your inventory. Then retry with other Hypertext Transfer Protocol (HTTP) methods (PUT, PATCH, DELETE) on endpoints documented only for GET. Test every pair of roles, not only "user" and "admin".

Broken object property-level authorisation

Broken object property-level authorisation (API3) is when a caller can read or write fields of an object that they should not. Mass assignment is the API saving any field a caller sends, including ones the caller should not control. Compare the same object's response across roles. Then add privileged fields such as role, isAdmin, price or balance to a PATCH body.

  • Pass (function and property level): 401 or 403 on forbidden functions, and privileged fields absent, ignored or rejected with the stored value unchanged on re-read.
  • Fail: 200 on a forbidden function, or a privileged value persists.
A tester holds a keycard at an open office door, with a staircase beyond leading to a restricted door on the floor above.

Authentication and token testing: JWT, API keys, OAuth flows and rate limits

Authentication testing checks that the API accepts only valid, current credentials and limits how fast anyone can try them. OWASP covers this under broken authentication (API2) and unrestricted resource consumption (API4). Each check below has a clear pass.

  • JWT security testing. A JavaScript Object Notation (JSON) Web Token (JWT) is a signed token that carries the caller's identity. Send an expired token, a token with an edited payload and the old signature, and a token whose header sets the signing algorithm to "none". Pass: all return 401. Also confirm that a logged-out or revoked token stops working.
  • API keys. A key identifies an application, not a person. Check that keys are not accepted in URLs, which end up in logs, that each key has limited scope, and that a revoked key fails at once.
  • OAuth flows. OAuth (Open Authorization) lets one service act for a user on another. Check that the redirect address must match exactly, that the state value is verified, and that the API itself enforces scopes. Pass: a tampered redirect is refused, and a token with a read scope cannot write.
  • Rate limits. Send repeated attempts at login, password-reset and one-time-password (OTP) endpoints. Pass: the API slows or blocks after a threshold you can state. Fail: attempt 10,000 is treated like attempt 1.

Input handling, injection, SSRF and business-logic abuse

Input testing sends unexpected data into every field the API accepts. Business-logic testing uses valid requests in ways the designers did not intend. Both come after authorisation because they find what a correct permission model cannot stop. Browser-side web flaws such as cross-site scripting belong to web application testing, which we run through our web application VAPT service and explain in our web application penetration testing guide.

Injection and SSRF

Injection means attacker-supplied text is executed as a command, for example Structured Query Language (SQL), NoSQL (non-relational database) or operating-system commands. Send wrong data types, oversized values and special characters in every parameter, including headers and nested JSON fields. Pass: a clean validation error and no change in behaviour. Fail: an error trace or altered results.

Server-side request forgery (SSRF, API7) occurs when an API fetches a web address that the caller supplies, as in webhooks and image imports. Supply addresses of internal services. Pass: the API refuses any address outside an allow-list. Fail: it fetches the address.

Business-logic abuse

Business-logic abuse is chaining valid requests to cause harm: redeeming a coupon repeatedly, skipping the payment step of a checkout, or requesting thousands of OTPs. OWASP calls this unrestricted access to sensitive business flows (API6).

Replay the flow at volume and out of order.

  • Pass: limits are enforced on the server and out-of-order calls are refused.
  • Fail: the hundredth coupon redeems, or the final step succeeds alone.

A scanner does not know what a flow should allow. Agree the volume limits first (see the checklist below).

What automation catches and what needs manual testing

Automated tools catch known patterns quickly on every build. Manual testing finds flaws that depend on who the caller is and what the business intends. Scanners and manual testers do different jobs, so a sound programme uses both.

MethodWhat it doesStrong atWeak at
SAST (static application security testing)Reads source code without running itInjection patterns, hard-coded secrets, early feedbackRuntime configuration and data ownership
DAST (dynamic application security testing)Sends requests to a running API and checks responsesMisconfiguration, known injection and error patternsUsually run under one login and cannot judge who should own an object, so it misses most object-level and function-level flaws
FuzzingSends malformed or random input at scaleCrashes, validation gaps, unexpected errorsBusiness rules
Manual testingA tester uses several identities and reasons about your rulesAuthorisation, token and logic flawsSlower, so done periodically

REST and GraphQL need different approaches. Representational State Transfer (REST) APIs are tested endpoint by endpoint. GraphQL, a query language in which the client chooses the fields, is tested query by query and field by field, including nested queries.

Burp Suite and ZAP (Zed Attack Proxy) are two tools testers use to intercept and replay requests. What matters more than the tool is whether the test uses more than one identity.

API penetration testing is the manual end of this table: a person attacks the API the way an adversary would, usually delivered as vulnerability assessment and penetration testing (VAPT).

How often to test: CI checks, pre-release tests and periodic penetration tests

Run automated checks on every code change, run a targeted test before any release that changes authentication or authorisation, and schedule a full penetration test at least annually. Some providers recommend quarterly testing for sensitive production APIs, such as those handling payments or personal data.

Continuous integration (CI) is the build pipeline that runs on each code change. Put static analysis, a dynamic scan of staging and regression tests for authorisation bugs you have already fixed there.

The right interval follows how fast your permission model changes. If roles or tenants change monthly, a test taken eleven months ago says little. That is our inference, not a fixed rule.

If you want testing between periodic tests, our penetration testing as a service (PTaaS) platform provides continuous penetration testing through an online platform, as an option alongside periodic tests. Our guide to PTaaS versus annual penetration testing compares the two in detail.

What a useful API VAPT report contains

A useful report ties every finding to a risk, an impact, evidence you can reproduce and a fix your developers can apply. Our report sets out the vulnerabilities found, their risks, impact, evidence and recommended fixes.

NIST SP 800-115, published in 2008, is general guidance on planning technical security tests, analysing findings and developing mitigation strategies. It is not specific to APIs, so use it for planning and for the shape of a report, and use OWASP for API risks.

VulnerabilityRiskImpactEvidenceRecommended fix

Illustrative row: broken object level authorisation on GET /orders/{orderId}

HighAny signed-in customer can read other customers' orders and delivery addressesRequest made as user B with user A's order ID returned HTTP 200 and A's order dataCheck order ownership on the server for every read and write, and return 403 on mismatch

The row above is illustrative. It is not a client result.

We test in five steps: information gathering, vulnerability identification, analysis, penetration testing and a comprehensive report. Testing combines automated scanning with manual testing by our security experts. See our API VAPT service.

API security testing checklist: what to prepare before an external test

Settle five items and three questions before an outside tester starts. Each item has a ready-when test.

  1. 1
    Scope and endpoint list
    Ready when every in-scope host, base path and version is listed with its environment, and each deprecated version is marked in or out of scope.
  2. 2
    OpenAPI or Postman specifications
    Ready when the file imports without errors and its endpoint count matches your scope list.
  3. 3
    Test accounts per role, two per role
    Ready when each account can log in and account A owns at least one object of each type that account B cannot see.
  4. 4
    Access permissions and allowlisting
    Ready when requests from the tester's agreed Internet Protocol (IP) addresses pass your web application firewall (WAF) and rate limiter, and the tokens are valid for the whole test window. Allowlisting means the test measures the API, not your firewall.
  5. 5
    Test windows and contacts
    Ready when dates, hours and a named person on your side are written down.

Three questions to settle with any tester:

  • Which operations are allowed: read, write, delete, high-volume? Ready when the answer is written per environment.
  • Who do we call to stop a test immediately? Ready when a named person with a phone number is reachable during test hours.
  • Is a retest in scope? Ready when the agreement says yes or no. Confirming fixes is good practice with any provider.

Black box, grey box or white box: what access to give a tester

The access you grant decides which flaws can be found. In a black-box test the tester gets only the target address. In a white-box test they also get source code and architecture. Grey box sits between, usually with specifications and accounts. Black box without accounts cannot test signed-in authorisation, because there is no second identity. Grey box with test accounts for two roles suits authorisation testing. White box helps most with logic flaws.

Test safely: staging versus production

Run write, delete and high-volume tests in a staging environment that mirrors production's authentication, roles and data shape. Test production only for what staging cannot show, such as live gateway settings and rate limits. Keep those production tests to agreed read-focused cases, inside an agreed window, with a stop contact. Use synthetic data in test accounts, never real customer records. This is our recommendation.

Next step: Scope your API test with GS2

If you expose APIs to customers or partners, use one rule to decide what to do next. If you cannot list every endpoint and name its owner, start with the inventory. If you can, run the two-account test on your five most sensitive endpoints this week, and treat any cross-account read as a release blocker. Whatever you find, ask any outside tester how fixes will be confirmed before you sign.

When you want an outside team to take over, book a consultation with GS2. We agree the scope of your API testing with you and report the vulnerabilities found, their risks, impact, evidence and recommended fixes. Pricing is arranged through a consultation. You can read how our API VAPT service works first.

Call +91-9838391333, email info@gs2cybersec.com or message us on WhatsApp at +91 73079 70448.

Talk to GS2 about API VAPT

Tell us which APIs you run, how many roles they serve and what must stay protected.
Book a consultation

Frequently asked questions

API security testing is checking whether an API lets only the right callers perform the right actions and handles hostile input safely. It covers authorisation, authentication, input handling and abuse of business flows, and combines automated scans with manual tests.
DAST (dynamic application security testing) is an automated scan that sends requests to a running API and flags known patterns. A penetration test is run by a person who uses several identities and reasons about your business rules, so it finds authorisation and logic flaws a scan cannot judge.
Annual penetration testing plus a test after major authentication or authorisation changes is a sound baseline, with automated checks on every code change.
Yes, for the automated part. In a continuous integration and continuous delivery (CI/CD) pipeline you can run static analysis, specification checks, dynamic scans of staging and regression tests for fixed authorisation flaws on each build. Manual penetration testing stays periodic.
Enough information and access to act as each of your user roles, and agreed rules for when and how to test. The checklist above lists what to settle first.

Sources

  1. 1.OWASP API Security Top 10 (2023)
  2. 2.NIST SP 800-115, Technical Guide to Information Security Testing and Assessment

Keep reading

GS2 Cyber Security.

© 2026 GS2 Cyber Security

Powered by PageLens.ai

Get in touch — we'd love to help.

Contact us