Drop code_challenge from the authorize request to test whether PKCE is actually enforced

PKCE only protects a public client if the authorization server refuses to redeem a code that was issued without a challenge. Many servers treat PKCE as optional and only check the verifier when a challenge happens to be present.

Start the flow with your own test account, but leave out the PKCE parameters:

code
GET /authorize?response_type=code&client_id=<client_id>&redirect_uri=<registered_uri>&state=<random>

Then exchange the code at the token endpoint with no verifier:

code
POST /token
grant_type=authorization_code&code=<code>&client_id=<client_id>&redirect_uri=<registered_uri>

Also try the downgrade: send code_challenge=<value>&code_challenge_method=plain, then redeem with code_verifier=<value>. If the server accepts plain when the client normally uses S256, an attacker who sees the challenge can reuse it as the verifier.

A token response with no verifier proves the check is missing. It only matters for public clients (mobile apps, SPAs) where a code can be intercepted through a custom URL scheme or a leaked redirect. For a confidential client that authenticates with a secret, it is usually informational. Use only your own test accounts and stay within scope.

Follow #authorization-code, #code-challenge, #oauth or #pkce for new tips like this one, on your notifications page and, if you choose, in a daily or weekly email.

Comments

No comments yet.