☼
⌃
☰

API Testing Methodology

Table of Contents

A structured approach to testing APIs, focusing on the differences from standard web application testing. APIs expose application logic directly, often with weaker access controls and more sensitive data than the UI equivalent.

Related: OWASP API Security Top 10 Web Application Testing Methodology Burp Suite SQL Injection

1. Reconnaissance

Discover the API

APIs are often undocumented but discoverable.

SHELL
# Content discovery targeting common API paths
feroxbuster -u http://$IP \
  -w /usr/share/wordlists/seclists/Discovery/Web-Content/api/objects.txt \
  -x json

Common API paths to check manually:

/api/
/api/v1/
/api/v2/
/swagger/
/swagger.json
/openapi.json
/docs/
/redoc/
/.well-known/
/graphql

Documentation

If Swagger or OpenAPI documentation is exposed it maps the entire API surface automatically. Import into Burp Suite or use directly.

SHELL
curl http://$IP/swagger.json | python3 -m json.tool

Intercept Traffic

Browse the application normally with Burp Suite intercepting — the UI often calls API endpoints that aren't publicly documented.

2. Authentication Testing

API authentication is frequently misconfigured.

JWT Tokens

Check for weak signing, algorithm confusion, and missing validation.

SHELL
# Decode a JWT without verifying (base64)
echo <header.payload> | base64 -d

Common JWT attacks:

  • Algorithm set to none — remove signature entirely
  • alg confusion: switch RS256 to HS256 and sign with public key
  • Weak secret — crack with Hashcat mode 16500
SHELL
hashcat -m 16500 jwt.txt /usr/share/wordlists/rockyou.txt

API Keys

  • Check request headers: X-Api-Key, Authorization, X-Token
  • Check JavaScript files and source for hardcoded keys
  • Test if keys have excessive scope — try accessing other users' resources with your own key

OAuth

  • Check for state parameter missing (CSRF)
  • Open redirect in redirecturi
  • Token leakage in referrer headers

3. Endpoint Enumeration

Map all available endpoints and HTTP methods.

Parameter Discovery

SHELL
# Fuzz parameters on a known endpoint
ffuf -u http://$IP/api/v1/users?FUZZ=1 \
  -w /usr/share/wordlists/seclists/Discovery/Web-Content/burp-parameter-names.txt \
  -mc 200,201,400

Method Enumeration

Test each endpoint with all HTTP methods — APIs often expose unintended functionality on non-standard methods.

SHELL
curl -X OPTIONS http://$IP/api/v1/users -v

Methods to test: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS

Version Enumeration

Older API versions often lack security controls applied to current versions.

SHELL
ffuf -u http://$IP/api/FUZZ/users \
  -w /usr/share/wordlists/seclists/Discovery/Web-Content/api/api-versions.txt

4. Vulnerability Testing

Work through the OWASP API Security Top 10 as a checklist.

Broken Object Level Authorisation (BOLA/IDOR)

The most common API vulnerability. Test whether you can access other users' objects by manipulating IDs.

SHELL
# Access your own resource
curl -H "Authorization: Bearer $TOKEN" http://$IP/api/v1/users/1

# Try accessing another user's resource
curl -H "Authorization: Bearer $TOKEN" http://$IP/api/v1/users/2

Broken Function Level Authorisation

Test whether low-privilege users can access admin endpoints.

SHELL
# Try admin endpoints with a regular user token
curl -H "Authorization: Bearer $USERTOKEN" http://$IP/api/v1/admin/users

Mass Assignment

APIs sometimes bind request parameters directly to object properties, allowing unintended fields to be set.

SHELL
# Try adding role or admin fields to a registration/update request
curl -X POST http://$IP/api/v1/users \
  -H "Content-Type: application/json" \
  -d '{"username":"test","password":"test","role":"admin"}'

Injection

APIs are as vulnerable to injection as web apps — test all parameters for SQL Injection, Command Injection, and NoSQL injection.

SHELL
# NoSQL injection example
curl -X POST http://$IP/api/v1/login \
  -H "Content-Type: application/json" \
  -d '{"username":{"$gt":""},"password":{"$gt":""}}'

Excessive Data Exposure

Check whether API responses return more data than the UI displays. Sensitive fields are often present in the JSON but hidden in the frontend.

SHELL
curl -H "Authorization: Bearer $TOKEN" http://$IP/api/v1/users/1 \
  | python3 -m json.tool

Rate Limiting

Test whether authentication endpoints enforce rate limiting.

SHELL
# Send rapid repeated requests
ffuf -u http://$IP/api/v1/login \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"FUZZ"}' \
  -w /usr/share/wordlists/rockyou.txt \
  -mc 200

5. Documentation and Reporting

Document every endpoint tested, the method used, and the result. For confirmed vulnerabilities include:

  • The request and response demonstrating the issue
  • The impact — what data or functionality is exposed
  • A CVSS score via CVSS

Tips

  • Always check for Swagger/OpenAPI docs first — they save hours of manual enumeration
  • BOLA is the most common finding — test it on every endpoint that takes an object ID
  • API responses often contain more data than the UI shows — read the raw JSON