API testing · Headers
Account API trusts any website with the user’s cookies (CORS)
P1 · CriticalExperiencedHeaders
Want to find it yourself first? This page gives away the answer. Play this bug on a fake app screen and see if you can spot it in three tries.
The clue
Two of these headers are dangerous together.
Steps to reproduce
- Call /api/account with an Origin header from an unknown site
- Read the CORS headers in the response
Expected result
Only the app’s own domain is allowed when credentials are allowed
Actual result
Any Origin is echoed back with Allow-Credentials: true, so other sites can read account data
Why it matters
This is a critical (P1) bug. It can lose money, expose private data or stop people from finishing a key task. A bug like this should block a release and be fixed straight away.
Testing tip
Test CORS with a fake Origin. Echoing the origin plus allowing credentials lets any site act as the user.
How to find bugs like this
API bugs live in the JSON between the app and the server: wrong records returned, fields that leak private data, bad status codes and limits that are not enforced. When you test, try these checks:
- Read the whole response body, not only the status code.
- Ask for other users’ records on purpose.
- Look for fields that should never leave the server.
- Send values at and past every limit.