/

CVE-2026-102267

Severity:

HIGH RISK

(7.4)

JWKS Redirect Validation (CWE-918) in PyJWT PyJWKClient

CVE-2026-102267

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery

CWE:

CWE-200, CWE-345, CWE-918

Impact:

Credential Disclosure and Verification Key Substitution

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PyJWT's PyJWKClient may follow an attacker-influenced redirect from a configured JWKS endpoint without revalidating the destination against the trusted JWKS boundary. This can cause forwarded credentials to be disclosed or allow redirected content to be consumed as verification key material when the trusted endpoint can be influenced.

Affected context

The issue occurs in applications that use PyJWT's PyJWKClient to retrieve JSON Web Key Sets from remote endpoints and trust the initial endpoint configuration. Risk increases when that endpoint, its responses, or an intermediary can influence redirect destinations, because the redirected location may fall outside the intended JWKS trust boundary.

Exploit preconditions

  • Attack surface: Server-side JWKS retrieval performed by PyJWKClient - Required access: Ability to influence the trusted JWKS endpoint or

cause it to return an attacker-controlled redirect

  • Trigger point: JWKS retrieval during JWT verification or key refresh - Why exploitation is possible: Redirect targets are followed without

sufficient revalidation, allowing responses from an unintended location to

be treated as trusted key material

Why this happens

The underlying bug is incomplete validation of redirects in a server-side HTTP request flow. The client establishes trust in the original JWKS endpoint but does not reapply that trust decision to the final redirect destination. This behavior maps primarily to CWE-918, Server-Side Request Forgery, and may also involve CWE-200 through unintended information disclosure and CWE-345 when untrusted key material is accepted as authentic.

Potential impact

  • Authentication-related credentials may be disclosed to an unintended endpoint
  • Verification keys could be substituted with attacker-controlled material
  • JWT signature validation may be undermined
  • Requests may reach internal or otherwise restricted network locations
  • Applications could make trust decisions using untrusted key metadata

General mitigation guidance

Mitigation generally focuses on enforcing the JWKS trust boundary throughout the complete request lifecycle. Secure-by-default patterns include allowing redirects only when the final destination remains within an explicitly approved origin set, or disabling redirects for key retrieval when they are unnecessary. Applications can reduce input trust by validating schemes, hosts, ports, and resolved addresses, isolating outbound requests, limiting forwarded headers and credentials, and treating retrieved key material as untrusted until it satisfies strict schema and provenance checks. Network egress controls and least-privilege service identities can limit impact if a request is misdirected.

How teams detect issues like this

Detection approaches include static analysis and code review checks for HTTP clients that automatically follow redirects without validating the final URL. Reviewers can look for missing origin allowlists, unrestricted redirect handling, credential forwarding across redirects, and JWT verification logic that accepts key material solely because it was returned by a redirected request. Runtime monitoring can alert on JWKS requests to unexpected domains, private address ranges, unusual ports, or changes in established endpoint identity. Automated security review tools may help identify these patterns in dependency and application code.

Sources

SourceLink
github.comgithub.com/jpadilla/pyjwt/commit/0a795b8e1f6ef08f634aa7086fc41cc6d5ce3e56
github.comgithub.com/jpadilla/pyjwt/releases/tag/2.14.0
github.comgithub.com/jpadilla/pyjwt/security/advisories/GHSA-9v7f-9g4p-ffgj

Frequently asked

questions

It can be exploitable through a server-side JWT verification flow when an

attacker can influence the configured JWKS endpoint or make that endpoint

return a malicious redirect. It is not generally triggered by a JWT alone.

The attacker needs control or influence over the JWKS retrieval path, such as

an attacker-controlled endpoint, compromised intermediary, or configuration

that permits an untrusted endpoint.

Enforce destination validation after every redirect, preferably restrict

JWKS retrieval to an explicit origin allowlist, and avoid forwarding

credentials to destinations that have not been independently trusted.

Define explicit outbound trust boundaries, test redirect behavior, constrain

network egress, validate key provenance and schema, and monitor JWKS requests

for unexpected destinations.

Find out what's already
exploitable in your codebase.