Skip to main content
LowAPIOWASP A07:2021CWE-1021

How to fix: OIDC discovery omits code_challenge_methods_supported

The authorization-server metadata advertises the authorization-code response type without PKCE support. code_challenge_methods_supported is the field a client reads to discover PKCE is available, and it is absent.

Why it matters

A conforming client decides whether to send a code_challenge based on this field. When it is absent, well-behaved client libraries skip PKCE, which leaves the authorization code unbound to the requesting client: an attacker who intercepts the code at the redirect (a custom URI scheme another app registered, a leaked Referer, a compromised proxy) can exchange it themselves.

The metadata may be understating the server, since many implementations accept a code_challenge without advertising it. That is exactly the problem: correctness now depends on every client hardcoding PKCE rather than on discovery. RFC 8414 defines the field and RFC 9700 requires PKCE for all authorization-code clients, public and confidential alike, so publishing it is the cheap half of the fix.

How to fix it

  1. 1Add "code_challenge_methods_supported": ["S256"] to the metadata document.
  2. 2Require a code_challenge on every authorization-code request at the server, and reject the plain method.
  3. 3In clients, enable PKCE explicitly rather than relying on discovery to turn it on.

Code examples

Metadata: advertise S256

JSON
{
  "issuer": "https://auth.example.com",
  "authorization_endpoint": "https://auth.example.com/authorize",
  "token_endpoint": "https://auth.example.com/token",
  "response_types_supported": ["code"],
  "code_challenge_methods_supported": ["S256"]
}

Check an issuer

bash
curl -s https://auth.example.com/.well-known/openid-configuration \
  | jq '{response_types_supported, code_challenge_methods_supported}'

References

Detected automatically by VulnRadar. The check id is api-oidc-discovery-pkce-not-advertised, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is OIDC discovery omits code_challenge_methods_supported?
VulnRadar rates this low severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id api-oidc-discovery-pkce-not-advertised, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does OIDC discovery omits code_challenge_methods_supported map to?
It maps to CWE-1021. In the OWASP Top 10 it falls under A07:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for oidc discovery omits code_challenge_methods_supported

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

OIDC discovery omits code_challenge_methods_supported | VulnRadar