Application Programming Interfaces (APIs) are the connective tissue of modern software, enabling communication between different applications, services, and systems. However, their critical role also makes them prime targets for attackers. Insecure APIs can lead to data breaches, unauthorized access, and service disruption. Implementing a rigorous API security testing process is essential.
This checklist provides a comprehensive set of items to consider when testing the security of your APIs (RESTful, SOAP, GraphQL, etc.). It's designed to guide testers in systematically evaluating potential vulnerabilities.
API Security Testing Checklist
This checklist is organized by common vulnerability categories. Remember to tailor it to the specific architecture and context of the API under test.
1. Authentication
- [ ] Verify Authentication Mechanisms: Test all supported authentication methods (API Keys, OAuth 2.0, JWT, Basic Auth, SAML, etc.) for proper implementation and security.
- [ ] Check for Weak Credentials/Keys: Ensure API keys or credentials are not easily guessable, hardcoded in client-side code, or transmitted insecurely.
- [ ] Test Authentication Bypass: Attempt to access protected endpoints without valid credentials or tokens.
- [ ] Validate Token Handling:
- Check JWT signature validation (e.g.,
alg=none
attack). - Verify token expiration and revocation mechanisms.
- Ensure tokens are not susceptible to replay attacks.
- Check for sensitive information leakage within tokens.
- Check JWT signature validation (e.g.,
- [ ] Test Brute-Force Protection: Verify account lockout or throttling mechanisms on authentication endpoints.
2. Authorization (Access Control)
- [ ] Test for Broken Object Level Authorization (BOLA/IDOR): Attempt to access resources belonging to other users by manipulating identifiers (e.g., changing
/api/users/123/orders
to/api/users/456/orders
). - [ ] Test for Broken Function Level Authorization (BFLA): Attempt to access administrative functions or higher-privileged operations using a lower-privileged user's token/session. (e.g., a regular user trying to access
/api/admin/deleteUser
). - [ ] Verify Role/Permission Enforcement: Ensure users can only perform actions consistent with their assigned roles and permissions.
- [ ] Check Access Control Across Different HTTP Methods: Verify that authorization is consistently applied (e.g., a user might be allowed GET access but should be denied PUT/POST/DELETE).
3. Input Validation & Data Handling
- [ ] Test for Injection Flaws:
- SQL Injection (SQLi)
- NoSQL Injection
- Command Injection (OS Command Injection)
- LDAP Injection
- XML External Entity (XXE) Injection (especially for SOAP/XML-based APIs)
- [ ] Test for Cross-Site Scripting (XSS): Check if API responses reflecting user input can be manipulated to execute scripts in a user's browser (relevant if API data is rendered directly).
- [ ] Validate Input Data Types, Formats, and Lengths: Ensure the API properly rejects unexpected or overly large inputs. Test for buffer overflows.
- [ ] Test Parameter Tampering: Manipulate hidden fields, query parameters, headers, and body content to test for unexpected behavior.
- [ ] Check File Upload Security: If the API handles file uploads, test for unrestricted file types, sizes, and potential path traversal or remote code execution via malicious files.
4. Rate Limiting & Resource Management
- [ ] Test Rate Limiting Effectiveness: Verify that limits are enforced on API requests per user/key/IP address to prevent Denial of Service (DoS) and brute-force attacks. Check limits on authentication and resource-intensive endpoints.
- [ ] Test Resource Exhaustion: Check if requests can consume excessive memory, CPU, or other resources (e.g., large payloads, complex queries in GraphQL).
- [ ] Verify Pagination Security: Ensure pagination mechanisms cannot be bypassed or manipulated to retrieve excessive data.
5. Data Exposure & Security Misconfiguration
- [ ] Check for Excessive Data Exposure: Ensure API responses only return data strictly necessary for the function, avoiding exposure of sensitive internal details or PII.
- [ ] Verify Security Headers: Check for appropriate security headers (e.g.,
Content-Security-Policy
,Strict-Transport-Security
,X-Content-Type-Options
). - [ ] Test Information Leakage in Error Messages: Ensure error messages are generic and do not reveal sensitive system information (stack traces, database errors, internal paths).
- [ ] Check for Misconfigured CORS: Verify Cross-Origin Resource Sharing (CORS) policies are not overly permissive (e.g., allowing
*
origins unnecessarily). - [ ] Ensure HTTPS Enforcement: Verify the API enforces TLS/SSL encryption for all communication. Check for weak TLS configurations.
- [ ] Test API Versioning Security: Ensure older, potentially vulnerable API versions are disabled or properly secured.
6. Logging & Monitoring
- [ ] Verify Adequate Security Logging: Ensure security events (authentication success/failure, authorization failures, significant errors) are logged.
- [ ] Check for Sensitive Data in Logs: Ensure logs do not contain sensitive information like passwords, API keys, or PII.
Conclusion
This checklist provides a solid foundation for API security testing. However, effective testing requires more than just ticking boxes. It demands a deep understanding of the application's context, potential threat vectors, and the ability to think like an attacker. Combine automated scanning tools with manual testing techniques and integrate this checklist into your regular security assessment process to significantly improve the security posture of your APIs.
Disclaimer: This post represents the view of the individual author that wrote it and not necessarily the view of Rarefied Inc.
Looking for professional security testing?
Based on your interest in this topic, you might benefit from our specialized security services: