PyJWKClient unbounded JWKS endpoint requests via attacker-controlled kid values (DoS)
[!NOTE] The vulnerability surfaces only when a JWKS fetch fails; an attacker can attempt to provoke that with sustained unknown-kid traffic, but the outcome depends on upstream JWKS-endpoint behavior (rate limiting, transient errors) which is beyond the attacker's control. Impact is reduced auth availability until the next successful fetch, not complete denial of service.
Summary
PyJWKClient.get_signing_key() forces a fresh HTTP request to the JWKS endpoint for every JWT with an unknown kid value, with no rate limiting. Since kid comes from the unverified token header, an attacker can trigger unlimited outbound requests.
Additionally, fetch_data() finally block clears the JWKS cache on network error.
Root Cause
jwt/jwks_client.py:172-198 - get_signing_key(kid) calls get_signing_keys(refresh=True) for unknown kids, bypassing TTL cache with no cooldown. jwt/jwks_client.py:120-122 - finally block writes None to cache on error, clearing valid data.
Impact
- DoS against JWKS endpoint (unlimited requests per invalid token)
- DoS against application (network I/O latency)
- Cascading failure (rate limiting clears cache, breaking legitimate auth)
Suggested Fix
- Add refresh cooldown (refuse refresh more than once per TTL period)
- Move cache write from finally to else block
Affected Versions
All versions with PyJWKClient (2.4.0 through 2.12.1)
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| Python (PyPI) | pyjwt | >= 2.0.0, < 2.13.0 | 2.13.0 |
References
- CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L- Weakness (CWE)
CWE-460, CWE-755- Platform
- Python (PyPI)
- Package
pyjwt- Disclosed
- 28.05.2026
- Updated
- 11.10.2026 15:17
Sources and licenses
OSV / GitHub Advisory Database - PYSEC-2026-177 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-fhv5-28vv-h8m8 - CC BY 4.0
Vulnerability history: pyjwt
All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 24
- First → latest
- 08.2017 09.2026
- Without a fix
- 2
- Exploited in attacks
- 0
Severity breakdown
- Critical 1
- High 10
- Medium 11
- Low 2
Disclosures per year
- 2017: 1
- 2018: 0
- 2019: 0
- 2020: 0
- 2021: 0
- 2022: 1
- 2023: 0
- 2024: 1
- 2025: 1
- 2026: 20
-
PyJWKClient unbounded JWKS endpoint requests via attacker-controlled kid values (DoS) this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.