---
schema_version: '1.0'
id: security-20261002-1fb6a5
title: 'CVE-2026-101917: PyJWT: PyJWKClient still amplifies unauthenticated JWKS fetches
  on unknown kid values (incomplete fix of CVE-2026-48524)'
url: https://osv.dev/vulnerability/PYSEC-2026-4140
url_hash: 1fb6a5cc4e56982ef31b1f75bedd5ddfb3a76ec951e9385a8d8ae8d8ae822c0c
canonical_url: https://osv.dev/vulnerability/PYSEC-2026-4140
source: osv:pypa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-101917
- PYSEC-2026-4140
- severity:CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- pyjwt
- PyPI
lang: en
published_at: '2026-10-01T16:38:40Z'
fetched_at: '2026-10-02T04:02:59.833886Z'
updated_at: '2026-10-02T05:19:38Z'
status: published
content_hash: 239f7dbacdd2b0f1f0c44ebfa29714cbc4371f800568044062a237a233ad05c0
content_changed_at: null
license_note: full
summary: 'PyJWT: PyJWKClient still amplifies unauthenticated JWKS fetches on unknown
  kid values (incomplete fix of CVE-2026-48524)'
summary_source: rss
summary_en: 'PyJWT: PyJWKClient still amplifies unauthenticated JWKS fetches on unknown
  kid values (incomplete fix of CVE-2026-48524)'
summary_omitted_reason: null
redistribution: true
keywords_en:
- amplifies
- Ben Stiller
- cve
- CVE-2026-101917
- CVE-2026-48524
- CVE-2026-87817
- fetches
- fix
- incomplete
- JWKS
- kid
- library vulnerability
- PyJWKClient
- pyjwt
- PyPI
- PYSEC-2026-4140
- severity:CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
- software security
- still
- unauthenticated
- unknown
- values
entities_en:
- name: Ben Stiller
  type: person
- name: CVE-2026-87817
  type: event
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE-2026-87817
  type: event
- name: Ben Stiller
  type: person
key_facts: []
related: []
related_auto:
- name: GitPython
  type: concept
  weight: 1.0
- name: hooks/pre-commit
  type: artifact
  weight: 1.0
- name: GitHub Security Advisory
  type: content
  weight: 1.0
computed_at: '2026-10-02T05:19:31Z'
---

# CVE-2026-101917: PyJWT: PyJWKClient still amplifies unauthenticated JWKS fetches on unknown kid values (incomplete fix of CVE-2026-48524)

## TL;DR
PyJWT: PyJWKClient still amplifies unauthenticated JWKS fetches on unknown kid values (incomplete fix of CVE-2026-48524)

## Key Points
- cve / CVE-2026-101917 / PYSEC-2026-4140 / severity:CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L / pyjwt / PyPI

## Details
**Severity:** CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
**Advisory:** PYSEC-2026-4140 (CVE-2026-101917)

**Details:**
Summary
CVE-2026-48524 (GHSA-fhv5-28vv-h8m8, "PyJWKClient unbounded JWKS endpoint requests via attacker-controlled kid values (DoS)") was fixed in 2.13.0 by stopping fetch_data() from clearing the cache on a fetch error. That closed one amplification path but did not add the mitigation the advisory's title implies: there is still no rate-limit, negative-cache, or minimum-refresh-interval for unknown kids.

At HEAD, get_signing_key(kid) (jwt/jwks_client.py:185-211), on any unknown kid, calls get_signing_keys(refresh=True), and refresh=True bypasses jwk_set_cache unconditionally and forces a fresh fetch_data(). The kid is read from the unverified token header (get_signing_key_from_jwt decodes with verify_signature=False), so no valid token and no authentication is required. lru_cache does not cache the raised exception, so even the same unknown kid repeated re-fetches on every call.

Affected
pyjwt <= 2.13.0 (the latest release; the patched release for CVE-2026-48524). No fixed version yet.

