pentesting, updated
Test cross origin resource sharing
Check whether the CORS policy is more permissive than it should be, letting another origin read authenticated responses.
Goal
Confirm Access-Control-Allow-Origin never reflects an arbitrary origin alongside Access-Control-Allow-Credentials: true.
How to test
Send a request with an arbitrary Origin header and inspect the response:
curl -s -H "Origin: https://evil.com" -I https://example.com/api/account
What to look for
Access-Control-Allow-Origin echoing back the attacker’s arbitrary origin, combined with Access-Control-Allow-Credentials: true — this lets any site read the authenticated user’s data cross-origin.
Notes
A null-origin or regex-based allowlist (*.example.com matching notexample.com.evil.com) is a common, subtler version of the same bug.
References
- OWASP WSTG-CLNT-07 — Test Cross Origin Resource Sharing.