Skip to content
SecureKhan
Go back

API Penetration Testing: OWASP API Security Top 10 (2023) Explained

APIs have quietly become the most attacked surface in modern applications. Every mobile app, every microservice, every third-party integration—they all talk through APIs. And most of them are broken in predictable ways.

This post covers the OWASP API Security Top 10 (2023 edition), how I approach testing each one, and some real breaches that show why this stuff matters.

Part 2 of this series is a hands-on cheat sheet with actual commands you can use during testing.


Quick Reference

#VulnerabilityOne-Liner
API1BOLAChange object ID, access other users’ data
API2Broken AuthenticationJWT attacks, weak tokens, missing validation
API3Broken Object Property LevelMass assignment, excessive data exposure
API4Unrestricted Resource ConsumptionNo rate limits, DoS via expensive queries
API5BFLARegular user accessing admin endpoints
API6Unrestricted Access to Business FlowsAutomating purchases, referral abuse
API7SSRFFetch internal resources via URL parameters
API8Security MisconfigurationCORS, verbose errors, debug endpoints
API9Improper Inventory ManagementShadow APIs, unprotected old versions
API10Unsafe Consumption of APIsTrusting third-party data without validation

Why API Security is Different

Traditional web app testing focuses on things like XSS, CSRF, and session management. API testing overlaps but has its own flavor:


API1:2023 — Broken Object Level Authorization (BOLA)

TL;DR: Change an object ID in a request while keeping your auth token. If you get someone else’s data, it’s vulnerable.

This is the big one. Roughly 40% of all API attacks exploit BOLA.

AttackDetectDefend
Swap object IDs between usersAlert on user accessing >10 unique object IDs/minValidate object ownership on every request
Enumerate sequential/predictable IDsLog all object access with user + object contextUse indirect references (session-scoped mappings)
Test encoded IDs (base64, UUID)Monitor for horizontal access patternsImplement attribute-based access control (ABAC)

Testing Checklist

Where to Look
  • URL path parameters (/api/orders/9876)
  • Query strings (?user_id=42)
  • JSON request bodies ({"recipient_id": "5432"})
  • Headers (less common but happens)

API2:2023 — Broken Authentication

TL;DR: Forge or crack tokens, exploit weak JWT implementations, bypass authentication entirely.

This covers everything wrong with how APIs verify identity: weak JWT implementations, missing token validation, credential stuffing vulnerabilities.

AttackDetectDefend
JWT “none” algorithm attackAlert on tokens with alg=noneWhitelist allowed algorithms server-side
Algorithm confusion (RS256→HS256)Log algorithm mismatchesUse asymmetric keys, validate algorithm
Crack weak JWT secretsMonitor for high-volume token validation failuresUse strong secrets (256+ bits of entropy)
Replay expired/revoked tokensTrack token reuse after logoutImplement token blacklisting, short expiry
kid parameter injection (SQLi/path traversal)Log unusual kid valuesSanitize kid, use key lookup tables

Testing Checklist

JWT Attack Details

The “none” algorithm: Change "alg": "HS256" to "alg": "none" and delete the signature. Some servers accept this.

Algorithm confusion: If the server uses RS256 (asymmetric), try switching to HS256 (symmetric) and sign with the public key as the secret.

kid injection examples:

{"alg":"HS256", "kid":"key1' UNION SELECT 'secret'--"}
{"alg":"HS256", "kid":"../../../etc/passwd"}

API3:2023 — Broken Object Property Level Authorization

TL;DR: The API returns too much data or accepts fields it shouldn’t. Check responses for sensitive fields, try adding "role": "admin" to requests.

This combines two related issues: Excessive Data Exposure and Mass Assignment.

AttackDetectDefend
Inspect responses for sensitive fieldsLog response sizes, flag abnormally large payloadsReturn only necessary fields (DTO pattern)
Add privilege fields to requests (mass assignment)Alert on unexpected fields in requestsWhitelist allowed input fields
Modify read-only fields (price, balance, role)Track field modification patternsUse separate read/write models

Testing Checklist

Common Mass Assignment Fields
{"isAdmin": true}
{"role": "admin"}
{"permissions": ["read", "write", "delete"]}
{"verified": true}
{"credits": 99999}
{"discount": 100}
{"price": 0}
{"approved": true}

API4:2023 — Unrestricted Resource Consumption

TL;DR: No rate limiting, no pagination limits, no query complexity limits. Fire 100 requests and see if you get blocked.

AttackDetectDefend
Brute force login (no rate limit)Alert on >10 failed logins/min per user/IPImplement rate limiting with exponential backoff
Request excessive data (?limit=999999)Monitor response sizes and query timesEnforce max page size server-side
GraphQL depth/batching attacksTrack query complexity scoresImplement query depth and complexity limits
Resource exhaustion via expensive operationsMonitor CPU/memory spikes per endpointSet timeouts, limit concurrent requests

Testing Checklist

GraphQL Batching Bypass

Rate limiting often counts requests, not operations. This single request contains multiple login attempts:

mutation {
  a: login(user:"admin", pass:"pass1") { token }
  b: login(user:"admin", pass:"pass2") { token }
  c: login(user:"admin", pass:"pass3") { token }
}

API5:2023 — Broken Function Level Authorization (BFLA)

TL;DR: BOLA is about accessing other users’ data. BFLA is about accessing other users’ functions. Can a regular user hit admin endpoints?

