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)
1---2name: api-breaker3description: Automated API security testing starting from domains. Discovers REST, GraphQL, and SOAP APIs, reconstructs schemas, and tests for BOLA/IDOR, BFLA, mass assignment, JWT attacks, rate limiting bypass, and business logic flaws. Use when user asks to "test API security", "break API", "find API vulnerabilities", "test GraphQL", "test JWT", "API pentest", or provides domains with API endpoints. For authorized testing only.4---56# API Breaker78Intelligent API security testing. Discovers, maps, and exploits API vulnerabilities.910## Important1112CRITICAL: Only test APIs you have explicit authorization to test.1314## Instructions1516### Step 1: API Discovery1718```bash19python scripts/api_discovery.py --domain {target_domain}20```2122Discovery methods:231. **Path fuzzing**: /api/, /v1/, /v2/, /graphql, /rest/, /swagger.json, /openapi.json, /api-docs242. **JavaScript analysis**: Parse JS files for hardcoded API endpoints, base URLs, fetch/axios calls253. **Wayback Machine**: Historical API endpoints that may still be active264. **Common patterns**: /{resource}s, /{resource}/{id}, /{resource}/{id}/{subresource}275. **GraphQL detection**: /graphql, /graphiql, /playground, /api/graphql286. **Documentation endpoints**: Swagger, OpenAPI, WADL, WSDL2930For each discovered API:31- Record base URL, authentication method, content type32- Detect API standard (REST, GraphQL, gRPC-web, SOAP)3334### Step 2: Schema Reconstruction3536```bash37python scripts/schema_builder.py --api-base {api_url}38```3940Even without documentation:411. Send requests with varying parameters and observe responses422. Analyze error messages for expected field names/types433. Use OPTIONS/HEAD to discover allowed methods444. Test content negotiation (JSON, XML, form-encoded)455. GraphQL: Send introspection query to get full schema4647Output: Reconstructed API schema in OpenAPI format.4849### Step 3: Authentication Analysis5051```bash52python scripts/auth_analyzer.py --api-base {api_url}53```5455Detect and test:56- **JWT tokens**: Decode, test none algorithm, key confusion (RS256->HS256), weak secrets, claim tampering57- **API keys**: Test in different positions (header, query, body), check for key leakage58- **OAuth flows**: Test for open redirect in callback, token leakage, PKCE bypass59- **Session tokens**: Predictability, fixation, rotation on privilege change60- **No auth**: Endpoints accessible without any authentication6162### Step 4: Authorization Testing (BOLA/BFLA)6364```bash65python scripts/authz_tester.py --schema {schema_file} --token {user_token}66```6768**BOLA (Broken Object-Level Authorization):**69For every endpoint with an object ID:701. Create resource as User A, note the ID712. Access that ID as User B (different token)723. If User B can read/modify/delete User A's resource = BOLA7374**BFLA (Broken Function-Level Authorization):**751. Map endpoints by intended role (user vs admin)762. Test admin endpoints with regular user token773. Test all HTTP methods (GET, POST, PUT, DELETE, PATCH) on each endpoint7879### Step 5: Mass Assignment Testing8081```bash82python scripts/mass_assignment.py --schema {schema_file} --token {token}83```8485For each creation/update endpoint:861. Send normal request, note accepted fields872. Add extra fields: `role`, `isAdmin`, `price`, `discount`, `verified`, `approved`, `permissions`883. Check if extra fields are processed894. Test with nested objects: `{"user": {"role": "admin"}}`9091### Step 6: Rate Limiting and Resource Testing9293```bash94python scripts/rate_limiter.py --api-base {api_url}95```9697Test:98- Send 100+ rapid requests to each endpoint99- Check for 429 responses or rate limit headers100- If rate limited: test bypass via IP rotation headers (X-Forwarded-For, X-Real-IP)101- Test resource-intensive endpoints for DoS potential (large pagination, deep queries)102- GraphQL: Test query batching, nested query depth, alias-based multiplication103104### Step 7: Business Logic Testing105106```bash107python scripts/logic_tester.py --schema {schema_file} --token {token}108```109110Context-aware tests:111- **E-commerce**: Price manipulation, quantity overflow, currency confusion, coupon stacking112- **Financial**: Double spending via race conditions, negative amount transfer113- **User management**: Self-privilege escalation, email verification bypass, 2FA bypass114- **File handling**: Path traversal in file names, SSRF in URL fields, XXE in XML endpoints115116### Step 8: Report Generation117118```bash119python scripts/api_report.py --findings {findings_dir}120```121122Per-finding output:123- Vulnerability type and OWASP API Security Top 10 mapping124- Affected endpoint and method125- Request/response showing the issue126- curl command for reproduction127- Impact assessment128- Remediation recommendation129130## Error Handling131132### No API Documentation Found133If no Swagger/OpenAPI exists:1341. Schema reconstruction from observed behavior (Step 2)1352. Use error messages as hints for field discovery1363. Inform user of reduced coverage without docs137138### Authentication Required1391. Ask user for API token/credentials1402. Support: Bearer token, API key, Basic auth, OAuth token1413. Usage: `--token "Bearer abc123"` or `--api-key "key123"`142143### GraphQL Introspection Disabled144If introspection is blocked:1451. Use field suggestion: send partial queries, use error messages to discover fields1462. Use clairvoyance-style wordlist-based field discovery1473. Check for GraphQL Voyager/Playground on alternative paths148149## Examples150151### Example 1: Full API Assessment152User says: "Test the API at api.example.com"153154Actions:1551. Discover all endpoints1562. Reconstruct schema1573. Test auth, BOLA, BFLA, mass assignment1584. Test rate limiting1595. Generate comprehensive report160161### Example 2: GraphQL Security Audit162User says: "Audit the GraphQL API at example.com/graphql"163164Actions:1651. Send introspection query1662. Map all queries and mutations1673. Test authorization on each mutation1684. Test query depth/complexity limits1695. Test batching attacks1706. Report findings171172### Example 3: JWT Penetration Test173User says: "Test JWT security on the API"174175Actions:1761. Capture JWT from auth flow1772. Decode and analyze claims1783. Test none algorithm1794. Test RS256->HS256 confusion1805. Brute-force weak secrets1816. Test claim manipulation (user ID, role, expiry)