Proof of concept (verified on 2.13.0, cache enabled = realistic prod config)
import threading, http.server, socketserver, json
from jwt import PyJWKClient
hits = {'n': 0}
JWKS = json.dumps({"keys":[{"kty":"oct","kid":"real","k":"AAAA"}]}).encode()
class H(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        hits['n'] += 1
        self.send_response(200); self.send_header('Content-Type','application/json'); self.end_headers()
        self.wfile.write(JWKS)
    def log_message(self,*a): pass
srv = socketserver.TCPServer(('[127.0.0.1](https://127.0.0.1/)',0), H); port = srv.server_address[1]
threading.Thread(target=srv.serve_forever, daemon=True).start()
c = PyJWKClient(f'http://127.0.0.1/:{port}[/jwks](tg://bot_command?command=jwks).json', cache_keys=True, lifespan=3600)
for i in range(8):
    try: c.get_signing_key(f'attacker-unknown-kid-{i}')
    except Exception: pass
before = hits['n']
for _ in range(5):
    try: c.get_signing_key('same-unknown')
    except Exception: pass
print('distinct unknown kids: 8 -> fetches:', hits['n'])
print('same unknown kid x5 -> extra fetches:', hits['n'] - before)

Output:
  distinct unknown kids: 8 -> fetches: 9
  same unknown kid x5 -> extra fetches: 5
Each unknown kid forces a fresh JWKS fetch; a repeated identical unknown kid still re-fetches every time against an unexpired cache. No rate-limit or negative-cache.

Impact
One unauthenticated request -> one outbound JWKS HTTP fetch + full JSON parse on the victim server. An attacker floods tokens carrying junk kids, so the victim hammers its own JWKS/IdP endpoint (amplification: attacker -> victim -> IdP), exhausting victim CPU/sockets and potentially tripping the JWKS provider's rate-limit, causing an application-wide auth outage. This is the unauthenticated DoS the parent advisory is named for, still reachable after the 2.13.0 fix.

Suggested fix
Guard the forced refresh on unknown kids: negative-cache unknown kids for a short TTL, or enforce a minimum interval between forced JWKS refreshes, so a repeated or unknown kid cannot force unbounded fetches.

Note: the same-kid-repeated result (5 identical unknown kids producing 5 fetches against an unexpired cache) shows this is request amplification, not legitimate key-rotation handling, since that refresh can never succeed.

Reported by Babakizo (Securva).

## Maintainer update — 2026-09-10

The maintainer confirmed the reported behavior against PyJWT 2.13.0. With JWKS caching
enabled, an unknown `kid` previously forced an unconditional JWKS refresh,
including when the same unknown value was repeated while the cached key set was
still valid. This allowed unauthenticated token headers to cause unnecessary
outbound JWKS requests and repeated parsing work.

The fix is now on `master` in commit `ba4853a`. `PyJWKClient` now applies a
30-second cooldown after successful JWKS fetches before permitting another
unknown-`kid` refresh, serializes concurrent refresh decisions per client, and
allows callers to configure or disable the cooldown. Cache-disabled behavior
and immediate retry after failed fetches remain unchanged.

Regression tests cover repeated unknown kids, cooldown expiry, concurrent
misses, cache-disabled operation, and invalid cooldown values. The available
full tox matrix, Ruff, and mypy checks pass. The fix will be included in the
next released 2.x version.

## Maintainer update — 2026-09-11

The verified fix for this advisory is included in PyJWT 2.14.0, released on 2026-09-11 and available on PyPI. PyJWT 2.14.0 is the first release containing the fix. This advisory is now published with 2.14.0 recorded as the patched version.

**References:**
- https://github.com/jpadilla/pyjwt/security/advisories/GHSA-2gx3-rcp4-g85q
- https://nvd.nist.gov/vuln/detail/CVE-2026-101917
- https://github.com/jpadilla/pyjwt/commit/ba4853a75fb9676362da17f67d0f64bd18afd4e1
- https://github.com/jpadilla/pyjwt
- https://github.com/jpadilla/pyjwt/releases/tag/2.14.0
- https://pypi.org/project/pyjwt
- https://github.com/advisories/GHSA-2gx3-rcp4-g85q

_Data: OSV.dev (upstream: pypa) — https://osv.dev/vulnerability/PYSEC-2026-4140_

## Source
元記事: [CVE-2026-101917: PyJWT: PyJWKClient still amplifies unauthenticated JWKS fetches on unknown kid values (incomplete fix of CVE-2026-48524)](https://osv.dev/vulnerability/PYSEC-2026-4140) — published 2026-10-01T16:38:40Z
