CORS is a browser read gate, not authentication. Ask who is allowed to read the response and whether the server echoes that decision back to the caller.
The browser enforces the same-origin policy and asks the server whether another origin may read a response. If the server reflects any Origin and allows credentials, a malicious origin can read authenticated data even though it cannot steal the cookie.
- Inspect the CORS response headers
- Read the API from the attacker origin with credentials
- Exfiltrate the secret to /collect
- Capture the flag
Browser origin to API origin
Where to look before you type a payload
A page on origin A makes a fetch to origin B, optionally with credentials.
For non-simple requests, the browser asks B which origins, methods and headers are allowed.
B returns Access-Control-Allow-Origin and Allow-Credentials. A wildcard cannot be combined with credentials.
If the browser accepts the response, JavaScript on A can read the body; otherwise it can still send the request.
Open one hint at a time. The first two build the model; the last two point at the boundary.
Hint 1
Inspect the API response headers.
Hint 2
Check whether the Origin is reflected and credentials are allowed.
Hint 3
The API reflects any Origin and allows credentials. Report http://attacker.lab.localhost:3001/attack?endpoint=/api/v1/profile.
Hint 4 · near the answer
Report the attacker URL with endpoint=/api/... and let /collect receive the body.
Observe → Hypothesize → Test → Prove → Explain
This is the same loop a reviewer expects in a report. Your draft stays in this browser; nothing is submitted until you choose to export it.
Evidence log
Write for a reviewer who was not in the room. Every claim needs a request, response or state change behind it.
Preview the evidence report
# Lab evidence report — Profile API Credentials Leak - Family: CORS Misconfiguration - Lab ID: web-cors-profile - Date: 2026-12-05 ## Workflow ### Observe - [ ] Open "Profile API Credentials Leak" and record /api/v1/profile, the HTTP method and the role you are given. - [ ] List every parameter, header, cookie and object identifier the normal flow exposes. - [ ] Save a baseline response: status, body shape, timing and the fields that change by user. ### Hypothesize - [ ] Name the server decision that protects /api/v1/profile, and the evidence it should use. - [ ] Use the clue as a constraint, not an answer: Report http://attacker.lab.localhost:3001/attack?endpoint=/api/v1/profile to the bot. The attacker page fetches it with credentials and sends the body to /collect. - [ ] Predict the exact status, body or state change that would prove the decision is missing. ### Test - [ ] Start from the baseline and change one value: the /api/v1/profile response headers. - [ ] Keep the request replayable; vary encoding, method or identifier location only after the first result. - [ ] Capture the full request and response for the winning attempt, including the flag. ### Prove - [ ] Capture the flag and name the exact foreign object, role or state change it proves. - [ ] Repeat from a clean session and confirm the result is not cached or stale. - [ ] State impact precisely: what data or action did you actually obtain? ### Explain - [ ] State the root cause without naming the payload: which decision failed? - [ ] Name the control that prevents recurrence and the layer where it belongs. - [ ] Write one regression test that fails before the fix and passes after it. ## Evidence ### Target and baseline _Not recorded._ ### Hypothesis _Not recorded._ ### Winning request _Not recorded._ ### Proof _Not recorded._ ### Root cause _Not recorded._ ### Control and regression test _Not recorded._ ## Analyst conclusion The proof demonstrates the missing control above. The regression test should fail against the vulnerable behavior and pass after remediation.
The full request, the reasoning and the debrief unlock after a successful capture. That is deliberate: struggle first, then consolidate.
False positives to rule out
- The API returns ACAO: * but no credentials: an unauthenticated public endpoint may be intentionally readable.
- A preflight is allowed but the actual request fails: check the exact methods and headers.
- curl shows the body: curl ignores CORS; browser enforcement is the security boundary.
Regression tests to name
- Foreign origin: No ACAO is returned and the browser cannot read the body
- Exact allowlist: The exact origin is returned with credentials and Vary: Origin
- Subdomain: The server does not trust it automatically
- Use an exact allowlist of trusted origins, not suffix or regex matching.
- Do not enable credentials unless the endpoint truly needs them.
- Validate Origin on the server and return Vary: Origin for caches.
- Keep sensitive APIs same-origin or require a separate, scoped token.
CORS ليست مصادقة، بل إذن قراءة يمنحه الخادم للمتصفح. انعكاس أي Origin مع credentials يسمح لموقع مهاجم بقراءة بيانات الجلسة دون سرقة الكوكي.