AttackDetectDefend
Access admin endpoints with user tokenAlert on non-admin accessing /admin/* pathsImplement role-based access control (RBAC)
HTTP method tampering (GET→DELETE)Log method changes on same endpointValidate permissions per method
Discover internal/debug endpointsMonitor for 403s on sensitive pathsRemove or protect internal endpoints

Testing Checklist

Common Admin Paths
/api/admin/users
/api/admin/config
/api/internal/metrics
/api/debug
/api/management/users
/api/v1/admin/

API6:2023 — Unrestricted Access to Sensitive Business Flows

TL;DR: Can you script actions that should require human interaction? Automate purchases, abuse referrals, spam reviews.

AttackDetectDefend
Automate limited-item purchases (scalping)Detect rapid sequential purchasesImplement CAPTCHA, device fingerprinting
Abuse referral/promo codesTrack referral patterns, flag self-referralsOne-time use codes, user-code binding
Create fake accounts in bulkMonitor registration velocityEmail verification, rate limiting
Spam reviews/ratingsDetect duplicate content, timing patternsRequire purchase verification for reviews

Testing Checklist


API7:2023 — Server-Side Request Forgery (SSRF)

TL;DR: Any parameter that takes a URL is an SSRF candidate. Test with cloud metadata endpoints.

AttackDetectDefend
Fetch cloud metadata (AWS/GCP/Azure)Alert on requests to 169.254.169.254Block internal IP ranges
Scan internal portsMonitor for internal IP access patternsWhitelist allowed domains
Bypass URL filters (decimal IP, IPv6)Log URL normalization mismatchesValidate and normalize URLs server-side
Exfiltrate data via DNS/HTTP callbacksMonitor outbound DNS queriesDisable unnecessary URL fetching

Testing Checklist

URL Filter Bypasses
http://2130706433/           (decimal IP = 127.0.0.1)
http://[::1]/                (IPv6 localhost)
http://127.0.0.1%00@evil.com/
http://localhost%23@evil.com/
http://127.1/
http://0/

API8:2023 — Security Misconfiguration

TL;DR: The grab bag of “you left something open.” Test CORS, find exposed docs, trigger verbose errors.

AttackDetectDefend
Exploit CORS misconfigurationMonitor Origin header variationsWhitelist specific origins, avoid wildcards
Access exposed API documentationAlert on swagger.json/openapi.json accessProtect or remove docs in production
Extract info from verbose errorsLog error response patternsUse generic error messages
Exploit debug endpointsMonitor for debug/test path accessRemove debug code in production

Testing Checklist

CORS Vulnerability Check

Send request with Origin: https://evil.com. Vulnerable response:

Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true

Also test: Origin: null, Origin: https://target.com.evil.com


API9:2023 — Improper Inventory Management

TL;DR: Shadow APIs and forgotten versions. The new v2 has auth, but v1 is still running without it.

AttackDetectDefend
Access old API versions without authMonitor traffic to deprecated versionsDecommission old versions completely
Discover shadow/undocumented APIsTrack requests to unknown endpointsMaintain API inventory
Exploit beta/test endpointsAlert on non-production path accessIsolate test environments

Testing Checklist


API10:2023 — Unsafe Consumption of APIs

TL;DR: What happens when the API consumes external data? If it trusts third-party data without validation, inject payloads through the back door.

AttackDetectDefend
Poison webhook callback dataValidate webhook signaturesVerify webhook sources, validate payloads
Inject payloads via third-party integrationsMonitor for injection patterns in external dataSanitize all external input
Exploit trust in partner APIsLog third-party API response anomaliesApply same validation as user input

Testing Checklist


Real-World Breaches

Optus (2022) — 9.8 Million Records

This one had everything wrong:

  • A test API endpoint left publicly exposed
  • A 2018 coding error disabled access controls
  • Customer IDs were sequential (incrementing by 1)
  • No rate limiting
  • No authentication required

An attacker just iterated through IDs and downloaded everything. The breach led to a $1.5M ransom demand and new Australian cybersecurity legislation.

Parler (2021) — 70TB of Data

Researchers archived the entire platform before it went offline:

  • No authentication on public post APIs
  • Sequential post IDs enabled complete enumeration
  • No rate limiting
  • Raw media files retained GPS metadata
  • “Deleted” posts were only marked, not actually removed

The data was later used in legal investigations.

T-Mobile (2023) — 37 Million Customers

Attackers exfiltrated customer data over two months through a vulnerable API endpoint. The extended dwell time shows monitoring was inadequate—they had no idea someone was bulk-downloading their customer database.


My Testing Methodology

PhaseFocusTools
1. ReconnaissanceFind docs, enumerate endpoints, discover parametersKiterunner, Arjun, ffuf
2. AuthenticationJWT attacks, token lifecycle, signature validationjwt_tool, Burp
3. AuthorizationBOLA/BFLA testing across privilege levelsAutorize, manual testing
4. Input ValidationInjection testing adapted for JSON payloadsBurp Intruder, sqlmap
5. Business LogicWorkflow manipulation, race conditions, abuse scenariosTurbo Intruder, custom scripts

What’s Next

In Part 2, I break down each vulnerability into step-by-step testing commands you can use during engagements. It’s the practical cheat sheet I wish I had when I started learning this stuff.


Questions or feedback? Find me on GitHub.


Share this post on:

Previous Post
API Pentesting Cheat Sheet: Hands-On Commands for OWASP API Top 10
Next Post
Windows Privilege Escalation Guide