API Security Testing: OWASP API Top 10, Testing Methods, Tools, and Building Secure APIs
A practical guide to API security testing: why APIs are a prime target, the OWASP API Security Top 10, testing approaches including DAST, fuzzing, and manual penetration testing, tools, testing in CI/CD, preparation, remediation, and choosing an API security testing company.
Key takeaways
- APIs power web apps, mobile apps, integrations, and AI agents, and they expose business logic and data directly, making them a prime target.
- Broken authorisation, especially broken object level authorisation, is the most common and damaging class of API vulnerability.
- Effective API testing combines an accurate inventory, automated scanning, fuzzing, and expert manual testing of authorisation and business logic.
- Security testing should be built into development pipelines, supplemented by periodic manual penetration tests.
- Prevention depends on centralised authorisation, strict input validation, rate limiting, and minimal data exposure by design.
Modern software runs on APIs. Single-page web applications, mobile apps, partner integrations, microservices, and AI agents all communicate through APIs that expose data and business functions directly. This makes APIs extremely valuable to attackers: a single flaw in an endpoint can expose millions of records, and because API requests are easy to automate, exploitation can be fast and large-scale. Many high-profile breaches have involved APIs that returned more data than intended or failed to check whether the caller was allowed to access a resource. API security testing finds these weaknesses before attackers do. This guide explains the main risks, testing methods, and how to build security into the API lifecycle.
Why APIs need dedicated security testing
Traditional web security testing focused on pages rendered by the server. In modern architectures, the browser or mobile app calls APIs directly, and the user interface simply hides functions a user should not use. Attackers ignore the interface and call the API themselves, changing parameters, identifiers, and payloads. APIs also tend to multiply quickly: internal services, versions, partner endpoints, and undocumented debug routes accumulate, and some are forgotten entirely. These shadow and zombie APIs often lack current security controls. Generic web scanners struggle with APIs because they cannot discover endpoints without documentation, do not understand authentication flows, and cannot judge whether a response contains data the caller should not see. Dedicated API testing addresses these gaps.
The OWASP API Security Top 10
| Risk | What goes wrong | Example |
|---|---|---|
| API1: Broken object level authorisation | The API does not check whether the caller may access the specific object requested | Changing an order ID returns another customer's order |
| API2: Broken authentication | Weak authentication mechanisms or token handling | No rate limit on login, tokens that never expire |
| API3: Broken object property level authorisation | Excessive data exposure or mass assignment of properties | Response includes internal fields; user sets their own role to admin |
| API4: Unrestricted resource consumption | No limits on requests, payload size, or expensive operations | Attackers exhaust resources or run up costs |
| API5: Broken function level authorisation | Users can call functions reserved for other roles | A regular user calls an admin endpoint |
| API6: Unrestricted access to sensitive business flows | Automated abuse of legitimate functions | Bots buy all limited stock or create mass accounts |
| API7: Server-side request forgery | The API fetches attacker-supplied URLs | Access to internal services or cloud metadata |
| API8: Security misconfiguration | Insecure defaults, verbose errors, missing hardening | Stack traces reveal internals; permissive CORS |
| API9: Improper inventory management | Old, undocumented, or unmanaged API versions | A deprecated version lacks new security checks |
| API10: Unsafe consumption of APIs | Trusting data from third-party APIs without validation | Compromised partner API injects malicious data |
Authorisation failures, the first, third, and fifth items, dominate real-world API breaches. They are also the hardest for automated tools to detect, because a tool cannot know which data belongs to whom without understanding the application.
API types and their testing considerations
REST APIs are the most common. Testing focuses on each endpoint and method, path and query parameters, request bodies, headers, and authorisation for every resource. GraphQL APIs expose a single endpoint with a flexible query language, raising specific concerns: introspection revealing the full schema in production, deeply nested or batched queries that exhaust resources, and authorisation that must be enforced at the field and resolver level. gRPC and other binary protocols require tools that understand their formats. Webhooks need verification of signatures and protection against replay. APIs for AI agents and LLM tools need particular care, because a model manipulated through prompt injection may call APIs with unexpected parameters, so server-side authorisation must never rely on the agent behaving correctly.
API security testing methods
API discovery and inventory. Testing starts by knowing what exists. Combine API specifications such as OpenAPI files, gateway configurations, traffic analysis, and code review to build a complete inventory, including undocumented and deprecated endpoints.
Static analysis (SAST). Scanning source code identifies insecure patterns, such as missing authorisation checks, unsafe deserialisation, and injection risks, early in development.
Dynamic testing (DAST). Automated tools send requests to running APIs, using specifications to understand endpoints, and check for injection, misconfiguration, and some authentication weaknesses.
Fuzzing. Sending large numbers of malformed, unexpected, or boundary values reveals crashes, error handling problems, and validation gaps.
Manual penetration testing. Experienced testers examine authorisation across roles and objects, business logic, token handling, and chained attacks, which automated tools cannot fully assess. Our website penetration testing guide describes the overall methodology.
Runtime protection and monitoring. API gateways and security platforms detect abnormal behaviour in production, such as enumeration of identifiers or unusual data volumes, complementing pre-release testing.
How testers check authorisation
Thorough authorisation testing uses at least two accounts in each role, and where applicable in different tenant organisations. For every endpoint that accesses an object, testers attempt to access objects belonging to the other account by changing identifiers in paths, query strings, bodies, and headers. They try calling administrative and other roles' functions with lower-privilege tokens, use different HTTP methods on the same endpoint, and submit additional properties in requests to see whether protected fields, such as role, price, or account status, can be modified. They examine responses for data that should not be returned, such as other users' details or internal fields. Testers also check that tokens are validated correctly, expire appropriately, and cannot be reused after logout or password change. This systematic approach is labour-intensive but finds the vulnerabilities that cause the largest breaches.
API security testing tools
| Category | Examples | Use |
|---|---|---|
| Intercepting proxies | Burp Suite, OWASP ZAP | Manual testing, request manipulation, automated scanning |
| API clients | Postman, Insomnia, Bruno | Exploring endpoints, building test collections |
| Specification-driven testing | Schemathesis, Dredd | Property-based tests and fuzzing from OpenAPI or GraphQL schemas |
| Static analysis | Semgrep, CodeQL | Finding insecure code patterns in CI |
| GraphQL tools | InQL, GraphQL-specific scanners | Schema analysis, query abuse testing |
| API security platforms | Commercial discovery and runtime protection products | Inventory, posture management, anomaly detection |
Building API security into CI/CD
Annual penetration tests alone cannot keep pace with frequent releases. Integrate security into the development pipeline: lint and validate API specifications, run static analysis on every pull request, execute automated authorisation tests that confirm users cannot access other users' objects, run specification-driven fuzzing against test environments, and scan dependencies for known vulnerabilities. Treat failing security tests like failing functional tests, blocking release until fixed. Keep the security test suite fast enough to run on every change, and schedule slower, deeper scans nightly, so developers receive feedback quickly without delaying everyday work. Maintain the API specification as a source of truth, and alert when deployed endpoints differ from it. Our guides to application security and the secure SDLC and DevOps and CI/CD explain how to embed these practices.
Secure API design principles
- Centralise authorisation in a shared layer or policy engine, rather than repeating checks in each endpoint, so no endpoint can forget them.
- Deny by default: require explicit permission for every resource and action.
- Use unpredictable identifiers where appropriate, but never rely on them instead of authorisation checks.
- Return only necessary fields, using explicit response schemas rather than serialising whole database objects.
- Allow-list writable properties to prevent mass assignment.
- Validate all input against strict schemas, including types, lengths, and formats.
- Rate limit and set quotas per user, token, and IP, with limits on payload sizes and query complexity.
- Use standard, well-tested authentication, such as OAuth 2.0 and OpenID Connect, with short-lived tokens.
- Log security-relevant events and monitor for anomalies.
- Retire old versions deliberately and keep an accurate inventory.
Our API development and integration guide covers broader API design best practices.
Monitoring APIs in production
Testing before release reduces risk, but some attacks only become visible in production, and new vulnerabilities can appear through configuration changes or newly discovered flaws in dependencies. Production monitoring closes this gap. Route all external API traffic through a gateway that enforces authentication, rate limits, and request size limits consistently. Log every request with the authenticated identity, endpoint, response status, and response size, while avoiding sensitive data in logs. Build alerts for suspicious patterns: a single user requesting many sequential object identifiers, which suggests enumeration; sudden spikes in data volume returned to one client; repeated authorisation failures; calls to deprecated or undocumented endpoints; and unusual geographic or time-of-day access. Feed these signals into your security operations process so analysts can investigate and respond quickly. Production data also improves testing, because it reveals which endpoints are used most, which are no longer used and can be retired, and where real-world behaviour differs from specifications. Combining pre-release testing with runtime monitoring gives defence in depth for your most exposed interfaces. Our guide to security operations and MDR explains how monitoring and response work together.
Preparing for an API penetration test
- Provide up-to-date API specifications, such as OpenAPI files, GraphQL schemas, or Postman collections.
- Create test accounts for every role, with at least two accounts per role and, for multi-tenant systems, accounts in two tenants.
- Seed test environments with realistic data so authorisation between users can be tested.
- Explain authentication flows and how to obtain tokens.
- Identify high-risk functions, such as payments, account changes, data exports, and administrative operations.
- Agree on rate limits and whether testers should be exempted from web application firewalls.
Remediation and retesting
Prioritise authorisation and data exposure findings, because they often allow immediate, large-scale data access. Fix root causes, such as missing central authorisation, rather than patching individual endpoints, and add automated tests that reproduce each vulnerability so it cannot return unnoticed. Review similar endpoints for the same pattern, because a flaw in one usually appears in others built by the same team or from the same code template. Communicate fixes and timelines to stakeholders clearly, and if a finding indicates that data may already have been accessed improperly, involve your incident response process to review logs and determine whether notification obligations apply under data protection laws. Request a retest to confirm fixes, and update threat models and secure coding guidance based on lessons learned.
Choosing an API security testing company
Look for a specialist provider with demonstrable API testing experience across REST, GraphQL, and your other technologies, a methodology aligned with the OWASP API Security Top 10, emphasis on manual authorisation and business logic testing, clear reports with reproducible requests, support for integrating automated testing into your pipelines, and retesting included. Ask for a redacted sample report, and ask them to explain exactly how they test multi-tenant isolation and role-based access. Our penetration testing cost guide explains how scope affects pricing.
Example: A fintech startup's mobile app called a REST API for account details, transactions, and payments. A manual API penetration test using two customer accounts found that the transactions endpoint returned any account's history when its ID was changed, and that the profile update endpoint accepted an undocumented field that changed the user's verification status. The scanner used during development had reported neither. The team implemented a central authorisation policy for all account resources, introduced explicit allow-lists for writable fields, added automated cross-account tests to the CI pipeline, and passed the retest before launch.
Test your APIs with Vertex Cyber Tech
We are an API security testing company providing manual API penetration testing, automated security testing in CI/CD, secure API design reviews, and remediation support for REST, GraphQL, and microservice architectures. Explore our cybersecurity services and development services, or book a consultation.
Sources and further reading
Article FAQs
What is API security testing?
It is the process of finding vulnerabilities in APIs through inventory, static analysis, automated dynamic testing, fuzzing, and manual penetration testing, focusing on authorisation, authentication, data exposure, and business logic.
What is the most common API vulnerability?
Broken object level authorisation, where an API fails to check whether the caller may access a specific object, allowing attackers to access other users' data by changing identifiers.
Can automated tools find all API vulnerabilities?
No. Automated tools find many technical issues, but authorisation and business logic flaws usually require manual testing with multiple accounts and an understanding of how the application should behave.
How do you test GraphQL API security?
Check introspection exposure, field and resolver level authorisation, query depth and complexity limits, batching abuse, injection, and error handling, using GraphQL-aware tools and manual testing.
How often should APIs be security tested?
Run automated security tests on every change in CI/CD, and perform manual penetration tests at least annually and after significant changes to authentication, authorisation, or high-risk features.
About Vertex Cyber Tech Engineering Team
Software engineers, AI/ML developers, cloud architects, and security specialists at Vertex Cyber Tech Solutions who design, build, and secure production systems for clients in India, the US, the UK, and worldwide.
More articles