Threats

T1190

API Attacks — OWASP API Top 10

How attackers exploit API-specific vulnerabilities — broken object-level authorization, mass assignment, excessive data exposure, and API abuse. Detection patterns for API gateway logs, rate limiting, and response body analysis.

View on Graph

Why API Attacks Are the New Norm

Modern applications are API-driven. Every mobile app, single-page application, and third-party integration communicates via APIs. Traditional web application firewalls are designed for HTML forms and URL parameters — API traffic uses JSON/XML bodies, varied HTTP methods, and often lacks the referrer or user-agent patterns that WAFs expect.

  • APIs are a direct path to backend data. Authentication, authorization, and input validation must be implemented at the API level — but they often lag behind the front-end application’s security controls.
  • Traditional WAF rules often miss API attacks because the attack vector is in the JSON body, not in URL parameters.
  • API gateways (AWS API Gateway, Azure API Management, Kong, Apigee) provide logging and rate limiting, but detecting abuse requires understanding API-specific patterns.

MITRE ATT&CK maps API exploitation to T1190 (Exploit Public-Facing Application) and T1195 (Supply Chain Compromise) — APIs are a public-facing entry point to backend systems.


OWASP API Top 10 Overview

RankRiskAnalogy for Analysts
API1Broken Object Level AuthorizationUser changes {"user_id": 1234} to {"user_id": 5678} and accesses another user’s data
API2Broken AuthenticationWeak or no authentication on API endpoints — anyone with the URL can call it
API3Broken Object Property Level AuthorizationAttacker sets {"role": "admin", "is_admin": true} in a registration request
API4Unrestricted Resource ConsumptionAPI endpoint that returns unlimited records — no pagination means data extraction
API5Broken Function Level AuthorizationAttacker calls DELETE /api/admin/users because the endpoint is not protected by admin role check
API6Unrestricted Access to Sensitive Business FlowsAutomated API abuse — credential stuffing, coupon abuse, vote manipulation
API7Server Side Request ForgeryAPI endpoint accepts a URL parameter and fetches internal resources (see SSRF section)
API8Security MisconfigurationCORS misconfiguration, verbose error messages, unnecessary HTTP methods enabled
API9Improper Inventory ManagementOld API versions still running (/api/v2/user vs. /api/v1/user — v1 has a known vuln)
API10Unsafe Consumption of APIsApplication calls third-party APIs with user-controlled URLs or data — supply chain risk

API1: Broken Object Level Authorization (BOLA)

BOLA is the most common API vulnerability and the top risk in the OWASP API Top 10. It occurs when an API endpoint does not verify that the authenticated user is authorized to access the specific object they requested.

How BOLA Works

GET /api/v1/users/1234/profile
Authorization: Bearer token-for-user-1234

→ Returns Alice's profile (legitimate — user 1234 is accessing their own profile)

GET /api/v1/users/5678/profile
Authorization: Bearer token-for-user-1234

→ Returns Bob's profile (BOLA — user 1234 should not access user 5678's profile)

BOLA Attack Patterns

PatternRequest ExampleDetection
Sequential ID enumerationGET /api/users/1, GET /api/users/2, GET /api/users/3Multiple 200 responses for sequentially incrementing IDs
UUID enumerationGET /api/invoices/uuid-001, uuid-002, uuid-003Multiple valid responses for different UUIDs from same session
Path traversal in object IDGET /api/users/../../admin/usersPath traversal characters in API path parameter
POST body ID manipulationPOST {"order_id": 1001} → change to {"order_id": 1002}Different objects returned than expected for the authenticated user
Batch endpoint abuseGET /api/users?id=1001,1002,1003Batch API call returns multiple records not owned by the user
Multi-tenant ID collisionGET /api/tenant/42/invoices/1001 vs GET /api/tenant/43/invoices/1001Same resource ID from different tenant contexts

Detection — BOLA in API Gateway Logs

SPL query — detect sequential ID access from a single session:

index=api_gateway
| rex field=uri_path "/(?:users|accounts|profiles|invoices|orders|documents)/(?<object_id>\d+)"
| stats dc(object_id) as unique_objects, count as total_calls by client_ip, user_id, user_agent
| where unique_objects > 10
| eval alert = "MEDIUM — BOLA enumeration: " . client_ip . " accessed " . unique_objects . " different object IDs"
| table _time, client_ip, user_id, unique_objects, total_calls, user_agent, alert
| sort - unique_objects

KQL query — detect BOLA via Azure API Management logs:

