APIs are the backbone of modern applications. They connect customer portals and microservices, and enable third-party integrations. They are also among the most attacked surfaces, and among the least tested.
This guide covers the essential vulnerabilities in API security, the OWASP API Security Top 10, and a practical methodology for finding issues before attackers do.
OWASP API Security Top 10 (2023)
The OWASP API Security Top 10 is the industry standard for understanding API risks. Here's the current list with real-world context:
Broken Object Level Authorization (BOLA)
APIs expose endpoints that handle object identifiers. Attackers manipulate IDs to access resources belonging to other users.
GET /api/orders/12345 returns any order, not just the requester's orders. Broken Authentication
Weak authentication mechanisms allow attackers to compromise tokens, keys, or session identifiers.
Broken Object Property Level Authorization
Users can read or modify object properties they shouldn't have access to.
"role": "admin" in the request body. Unrestricted Resource Consumption
APIs don't limit requests, allowing denial of service or resource exhaustion.
Broken Function Level Authorization
Attackers access administrative endpoints by changing HTTP methods or URL paths.
/api/admin/users directly. Unrestricted Access to Sensitive Business Flows
APIs don't prevent automated abuse of business functions (scalping, spam, fraud).
Server Side Request Forgery (SSRF)
API fetches remote resources based on user input without validation.
POST /api/fetch-url with url=http://169.254.169.254/ can expose cloud metadata when the metadata service and request controls allow it. Security Misconfiguration
Insecure default configurations, verbose error messages, unnecessary features enabled.
Improper Inventory Management
Organizations don't track API versions, leaving old/deprecated endpoints exposed.
/api/v1/ still active with known vulnerabilities after v2 deployment. Unsafe Consumption of APIs
API trusts data from third-party APIs without validation.
Authentication & Authorization Flaws
Four of the ten OWASP API risks are authentication or authorization flaws. Here's what to test:
Authentication Testing
Authorization Testing
Rate Limiting & Resource Exhaustion
APIs without proper rate limiting are vulnerable to abuse, from credential stuffing to denial of service:
Credential Stuffing
Attackers test thousands of stolen credential pairs against login endpoints. Without rate limiting, they can validate credentials at scale.
Data Enumeration
Iterating through IDs or usernames to enumerate valid resources. Common with user lookup, password reset, and search endpoints.
/api/check-email?email=test@...? Resource Exhaustion
Expensive operations (complex queries, large file processing, report generation) can be abused to consume server resources.
Financial Abuse
APIs that charge per request (SMS, email, payment processing) can be exploited for financial damage.
Data Exposure Vulnerabilities
APIs often return more data than the client needs, exposing sensitive information:
Excessive Data Exposure
API returns full user objects including password hashes, internal IDs, and private fields. Client filters what to display, but full data is in the response.
{"user": {"name": "John", "email": "...", "password_hash": "...", "ssn": "..."}}Verbose Error Messages
Stack traces, SQL errors, and internal paths revealed in error responses. Provides reconnaissance value for attackers.
{"error": "MySQL Error: Unknown column 'admin' in users table at /var/www/api/..."}Unprotected Debug Endpoints
Debug or development endpoints left active in production, exposing internal state or bypassing security.
/api/debug/config, /api/test/bypass-auth, /_debug/routesResponse Header Leakage
Server version, framework details, and internal infrastructure information in response headers.
X-Powered-By: Express, Server: nginx/1.14.0, X-Debug-Token: abc123API Penetration Testing Methodology
A structured approach keeps API testing consistent and makes coverage gaps visible:
API Discovery & Documentation
Gather API documentation (OpenAPI/Swagger, GraphQL schemas). Discover undocumented endpoints through traffic analysis, JavaScript files, and fuzzing. Build a complete endpoint inventory.
Authentication Analysis
Map authentication mechanisms (JWT, OAuth, API keys). Test token generation, validation, expiration, and revocation. Attempt authentication bypass techniques.
Authorization Testing
Test every endpoint with different user roles. Attempt BOLA/IDOR on all ID parameters. Test horizontal and vertical privilege escalation.
Input Validation
Test for injection vulnerabilities (SQL, NoSQL, command, LDAP). Test boundary conditions, type confusion, and parameter pollution.
Business Logic Analysis
Understand the business purpose of each endpoint. Test for workflow bypasses, state manipulation, and race conditions in multi-step processes.
Rate Limiting & Abuse
Test rate limits on authentication, sensitive operations, and resource-intensive endpoints. Attempt bypass techniques (IP rotation, header manipulation).
Essential API Testing Tools
The right tools make API testing efficient and thorough:
Burp Suite
Industry standard for API interception and testing. Extensions like Autorize automate authorization testing.
Postman
API development platform with testing capabilities. Great for building request collections and automation.
OWASP ZAP
Open-source alternative to Burp. API scanning with OpenAPI support and scripting capabilities.
ffuf/wfuzz
Fast fuzzing tools for endpoint discovery, parameter testing, and brute force attacks.
JWT.io / jwt_tool
Decode, test, and attack JWT implementations. Essential for modern API authentication testing.
sqlmap
Automated SQL injection detection and exploitation. Works with API endpoints via request files.
API Testing with ShieldProbe
ShieldProbe Assess tests REST, GraphQL and SOAP APIs within an agreed scope, using black-box or authenticated grey-box access and consultant-reviewed evidence:
OpenAPI and Postman Import
Upload an OpenAPI, Swagger or Postman file and ShieldProbe derives the endpoints to test from it. For a web application assessment, adding the spec for its backend API lets one run test both layers.
BOLA/IDOR Detection
ShieldProbe tests object-level authorization across the in-scope endpoints, using each role you supply, and the report records coverage and exclusions.
Business Logic Testing
ShieldProbe works from the roles and business rules you supply to probe the workflows it reaches. The report shows the behavior it demonstrated and the paths it did not test.
CI/CD Integration
ShieldProbe Continuous, in developer preview, runs selected tests when repository events you enable fire, such as a pull request.
Securing Your APIs
API security takes more than scanning. It takes understanding how APIs work and how attackers abuse them. Key takeaways:
- Authorization is critical. BOLA/IDOR tops the OWASP API Top 10 for a reason.
- Authentication isn't authorization. A valid token does not mean valid access.
- Rate limiting matters. APIs without limits invite credential stuffing and abuse.
- Inventory your APIs. You can't secure what you don't know exists.
- Test when things change. Set the cadence from risk, meaningful changes and the requirements that apply to you.
Plan your API assessment
We agree the endpoints, user roles, business workflows and permitted actions with you. A named consultant approves every Assess finding before you see it, and the report records coverage and limitations.
Source: OWASP API Security Top 10.
API assessment preparation
- Inventory API hosts, versions and specifications.
- Define who may access each object and operation.
- Prepare representative accounts, objects and workflow state.
- Agree side-effect limits and preserve request/response evidence.
Frequently asked questions
What is API penetration testing?
API penetration testing is security testing specifically focused on APIs (Application Programming Interfaces). It involves testing for vulnerabilities like broken authentication, authorization flaws, data exposure, and rate limiting issues that are unique to API architectures.
What is BOLA (Broken Object Level Authorization)?
BOLA is the #1 API vulnerability in the OWASP API Top 10. It occurs when APIs expose endpoints with object identifiers (like user IDs or order IDs) and attackers can manipulate these IDs to access resources belonging to other users. Example: GET /api/orders/12345 returns any order, not just the requester's orders.
What is the OWASP API Security Top 10?
The OWASP API Security Top 10 is the industry standard list of the most critical API security risks. It includes: Broken Object Level Authorization (BOLA), Broken Authentication, Broken Object Property Level Authorization, Unrestricted Resource Consumption, Broken Function Level Authorization, SSRF, Security Misconfiguration, and more.
How do you test API rate limiting?
Test API rate limiting by: sending rapid requests to endpoints and checking for 429 responses, testing authentication endpoints for brute force protection, verifying rate limits apply per-user not just per-IP, checking if rate limits can be bypassed with header manipulation, and testing resource-intensive endpoints for DoS vulnerabilities.