A Practical Exploitation of a CORS Misconfiguration
The server reflected any Origin header in its CORS response and allowed credentials, so a malicious website could read authenticated responses from an internal SSO configuration endpoint. An attacker could steal sensitive SSO configuration data from a logged-in user.
medium.com
Published on medium.com
This write-up is about one of my most memorable findings. Not because it involved complex payloads or advanced exploitation chains, but because it demonstrated how a minor trust misconfiguration can quietly compromise an otherwise well-secured application.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The server dynamically reflected the Origin header without validation and allowed credentials, so any origin could read authenticated responses.
Impact
An attacker could read authenticated internal SSO configuration data cross-origin, which could be chained into account takeover.
What the attacker needed
Victim logged into the target application; victim visits attacker-controlled page; attacker-controlled domain
The fix
The server should never reflect the Origin header dynamically, should use a strict allowlist, should avoid Access-Control-Allow-Credentials by default, and should not expose internal or authentication-related endpoints to cross-origin requests.
How it was found
- Send an authenticated request to the SSO configuration endpoint to confirm it requires login.
- Remove the Origin header and observe no CORS headers are returned.
- Send a request with a legitimate origin and see it reflected in Access-Control-Allow-Origin.
- Replace the origin with an attacker-controlled one and see it reflected too.
- Check that Access-Control-Allow-Credentials is true and that cookies are sent automatically.
- Send a preflight OPTIONS request with the attacker origin and see it approved.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
CORS is a browser rule that lets a website say which other websites are allowed to read its responses. Here the server said 'any website' and also allowed cookies to be sent, so a bad website could read private data from the victim's logged-in session. The attacker just needed the victim to visit a malicious page while logged in.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.