Blog / A07:2021 Identification and Authentication Failures
A07:2021 · Identification and Authentication Failures

A legacy token path that skips PKCE entirely

An old token endpoint still redeems authorization codes with no PKCE check and no sender binding. Intercept a code and it is yours to spend.

POST code tolegacy endpointrequest routed tothe old pathno PKCE verifierrequiredcode exchangedfor tokensATTACKER INPUTIMPACTcheck absent
Attack path · POST code to legacy endpoint → request routed to the old path → no PKCE verifier required → code exchanged for tokens

An old token endpoint still redeems authorization codes with no PKCE check and no sender binding. Intercept a code and it is yours to spend.

What goes wrong

PKCE exists so that an authorization code, on its own, is useless. The client proves it started the flow by presenting a secret that matches the challenge it sent earlier. Strip that check and the code becomes a bearer secret again, which is exactly what PKCE was meant to end.

This endpoint routes to an older code path that passes a null proof and never asks for the verifier. Any code that reaches it is redeemed on presentation alone. Authorization codes leak more often than people expect: a logged redirect here, a malicious app registered for the same URI there. On a mobile or single-page client with no client secret, the code is often the only thing between an attacker and a token.

The pattern

Vulnerable
function handleToken(form) {
  const req = toTokenRequest(form)
  req.proof = null                    // no sender binding
  // legacy path never compares a verifier to the stored challenge
  return exchange(req, { path: "legacy" })
}
Hardened
function handleToken(form) {
  const req = toTokenRequest(form)
  if (!form.code_verifier) throw new Error("PKCE required")
  verifyChallenge(form.code_verifier, storedChallengeFor(form.code))
  req.proof = requireProofOfPossession(form)   // sender-constrained
  return exchange(req)                          // one current path
}
How the pipeline adjudicated itHELD
ABCDEFGH

Grounding and reachability were confirmed. The exploit-path gate would not conclude without the calling code, so the finding was held and an evidence request was raised instead of being reported as fact.

Ed25519 · per-tenant signing key · gate ledger A–H · verify offline against the published payload hash

Why it matters to you

Interception attacks on authorization codes are not theoretical, and public clients are the ones that get hit. If any live client can still be pointed at this endpoint, your PKCE enforcement is optional, which means it is not enforcement.

Retire the legacy path, or hold it to the same proof the current one demands. There is rarely a good reason to keep a second, weaker way to do the most sensitive exchange in the whole protocol.

Check your own code