Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. PyJWT
  4. ›
  5. CVE-2026-102265

CVE-2026-102265: PyJWT: Uncaught RecursionError in jwt.decode() on deeply nested token header

September 29, 2026

PyJWS._looad() (jwt/api_jws.py:337) splits the compact token, base64url decodes the header segment and hands it to json.loads() before _verify_signature() runs. The parse is wrapped in except ValueError as e: raise DecodeError(...). That is what makes the documented contract sufficient for untrusted input: except jwt.PyJWTError (or InvalidTokenError) around jwt.decode(token, key, algorithms=[...]).

CPython’s JSON decoder raises RecursionError (a RuntimeError subclass, not a ValueError) once nesting crosses the native stack guard. That exception leaves _load(), then jwt.decode(), and matches no PyJWTError handlerr at all. No key and no valid signature are needed: the header is parsed first, so a single unauthenticated request with an unsigned token suffices.

Scope: the recursion threshold is ~65,000 nesting levels; below it the same input yields a clean DecodeError (a 346,800-byte flat header is rejected normally, so depth, not size, is the trigger). A token this large cannot ride in an Authorization header (rejected at HTTP field limits,431 under gunicorn), but body transport (RFC 7662 introspection style) is a standard pattern. Under Flask 3.1.3 / gunicorn 26.2.0 each crafted request returns HTTP 500 instead of 401 and writes a full traceback to the error log; the sync worker survives.

References

  • github.com/advisories/GHSA-8wjv-2p76-3863
  • github.com/jpadilla/pyjwt/commit/06573692ebcdec8831c3927513b3e87c31fbbb62
  • github.com/jpadilla/pyjwt/releases/tag/2.14.0
  • github.com/jpadilla/pyjwt/security/advisories/GHSA-8wjv-2p76-3863
  • nvd.nist.gov/vuln/detail/CVE-2026-102265

Code Behaviors & Features

Detect and mitigate CVE-2026-102265 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 2.13.0 before 2.14.0

Fixed versions

  • 2.14.0

Solution

Upgrade to version 2.14.0 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Learn more about CVSS

Weakness

  • CWE-674: Uncontrolled Recursion

Source file

pypi/PyJWT/CVE-2026-102265.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Mon, 12 Oct 2026 00:23:18 +0000.