githubEdit

API Attacks

OWASP API Security Top 10 (2023)

Risk
Description

API1

Broken Object Level Authorization (BOLA/IDOR)

API2

Broken Authentication

API3

Broken Object Property Level Authorization

API4

Unrestricted Resource Consumption

API5

Broken Function Level Authorization (BFLA)

API6

Unrestricted Access to Sensitive Business Flows

API7

Server Side Request Forgery (SSRF)

API8

Security Misconfiguration (Injection)

API9

Improper Inventory Management

API10

Unsafe Consumption of APIs


API Recon & Enumeration

Swagger/OpenAPI Discovery

/swagger
/swagger-ui
/swagger-ui.html
/api-docs
/v1/api-docs
/v2/api-docs
/openapi.json

Common API Paths

Enumerate Your User Info

Enumerate All Users/Resources

Check API Versions (Improper Inventory)

  • Look for Swagger dropdown "Select a definition" for multiple versions

  • /api/v0/ often has no auth and exposes deleted/legacy data


BOLA / IDOR (API1)

  • Broken Object Level Authorization - access other users' data by manipulating IDs

  • CWE-639: Authorization Bypass Through User-Controlled Key

Identification

  • Look for endpoints with ID parameters: /api/v1/resource/{ID}

  • Note the difference between integer IDs vs GUIDs

  • Get YOUR ID first via /current-user endpoints, then try OTHER IDs

  • If endpoint accepts integer ID but your ID is a GUID = potential IDOR

Mass BOLA Abuse with Bash Loop

ffuf IDOR Enumeration

Bypassing Encoded/Hashed References

If IDs appear hashed (e.g., MD5):

Look in JavaScript source for hashing function:

IDOR via Information Disclosure Chain

  1. GET other user's UUID via info disclosure

  2. Use UUID to bypass access control on PUT/PATCH

  3. Modify their details or escalate to admin


Broken Authentication (API2)

  • CWE-307: Improper Restriction of Excessive Authentication Attempts

Identification

  • Test password policy by trying weak passwords (123456, password)

  • Check error messages for info disclosure (min length, requirements)

  • Look for rate limiting - try multiple failed logins rapidly

  • Check for OTP/Security Question endpoints

Password Brute Force with ffuf

Security Question Brute Force


Broken Object Property Level Authorization (API3)

  • Excessive Data Exposure (CWE-213) - API returns fields you shouldn't see

  • Mass Assignment (CWE-915) - Modify fields you shouldn't have access to

Identification - Excessive Data Exposure

  • Compare response fields to what a normal user should see

  • Look for: email, phoneNumber, passwordHash, internalID, balance

Identification - Mass Assignment

  • Look at PATCH/PUT endpoints - what fields can you update?

  • Try adding extra fields that exist in GET responses

Common Mass Assignment Fields

Test Mass Assignment


Unrestricted Resource Consumption (API4)

  • CWE-400: Uncontrolled Resource Consumption

Identification

  • Look for file upload endpoints

  • Test with large files - is there a size limit?

  • Test with wrong file types - is there extension validation?

  • Check where files are stored (wwwroot = publicly accessible)

Generate Large File for Upload DoS

Test File Upload Abuse

  • No file size validation = storage exhaustion DoS

  • No file type validation = malicious file upload

  • Check if uploaded files are publicly accessible


BFLA (API5)

  • CWE-200: Exposure of Sensitive Information to an Unauthorized Actor

  • Access endpoints without required roles

Identification

  • Note the required role in Swagger docs for each endpoint

  • Check YOUR roles with /api/v1/roles/current-user

  • Try endpoints you DON'T have roles for

Test All Privileged Endpoints


SSRF (API7)

  • CWE-918: Server-Side Request Forgery

Identification

  • Look for fields containing URI/URL (fileURI, documentURL, imageURL)

  • Check if you can PATCH/UPDATE these fields

  • Look for fields using file:// scheme in responses

File URI Scheme SSRF

Common SSRF Payloads

Retrieve SSRF Results


SQL Injection (API8)

  • CWE-89: Improper Neutralization of Special Elements used in SQL Command

Identification

  • Look for search/filter endpoints with string parameters

  • Endpoints like /api/v1/products/{Name}/count

  • Test with trailing apostrophe '

Test Payloads

API SQLi Payloads


Improper Inventory Management (API9)

Identification

  • Check Swagger UI dropdown "Select a definition" for multiple versions

  • Old versions often have NO authentication (no lock icons)

  • May expose deleted/legacy data including password hashes

Check for Old API Versions

Common Legacy Paths


JWT Manipulation

Decode JWT

JWT None Algorithm Attack

JWT Key Confusion

  • RS256 → HS256 downgrade

  • Use public key as HMAC secret


Useful Tools

jq Examples


Real Challenge Examples

Security Question Brute Force (API2)

SSRF via Profile URI Update (API7)

BOLA Mass Enumeration (API1)

Last updated