API Breaker
Intelligent API security testing. Discovers, maps, and exploits API vulnerabilities.
Important
CRITICAL: Only test APIs you have explicit authorization to test.
Instructions
Step 1: API Discovery
python scripts/api_discovery.py --domain {target_domain}
Discovery methods:
- Path fuzzing: /api/, /v1/, /v2/, /graphql, /rest/, /swagger.json, /openapi.json, /api-docs
- JavaScript analysis: Parse JS files for hardcoded API endpoints, base URLs, fetch/axios calls
- Wayback Machine: Historical API endpoints that may still be active
- Common patterns: /{resource}s, /{resource}/{id}, /{resource}/{id}/{subresource}
- GraphQL detection: /graphql, /graphiql, /playground, /api/graphql
- Documentation endpoints: Swagger, OpenAPI, WADL, WSDL
For each discovered API:
- Record base URL, authentication method, content type
- Detect API standard (REST, GraphQL, gRPC-web, SOAP)
Step 2: Schema Reconstruction
python scripts/schema_builder.py --api-base {api_url}
Even without documentation:
- Send requests with varying parameters and observe responses
- Analyze error messages for expected field names/types
- Use OPTIONS/HEAD to discover allowed methods
- Test content negotiation (JSON, XML, form-encoded)
- GraphQL: Send introspection query to get full schema
Output: Reconstructed API schema in OpenAPI format.
Step 3: Authentication Analysis
python scripts/auth_analyzer.py --api-base {api_url}
Detect and test:
- JWT tokens: Decode, test none algorithm, key confusion (RS256->HS256), weak secrets, claim tampering
- API keys: Test in different positions (header, query, body), check for key leakage
- OAuth flows: Test for open redirect in callback, token leakage, PKCE bypass
- Session tokens: Predictability, fixation, rotation on privilege change
- No auth: Endpoints accessible without any authentication
Step 4: Authorization Testing (BOLA/BFLA)
python scripts/authz_tester.py --schema {schema_file} --token {user_token}
BOLA (Broken Object-Level Authorization): For every endpoint with an object ID:
- Create resource as User A, note the ID
- Access that ID as User B (different token)
- If User B can read/modify/delete User A's resource = BOLA
BFLA (Broken Function-Level Authorization):
- Map endpoints by intended role (user vs admin)
- Test admin endpoints with regular user token
- Test all HTTP methods (GET, POST, PUT, DELETE, PATCH) on each endpoint
Step 5: Mass Assignment Testing
python scripts/mass_assignment.py --schema {schema_file} --token {token}
For each creation/update endpoint:
- Send normal request, note accepted fields
- Add extra fields:
role,isAdmin,price,discount,verified,approved,permissions - Check if extra fields are processed
- Test with nested objects:
{"user": {"role": "admin"}}
Step 6: Rate Limiting and Resource Testing
python scripts/rate_limiter.py --api-base {api_url}
Test:
- Send 100+ rapid requests to each endpoint
- Check for 429 responses or rate limit headers
- If rate limited: test bypass via IP rotation headers (X-Forwarded-For, X-Real-IP)
- Test resource-intensive endpoints for DoS potential (large pagination, deep queries)
- GraphQL: Test query batching, nested query depth, alias-based multiplication
Step 7: Business Logic Testing
python scripts/logic_tester.py --schema {schema_file} --token {token}
Context-aware tests:
- E-commerce: Price manipulation, quantity overflow, currency confusion, coupon stacking
- Financial: Double spending via race conditions, negative amount transfer
- User management: Self-privilege escalation, email verification bypass, 2FA bypass
- File handling: Path traversal in file names, SSRF in URL fields, XXE in XML endpoints
Step 8: Report Generation
python scripts/api_report.py --findings {findings_dir}
Per-finding output:
- Vulnerability type and OWASP API Security Top 10 mapping
- Affected endpoint and method
- Request/response showing the issue
- curl command for reproduction
- Impact assessment
- Remediation recommendation
Error Handling
No API Documentation Found
If no Swagger/OpenAPI exists:
- Schema reconstruction from observed behavior (Step 2)
- Use error messages as hints for field discovery
- Inform user of reduced coverage without docs
Authentication Required
- Ask user for API token/credentials
- Support: Bearer token, API key, Basic auth, OAuth token
- Usage:
--token "Bearer abc123"or--api-key "key123"
GraphQL Introspection Disabled
If introspection is blocked:
- Use field suggestion: send partial queries, use error messages to discover fields
- Use clairvoyance-style wordlist-based field discovery
- Check for GraphQL Voyager/Playground on alternative paths
Examples
Example 1: Full API Assessment
User says: "Test the API at api.example.com"
Actions:
- Discover all endpoints
- Reconstruct schema
- Test auth, BOLA, BFLA, mass assignment
- Test rate limiting
- Generate comprehensive report
Example 2: GraphQL Security Audit
User says: "Audit the GraphQL API at example.com/graphql"
Actions:
- Send introspection query
- Map all queries and mutations
- Test authorization on each mutation
- Test query depth/complexity limits
- Test batching attacks
- Report findings
Example 3: JWT Penetration Test
User says: "Test JWT security on the API"
Actions:
- Capture JWT from auth flow
- Decode and analyze claims
- Test none algorithm
- Test RS256->HS256 confusion
- Brute-force weak secrets
- Test claim manipulation (user ID, role, expiry)