OAuth delegates authorization, not authentication. The authorization server makes a decision about a resource owner and hands a code or token to a client. Every weak comparison of redirect_uri, missing state, reusable code or accepted implicit token moves that handoff to an attacker-chosen origin.
The authorization endpoint sends credentials to whatever redirect_uri passes validation. Prefix matching, suffix matching, path-only checks and open redirects on the client let an attacker satisfy the check while receiving the code elsewhere. Without state binding, a victim can be logged into the attacker's account. Without PKCE or code binding, a stolen code can be exchanged. Implicit flow puts the token in the fragment, where attacker JavaScript reads it directly.
- Inspect the authorization request
- Bypass the redirect_uri policy
- Steal the code or implicit token at the attacker origin
- Read /api/me and capture the flag
Browser to client application
Where to look before you type a payload
The client sends the browser to /authorize with client_id, redirect_uri, scope, state and response_type.
The authorization server authenticates the user, checks consent and validates the redirect_uri against its registration.
The server sends a code or token to the redirect_uri. A weak comparison or open redirect sends it to the attacker.
The client posts the code and client credentials or PKCE verifier to /token in exchange for an access token.
Open one hint at a time. The first two build the model; the last two point at the boundary.
Hint 1
Start at the client page and capture the exact authorize request, including redirect_uri, state and response_type.
Hint 2
The lab tells you which redirect_uri validation mode is active; look for the comparison that is weaker than exact matching.
Hint 3
PKCE is not enforced. Steal the code at the attacker callback and exchange it without a verifier.
Hint 4 · near the answer
Exchange the code at /oauth/token, then call /api/me with the bearer token to capture the flag.
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 — PKCE That Was Never Required - Family: OAuth / OIDC - Lab ID: web-oauth-pkce-downgrade - Date: 2026-12-05 ## Workflow ### Observe - [ ] Open "PKCE That Was Never Required" and record the entry point, 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 the entry point, and the evidence it should use. - [ ] Use the clue as a constraint, not an answer: Report http://attacker.lab.localhost:3001/attack to the bot. The attacker page builds the malicious authorize URL and exchanges the result for the API secret. - [ ] 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 redirect_uri parameter. - [ ] 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 redirect_uri is reflected in an error page but the authorization server refuses to redirect there.
- The attacker can change redirect_uri only for a client they own, with no victim consent or data.
- State is missing but the flow is same-site and the impact is limited to a self-login, not another user's account.
Regression tests to name
- Exact redirect match: The authorization server rejects the request before issuing a code
- State is required: The client rejects the response and does not establish a session
- PKCE binding: The token endpoint rejects the exchange
- Compare redirect_uri with an exact registered value, including scheme, host, port and path; reject everything else.
- Require and validate state, bind codes to client and redirect_uri, enforce PKCE S256 for public clients, and use one-time codes.
- Prefer authorization code with PKCE; disable implicit and password grants for browser clients.
- Keep access tokens out of URLs, use short lifetimes and sender constraints, and validate issuer, audience and nonce in OIDC.
OAuth تفويض وليست مصادقة بحد ذاتها. الخطر الأكبر أن يقرر خادم التفويض إرسال الكود أو التوكن إلى عنوان يتحكم به المهاجم. تحقق من redirect_uri بمطابقة تامة، واشترط state وPKCE، واربط الكود بالعميل والعنوان، وأوقف implicit flow، وتحقق من issuer وaudience وnonce. لا تضع التوكنات في الروابط، واجعل الأعمار قصيرة.