ApiManagementGatewayLogs
| where Url matches regex @"\/api\/[^\/]+\/(users|accounts|orders)\/\d+"
| summarize UniqueObjects = dcount(Url), TotalCalls = count() by CallerIp, UserId
| where UniqueObjects > 10
| project TimeGenerated, CallerIp, UserId, UniqueObjects, TotalCalls

API2: Broken Authentication

API authentication failures include weak token generation, missing authentication on endpoints, and improper session management.

Common API Authentication Issues

IssueHow It Looks in LogsSeverity
Missing auth on endpoint200 response to GET /api/admin/users without Authorization headerCritical
Weak JWT secretJWT can be decoded using common secret keys (secret, password, supersecret)High
No token expiryToken never expires — reused months laterHigh
Token in URLGET /api/users?token=abc123 — token leaked in server logs, referrer headers, bookmarksMedium
Rate limiting bypassAuth endpoints have no rate limiting — unlimited brute force attemptsCritical
Improper password resetPassword reset token is predictable (timestamp-based, short numeric)High

Detection — API Authentication Issues

index=api_gateway
| search http_method="POST" uri_path="/api/*login*" OR uri_path="/api/*auth*" OR uri_path="/api/*token*"
| stats count by client_ip, uri_path, response_code, user_agent
| where count > 100
| eval alert = "HIGH — " . count . " auth attempts from " . client_ip . " — possible credential brute force"
| table _time, client_ip, uri_path, count, alert
| sort - count

API3: Broken Object Property Level Authorization (Mass Assignment)

Mass assignment (also called auto-binding) occurs when an API endpoint binds client-provided data directly to internal objects without filtering which fields can be modified.

How Mass Assignment Works

The API accepts a JSON body and saves it to a database object directly:

POST /api/users/register
Legitimate: {"username": "alice", "email": "alice@example.com", "password": "s3cur3"}

Attack:     {"username": "alice", "email": "alice@example.com", "password": "s3cur3", "role": "admin", "is_admin": true}

→ The API saves all fields — Alice is now an admin

Mass Assignment Attack Patterns

Attack FieldTarget ModelImpact
"role": "admin"User modelDirect privilege escalation
"is_admin": trueUser modelBoolean privilege flag
"credit": 1000000Account modelBalance manipulation
"verified": trueUser modelBypass email verification
"email": "attacker@evil.com"User modelAccount takeover via email change
"group_ids": [1, 2, 3]User modelAdd user to privileged groups
"subscription": "premium"Subscription modelFree service upgrade
"deleted": falseContent modelRestore deleted content

Detection — Mass Assignment

index=api_gateway
| search http_method="POST" OR http_method="PUT" OR http_method="PATCH"
| search request_body IN ("*role*:*admin*", "*is_admin*:true", "*verified*:true", "*is_verified*:true", "*permissions*:*admin*")
| stats count by client_ip, uri_path, request_body
| eval alert = "HIGH — Possible mass assignment to " . uri_path . " from " . client_ip
| table _time, client_ip, uri_path, request_body, alert

API4: Unrestricted Resource Consumption

APIs that do not enforce rate limiting, pagination, or payload size limits allow attackers to exhaust server resources or extract large datasets.

Attack Vectors

VectorPatternImpact
No paginationGET /api/users returns all 100,000 users in one responseData extraction — attacker crawls all records
No rate limitingPOST /api/login with 10,000 requests per secondBrute force, credential stuffing
Large payloadPOST /api/upload with 1GB fileDoS via memory/disk exhaustion
Expensive queriesGET /api/search?q=a&q=aa&q=aaa or GET /api/reports?dateRange=2000-01-01..2026-12-31CPU exhaustion from unoptimized queries
Batch abusePOST /api/batch with 1000 sub-requests in a single callAmplification attack
GraphQL depth attackNested GraphQL query: { posts { comments { user { posts { comments { user { ... } } } } } } }Recursive query DoS

Detection — Resource Exhaustion

KQL query — detect large API responses (data extraction):

ApiManagementGatewayLogs
| where ResponseBodySize > 5000000 (5 MB responses)
| summarize count() by CallerIp, Url, ResponseBodySize
| where count_ > 10
| project TimeGenerated, CallerIp, Url, ResponseBodySize, count_

SPL query — detect GraphQL depth attacks:

index=api_gateway source="graphql"
| eval query_depth = len(mvfilter(match(query, "\{"))) (count of opening braces)
| where query_depth > 10
| eval alert = "HIGH — GraphQL query depth " . query_depth . " from " . client_ip . " — possible recursive DoS"
| table _time, client_ip, query_depth, query
| sort - query_depth

