Burp Suite API Testing: Security Testing REST and GraphQL APIs
Web application security testing with Burp is intuitive when there's a browser to proxy. API testing requires a different setup — no browser, no HTML rendering, just HTTP requests and JSON responses. Burp handles this well, but the workflow is different.
This guide covers authorized security testing only. Test APIs you own or have explicit permission to test.
Setting Up for API Testing
Option 1: Proxy Your API Client
The simplest approach: configure your API client to use Burp as a proxy.
Postman:
- Settings → Proxy → Manual proxy configuration
- Host:
127.0.0.1, Port:8080 - Disable SSL certificate verification OR install Burp's CA cert
cURL:
curl -x http://127.0.0.1:8080 --insecure https://api.example.com/usersPython requests:
import requests
proxies = {"http": "http://127.0.0.1:8080", "https": "http://127.0.0.1:8080"}
response = requests.get("https://api.example.com/users", proxies=proxies, verify=False)Once proxied, API requests appear in Burp's HTTP History just like browser traffic.
Option 2: Import an OpenAPI/Swagger Definition
Burp Professional can generate requests directly from an OpenAPI spec:
- Target → Site Map → right-click → Import OpenAPI definition
- Provide the spec URL or paste the JSON/YAML
- Burp generates requests for all defined endpoints
- Configure authentication and send requests to populate the site map
This is faster than proxying — you get coverage of all documented endpoints without manual browsing.
Option 3: Build Requests Manually in Repeater
For undocumented APIs or quick tests:
- Go to Repeater
- Set the target host/port
- Write the HTTP request directly:
POST /api/v1/users/123/profile HTTP/1.1
Host: api.example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...
Content-Type: application/json
{"name": "Test User", "bio": "Test bio"}Authentication Setup
Most APIs require authentication. Configure it once in Burp:
Bearer token (Repeater): Add the Authorization header to each request manually, or use Session Handling Rules to inject it automatically.
Session Handling Rules (Professional):
- Project → Session handling rules → Add
- Configure a rule that adds the token header to all in-scope requests
- Now every request Burp sends includes the auth token automatically — useful for scanning
OAuth flow: Configure Burp to handle OAuth redirects. Use the proxy to capture the token after login, then use that token in subsequent requests.
Testing Authentication and Authorization
API authentication vulnerabilities are common and high-impact.
Testing JWT Tokens
Install the JWT Editor extension from the BApp Store:
- Capture a request with a JWT
- Go to the JWT Editor tab in Repeater
- Try these attacks:
- Algorithm confusion (none): Change
algtononeand remove the signature — some libraries accept unsigned tokens - Algorithm confusion (RS256→HS256): Change the algorithm and sign with the server's public key as HMAC secret
- Weak secret brute force: Use
hashcatorjwt-crackeragainst a captured token
- Algorithm confusion (none): Change
Testing for IDOR (Insecure Direct Object Reference)
APIs frequently expose user or resource IDs:
GET /api/users/123/profile
GET /api/orders/456/details
GET /api/documents/789Test with Intruder:
- Capture a request with your own ID (e.g.,
123) - Send to Intruder → mark the ID position
- Use Numbers payload type: test IDs 1–1000
- Compare response lengths — longer responses may contain other users' data
- Look for 200 responses that return data (vs. 403/404)
Testing Horizontal vs Vertical Privilege Escalation
With two test accounts (User A and User B):
- Log in as User A, capture requests
- Take requests that modify or read User A's data
- Swap in User B's resource IDs
- Check whether User A can read/modify User B's data (horizontal escalation)
- If the API has role-based access, test whether low-privilege tokens can access high-privilege endpoints (vertical escalation)
Testing for Injection Vulnerabilities
API parameters are injection targets just like HTML form fields.
SQL Injection in API Parameters
Test URL parameters, JSON body fields, and headers:
{"user_id": "1 OR 1=1--"}
{"search": "' UNION SELECT * FROM users--"}
{"filter": {"id": {"$gt": "0"}}} // NoSQL injectionIn Repeater, modify parameters manually. For systematic testing, send to Intruder with an SQL injection wordlist.
Look for:
- SQL error messages in responses
- Response length changes (extra data returned)
- Different behavior compared to non-injected requests
Command Injection
Look for parameters that might be passed to system commands:
{"filename": "report.pdf; ls -la"}
{"ip": "127.0.0.1 | cat /etc/passwd"}
{"format": "pdf$(id)"}SSRF (Server-Side Request Forgery)
If the API accepts URLs (webhooks, image fetch, file import):
{"webhook_url": "http://169.254.169.254/latest/meta-data/"}
{"image_url": "http://internal.service/admin"}
{"callback": "http://your-burp-collaborator.burpcollaborator.net"}Use Burp Collaborator (Professional) to detect out-of-band SSRF — the target server makes a DNS/HTTP request to your Collaborator payload even if the response doesn't reveal it.
Testing GraphQL APIs
GraphQL presents a unique attack surface.
Introspection
First, check if introspection is enabled:
query {
__schema {
types {
name
fields {
name
}
}
}
}If it returns a full schema, you have a complete map of the API. This is a feature, not a bug, but production APIs sometimes leave it enabled inadvertently.
GraphQL Injection
Test string arguments for injection:
query {
user(id: "1 OR 1=1") {
name
email
}
}GraphQL Authorization
Test whether field-level authorization is enforced:
# With your user token, try accessing admin fields
query {
users {
id
email
passwordHash # Should be admin-only
internalNotes # Should be admin-only
}
}Scanning APIs in Burp Professional
After populating the site map via proxying or OpenAPI import:
- Right-click your target in Site Map → Actively scan this host
- Configure authentication in scan settings
- Review scan results in Target → Issues
The scanner tests all discovered parameters for injection, authentication issues, and security misconfigurations.
Organizing API Tests
As you test, annotate interesting requests:
- In HTTP History, right-click a request → Add comment
- Or Highlight with a color (right-click → Highlight)
Use colors consistently: red for confirmed vulnerabilities, orange for potential issues, yellow for interesting endpoints to revisit.
Reporting
After testing, generate a report:
- Target → Issues — select issues to include
- Right-click → Report selected issues
- Export as HTML for sharing with the development team
Each issue in the report includes the request/response evidence, severity, and remediation guidance.
Related:
For ongoing API functional monitoring (not security testing), HelpMeTest runs continuous API tests with plain-English scenarios and alerts on failures.