API Security Testing for CTF
The API Landscape in CTF
Modern applications expose business logic via REST, GraphQL, or gRPC APIs. CTF challenges often hide flags behind insecure API endpoints, making authorization bypasses, mass assignment, and injection common vectors.
Core Vulnerabilities (MITREβ―ATT&CK: T1071, T1190)
- Broken Object Level Authorization (BOLA): Manipulate resource IDs to access other users' data.
- Broken Function Level Authorization (BFLA): Call admin endpoints with a regular user token.
- Excessive Data Exposure: API returns more data than shown in UI, leaking flags.
- Injection (SQL, NoSQL, command): Unsanitized parameters exploited via Burp Suite.
Toolset
- Burp Suite Professional β Repeater, Intruder, and the builtβin JSON Web Token editor.
- OWASP ZAP β Automated API scanning with OpenAPI definition.
- Postman β Organize request collections and add dynamic variables.
- ffuf β Fast parameter fuzzing:
ffuf -w wordlist.txt -u https://target/api/FUZZ.
Methodology
- Enumerate the API spec (look for
/swagger.jsonorapi-docs). - Test authentication β verify tokens are validated on every request.
- Check authorization β replace IDs in JSON bodies to spot BOLA.
- Fuzz inputs β inject payloads in query, header, and body parameters.
- Review responses β search for flag strings or PII leakage.
Pakistani Case Study: Mobile Money APIs
Easypaisa and JazzCash expose transaction APIs for bill payments and fund transfers. In a CTF lab, you might receive a valid user JWT, then attempt an IDOR on the /api/v1/transfer endpoint by changing the recipientId. Successful exploitation reveals a hidden flag.
Do / Don't
- Do use Burp Suite's "Logger" to capture all HTTP traffic for later analysis.
- Donβt assume that HTTPS guarantees the endpoint is secure; encryption does not replace authorization checks.
- Do document each request/response pair that yields a flag, as required for writeβups.
Takeaway
Today, import the public Easypaisa sandbox API spec into Burp Suite, replay a transaction request, and replace the amount parameter with a negative value to test for validation flaws.