API5: Broken Function Level Authorization

BFLA occurs when API endpoints do not enforce role-based access. An authenticated user can call admin-level API functions.

BFLA Examples

EndpointUnauthorized AccessImpact
DELETE /api/users/1234Any authenticated user can delete usersAccount deletion abuse
PUT /api/config/smtpAny authenticated user can modify configSMTP config hijacking for phishing
POST /api/admin/usersAny user can create admin accountsPrivilege escalation
GET /api/v2/admin/audit/logsv2 had auth, v1 does not — attacker uses v1Log access via old API version
PATCH /api/users/{id}/permissionsUser modifies their own permissionsSelf-elevation

Detection — BFLA

index=api_gateway
| search http_method IN ("DELETE", "POST", "PUT", "PATCH") uri_path IN ("*/admin/*", "*/config/*", "*/permissions/*", "*/roles/*", "*/delete*")
| stats count by client_ip, user_id, http_method, uri_path, response_code
| where response_code = 200
| eval alert = "HIGH — " . user_id . " called admin function " . http_method . " " . uri_path . " — verify authorization"
| table _time, client_ip, user_id, uri_path, response_code, alert

API6: Unrestricted Access to Sensitive Business Flows

Attackers abuse business-critical API endpoints at high volume — credential stuffing (login API), coupon abuse (discount API), vote manipulation, or reservation bots.

Detection — Business Flow Abuse

Key indicators:

  • High call volume to a single endpoint from a single IP or IP range
  • Low time between requests — faster than humanly possible
  • Repetitive request patterns with incremental changes (sequential IDs, cyclic values)
  • Call volume that spikes and stays elevated — not bursty like legitimate traffic

SPL query — detect credential stuffing via login API:

index=api_gateway
| search uri_path IN ("*/login*", "*/auth*", "*/token*")
| stats count by client_ip, uri_path, bin(_time, 60s)
| where count > 20 (20 login attempts per minute = credential stuffing)
| eval alert = "HIGH — " . count . " login attempts in 60s from " . client_ip . " — credential stuffing"
| table _time, client_ip, uri_path, count, alert

API Specific Detection Techniques

API Gateway Logs

API gateway logs (AWS API Gateway, Azure API Management, Kong, Nginx, Cloudflare) are the primary detection source. Key fields:

FieldWhat It ShowsDetection Use
httpMethodGET, POST, PUT, PATCH, DELETE, OPTIONSUnexpected methods on sensitive endpoints
pathFull API pathPath traversal, old API versions
requestBodyJSON/XML payloadParameter tampering, mass assignment
responseBodyJSON/XML responseExcessive data exposure
statusCodeHTTP response code200 to admin endpoints from non-admin users
integrationLatencyBackend response timeSlow responses = time-based exploitation
callerIpSource IPKnown bad IPs, unexpected geolocation
userAgentClient identifierAutomation tooling, missing browser headers
authProviderAuth mechanismMissing auth, expired tokens

JSON Schema Validation

API gateways can validate JSON payloads against a schema. Schema validation catches:

  • Extra fields in the request body (mass assignment attempts)
  • Wrong data types (string instead of number, null in required fields)
  • Fields outside allowed ranges (negative amounts, future dates)
  • Missing required fields (bypassing security-critical parameters)

API Attack Investigation Workflow

Phase 1: Identify Which API Endpoint Was Targeted

FindingWhat It Suggests
Sequential ID enumeration on a user endpointBOLA — attacker testing object-level authorization
POST {"role": "admin"} to registrationMass assignment — attacker trying to escalate privileges
2000 requests/minute to loginCredential stuffing or brute force
No Authorization header on admin endpointsMissing authentication — the endpoint was unprotected

Phase 2: Determine Data Exposure

Log PatternData Exposed
Large response bodies (5MB+)Full dataset extraction — no pagination
200 status on sequential IDsEach response = a different user’s data
GraphQL introspection query in logs__schema query = attacker mapping the full API schema
Error messages showing stack traces (ORA-00942, SQLSTATE)Database structure exposed via verbose errors

Phase 3: Containment

ActionImplementation
Rate limit the endpointAPI Gateway rate limiting — XX requests per IP per minute
Block the IPWAF IP block rule
Invalidate tokensForce re-authentication for affected users
Audit the endpointReview API code for authorization checks
Disable old API versionsRemove /api/v1/ endpoints that lack auth

Sources