APIs are the attack surface of the modern web. In 2026, the average enterprise exposes over 900 API endpoints, and Gartner has repeatedly forecast that APIs will become the most frequent attack vector for data breaches.
The reasoning is straightforward: web applications increasingly shift logic to the client and communicate with backends through REST APIs, GraphQL APIs, and microservices.
Every piece of business logic, every data access operation, every authentication check that previously happened inside a server-rendered application now happens over an HTTP endpoint that is directly accessible, enumerable, and testable by anyone who can intercept a browser request.
API security testing is structurally different from traditional web application testing. The OWASP API Security Top 10 identifies vulnerabilities that are either unique to APIs or manifest differently in API contexts:
Broken Object Level Authorisation (BOLA/IDOR), where the API lets any authenticated user access any object by ID; Broken Function Level Authorisation, where administrative endpoints are hidden but not protected; Excessive Data Exposure, where the API returns full data objects and relies on the client to filter; and Mass Assignment, where the API blindly binds request parameters to internal data models. These vulnerabilities require a different testing methodology than web application testing.
Also read: OWASP API Security Testing Framework (ASTF)
This guide covers the complete API security testing methodology: reconnaissance and endpoint discovery, authentication testing, the OWASP API Security Top 10 with proof-of-concept tests, automated scanning with Burp Suite and OWASP ZAP, API-specific fuzzing, and building a secure API testing lab. Every test is demonstrated with curl commands and annotated HTTP requests that you can adapt to your own targets during authorised engagements.
- API security testing methodology
- Lab setup -- practice targets
- Reconnaissance and endpoint discovery
- Authentication and authorisation testing
- OWASP API Security Top 10 -- tests and payloads
- Injection attacks against APIs
- Rate limiting and business logic testing
- API security testing tools
- Automated scanning with Burp Suite and ZAP
- API security testing checklist
- Frequently asked questions
API security testing follows a structured six-phase methodology. Unlike web application testing where you can browse the application to discover functionality, API testing begins with explicit discovery work -- finding endpoints that are not always documented or visible from the front-end.
- API documentation: OpenAPI/Swagger spec, Postman collection, or WSDL. If none exists, your first job is generating it from traffic capture. Documentation tells you the intended behaviour -- testing reveals deviations from it.
- Test accounts at multiple privilege levels: At minimum, two regular user accounts (User A and User B) and one admin account. BOLA/IDOR testing requires two accounts so you can check whether User A can access User B's resources.
- Written authorisation: Scope definition stating which API endpoints, environments (dev/staging/prod), and test techniques are permitted. Never test production APIs without explicit written authorisation.
- A proxy tool configured: Burp Suite or OWASP ZAP set as the HTTP proxy for your API client (Postman, curl, or a browser). All API traffic routes through the proxy, giving you full visibility and replay capability.
- The API base URL and authentication mechanism: Know whether the API uses JWT, API keys, OAuth 2.0, session cookies, or basic auth before you begin. This determines Phase 2 testing approach.
Practice API security testing on intentionally vulnerable targets before testing real applications. Several high-quality vulnerable API applications are available for safe, legal practice.
API reconnaissance finds endpoints that may not be in the official documentation. Hidden endpoints, older API versions, and administrative interfaces are common sources of vulnerabilities precisely because they are not in the documentation and therefore not maintained or secured with the same rigour as documented endpoints.
The OpenAPI specification documents every endpoint, parameter, request body schema, and response format. If available, it gives you the entire API attack surface in a single file. Check these common locations first:
When no specification is available, brute-force endpoint discovery using API-specific wordlists. The SecLists API wordlists contain common REST API path patterns derived from public APIs and known framework conventions.
JWTs are the most common API authentication mechanism and contain several well-known vulnerability classes. A JWT consists of three base64-encoded parts separated by dots: header.payload.signature. The signature prevents tampering -- unless the implementation has one of these weaknesses.
BOLA occurs when an API endpoint accepts an object identifier (user ID, order ID, account number) in the request and returns or modifies that object without verifying that the authenticated user is authorised to access it. This is also called IDOR (Insecure Direct Object Reference) in OWASP Web Security Top 10 terminology.
Remediation: Implement object-level authorisation on every endpoint that accepts an object ID. After authenticating the user, verify that the authenticated user owns or has permission to access the requested object. Never rely on the object ID being unguessable -- UUIDs are not authorisation controls.
Excessive Data Exposure: The API returns full data objects (including sensitive fields) and relies on the client to filter what is displayed. Attackers bypass the client and see all returned fields.
Mass Assignment: The API blindly binds JSON request body fields to internal data model properties. An attacker adds fields (isAdmin, role, balance) that were not intended to be user-settable.
API parameters are just as susceptible to SQL injection as traditional web form fields. The difference is that API parameters are in JSON bodies, URL paths, or query strings rather than HTML forms -- but the underlying vulnerability is identical. Always test every parameter that the API accepts against an injection wordlist.
| Tool | Type | Best for | Install |
|---|---|---|---|
| Burp Suite Professional | Proxy / scanner | Intercepting, replaying, and modifying API requests. Scanner finds injection, auth issues, and info disclosure automatically. Intruder for fuzzing. Repeater for manual testing. Essential for professional API testing. | portswigger.net/burp |
| OWASP ZAP | Proxy / scanner (free) | Free alternative to Burp. Good API support with OpenAPI import. Ajax Spider finds JS-loaded endpoints. Active scan for common vulnerabilities. Suitable for teams that cannot justify Burp Pro cost. | zaproxy.org |
| Postman | API client | Organising and running API test collections. Environment variables for multi-user auth testing. Pre-request scripts and tests for automated assertion. Import OpenAPI specs to generate test collections instantly. | postman.com |
| ffuf | Fuzzer | Fast endpoint discovery and parameter fuzzing. API-specific wordlists from SecLists. Filter by status code, response size, or word count. Much faster than dirb/dirbuster for API path discovery. | pip install ffuf |
| jwt_tool | JWT tester | JWT decoding, tampering, brute-forcing, and all known JWT attacks (none alg, alg confusion, kid injection). The definitive JWT testing tool for API security assessors. | pip install jwt_tool |
| sqlmap | SQLi scanner | Automated SQL injection detection and exploitation. Supports JSON body parameters with --data flag. Use --level 3+ for thorough API parameter testing. Always get written permission before running sqlmap. | pip install sqlmap |
| Nuclei | Template scanner | 9,000+ community templates including API-specific CVEs, authentication bypasses, and misconfigurations. Fast enough to scan all API endpoints in minutes. Excellent for identifying known vulnerabilities in API frameworks. | github.com/projectdiscovery/nuclei |
| truffleHog | Secret scanner | Finding exposed API keys, tokens, and credentials in git repositories, S3 buckets, and source code. Essential for recon phase -- leaked keys in public repos are a common API compromise vector. | pip install trufflehog |
| Arjun | Parameter discoverer | Discovers hidden API parameters not in documentation by fuzzing parameter names. Finds undocumented fields that may enable mass assignment or expose additional functionality. | pip install arjun |
- ✓Locate and download the OpenAPI/Swagger specification -- check 10+ common paths (/swagger.json, /api-docs, /openapi.yaml)
- ✓Extract all endpoint paths and methods from the spec; brute-force undocumented endpoints with ffuf + SecLists API wordlist
- ✓Search JavaScript bundles for /api/ paths and fetch calls not in documentation
- ✓Check for older API versions (v1, v2, v3, beta, legacy) that may have weaker security controls
- ✓Run truffleHog against public GitHub repos for exposed API keys and credentials
- ✓Test all JWT weaknesses: none algorithm, weak secret brute-force, RS256/HS256 confusion, expired token acceptance, kid header injection
- ✓BOLA/IDOR: for every endpoint accepting an object ID, replace your ID with another user's ID using your own token -- confirm 403 returned
- ✓BFLA: access all admin/privileged endpoints with a regular user token -- confirm 403 returned for all
- ✓Mass assignment: add isAdmin, role, verified, credits fields to update requests -- confirm ignored in response
- ✓Excessive data exposure: compare raw API response fields to what the UI displays -- flag unexposed sensitive fields
- ✓Test HTTP method switching on restricted endpoints (GET allowed but PUT/DELETE also works)
- ✓SQL injection: test all string parameters in JSON bodies, URL paths, and query strings with basic SQLi payloads and sqlmap
- ✓NoSQL injection: test JSON body parameters with MongoDB operators ($gt, $ne, $regex, $where)
- ✓SSRF: test all URL-accepting parameters with internal IP ranges, cloud metadata endpoints (169.254.169.254), and Burp Collaborator
- ✓XXE: if API accepts XML content type, test for external entity injection targeting /etc/passwd
- ✓Use Arjun to discover hidden parameters not in the OpenAPI spec -- test discovered parameters for injection
- ✓Rate limiting: send 50-100 rapid requests to auth endpoints -- confirm 429 returned and lockout or delay implemented
- ✓Test rate limit bypass techniques: X-Forwarded-For spoofing, varying User-Agent, alternate endpoint paths
- ✓Business logic: negative amounts, zero values, integer overflow, duplicate parameter submission
- ✓Run Nuclei with API security templates against all discovered endpoints
⚡ Start API security testing -- four immediate actions
- Deploy crAPI or vAPI locally and complete the lab exercises. Run docker-compose up -d from the crAPI repository and work through the BOLA, BFLA, and JWT challenges. Every vulnerability class in this guide has a hands-on exercise in crAPI. Completing the lab takes 2-3 hours and produces a working methodology you can apply to real targets.
- Test your own API for BOLA today -- it takes 10 minutes. Pick any endpoint in your application that accepts an object ID (user ID, order ID, document ID). Log in as two different test users. Use User A's token to request User B's resource. If you get data back, you have BOLA. This is the most common API vulnerability and the simplest to test manually.
- Import your OpenAPI spec into Burp Suite or ZAP and run an authenticated scan. If you have a Swagger or OpenAPI file, import it directly. Configure a valid authentication token. Run the active scanner. The automated scan finds injection vulnerabilities, missing auth, and information disclosure in minutes. Review every finding manually before reporting.
- Add API security testing to your CI/CD pipeline. Nuclei with API templates runs in under 5 minutes and can be added as a pipeline step. OWASP ZAP has a Docker image designed for CI/CD integration (zap-api-scan.py). Catching BOLA and injection vulnerabilities in staging before production deployment is significantly cheaper than fixing them post-breach. DevSecOps pipeline guide | Vulnerability management
API security testing is the process of systematically finding security vulnerabilities in application programming interfaces -- specifically REST APIs, GraphQL APIs, and other HTTP-based services. It differs from traditional web application testing because the attack surface is at the API endpoint level rather than the HTML interface level. Key vulnerability classes unique to or more common in APIs include Broken Object Level Authorisation (BOLA/IDOR), Broken Function Level Authorisation (BFLA), mass assignment, excessive data exposure, and API-specific authentication weaknesses like JWT algorithm confusion. The OWASP API Security Top 10 is the primary framework for structured API security testing.
BOLA (Broken Object Level Authorisation), also called IDOR (Insecure Direct Object Reference), is the most common critical API vulnerability. It occurs when an API endpoint accepts an object ID -- such as a user ID, order ID, or document ID -- in the request and returns or modifies that object without verifying that the authenticated user is authorised to access it. For example, if User A can change the user ID in the URL from /api/users/123 to /api/users/124 and receive User B's data using their own valid token, BOLA is present. Testing requires two separate user accounts: make a request as User A to an endpoint using User B's object ID and observe whether the server enforces ownership. Remediation requires server-side object ownership validation on every endpoint that accepts an object identifier.
The core API security testing toolkit: Burp Suite Professional for intercepting, replaying, and scanning API traffic -- the industry-standard tool for professional API testing; OWASP ZAP as a free alternative with good API support and CI/CD integration; Postman for organising test collections and multi-user authorisation testing; ffuf for fast endpoint discovery and parameter fuzzing; jwt_tool for comprehensive JWT vulnerability testing; sqlmap for automated SQL injection testing in API parameters; Nuclei for template-based scanning covering known API CVEs and misconfigurations; Arjun for discovering undocumented API parameters; and truffleHog for finding exposed API keys and credentials in source code repositories.
JWT (JSON Web Token) testing covers several well-known attack classes. The most critical tests are: (1) Algorithm confusion -- change the alg header to "none" and remove the signature; if the API accepts the modified token, no signature verification is occurring. (2) Weak secret brute-force -- use jwt_tool with a wordlist to crack the HMAC signing secret; if cracked, an attacker can forge tokens for any user. (3) RS256 to HS256 confusion -- if the API uses RSA (RS256), attempt to sign with the public key using HMAC (HS256); some libraries accept this. (4) Expired token acceptance -- send a token with an exp (expiration) timestamp in the past; if accepted, tokens never truly expire. (5) kid header injection -- if the JWT header contains a "kid" field, test it for SQL injection or path traversal. Use jwt_tool for all of these tests.
The OWASP API Security Top 10 is a list of the most critical API security risks, updated most recently in 2023. The ten categories are: API1 - Broken Object Level Authorisation (BOLA/IDOR); API2 - Broken Authentication; API3 - Broken Object Property Level Authorisation (covers both excessive data exposure and mass assignment); API4 - Unrestricted Resource Consumption (rate limiting and resource exhaustion); API5 - Broken Function Level Authorisation (BFLA); API6 - Unrestricted Access to Sensitive Business Flows; API7 - Server Side Request Forgery (SSRF); API8 - Security Misconfiguration; API9 - Improper Inventory Management (shadow APIs, unretired versions); API10 - Unsafe Consumption of APIs (trusting third-party API responses). BOLA (API1) is consistently the most prevalent and impactful vulnerability in real-world API assessments.
API security testing differs from traditional web application testing in several key ways. First, the interface is data (JSON/XML) not HTML -- there is no rendered UI to browse, so you need API documentation, traffic capture, or endpoint brute-forcing to discover the attack surface. Second, the vulnerability profile is different -- BOLA/IDOR, BFLA, and mass assignment are disproportionately common in APIs and require multi-user testing setups. Third, authentication mechanisms are token-based (JWT, OAuth, API keys) rather than session-cookie based, requiring specific token testing techniques. Fourth, APIs often expose more of the data model than web applications -- responses may include fields not shown in the UI. Fifth, GraphQL APIs require entirely different testing techniques (introspection, query depth attacks, field suggestion exploitation) compared to REST APIs.