A command-line Python tool for API security testing with token discovery and vulnerability detection.
- CORS Testing: Detects wildcard CORS headers and misconfigurations
- Authentication Testing: Tests endpoints with various token states
- Token Discovery: Scans for exposed tokens in multiple locations
- Rate Limiting: Tests for proper rate limiting implementation
- Vulnerability Testing: Basic SQL injection and XSS detection
- OpenAPI Support: Parse and test endpoints from OpenAPI specifications
- JWT Validation: Decode and validate JWT tokens
git clone https://github.com/Joieux/api-security-tester.git
cd api-security-tester/standalone-toolpip install -r requirements.txt- Python 3.6+
- requests
- PyJWT
python api_security_tester.py https://api.example.compython api_security_tester.py https://api.example.com --token "Bearer abc123"python api_security_tester.py https://api.example.com --token-discoverypython api_security_tester.py https://api.example.com --endpoints /users /admin /healthpython api_security_tester.py https://api.example.com --openapi https://api.example.com/swagger.jsonurl: Target API base URL (required)--token, -t: Authentication token to test with--openapi, -o: OpenAPI specification URL--token-discovery, -d: Run token discovery only--endpoints, -e: Custom endpoints to test
The tool can discover tokens in various locations:
- API responses and headers
- Environment variables
- Configuration files (.env, config.json, etc.)
- Local files (JavaScript, JSON, YAML, etc.)
- Common config locations (~/.aws/credentials, ~/.ssh/config, etc.)
- JWT tokens
- API keys
- Bearer tokens
- GitHub tokens
- Slack tokens
- AWS access keys
- Generic secrets
- CORS Check: Identifies wildcard CORS headers
- Authentication Testing: Tests endpoints with different token states
- Token Variants: Tests expired, tampered, and valid tokens
- Rate Limiting: Attempts to trigger rate limits
- Common Vulnerabilities: Basic SQL injection and XSS testing
- Token Discovery: Scans for exposed tokens
The tool provides detailed output for each test:
[+]Indicates a positive finding or good security practice[!]Indicates a potential security issue[x]Indicates an error or failed test
This tool is designed for defensive security purposes only. Use it to:
- Test your own APIs
- Conduct authorized security assessments
- Identify potential security issues in development
Do not use this tool against systems you do not own or do not have explicit permission to test.