{"id":"CVE-2025-59420","aliases":["CVE-2025-59420","GHSA-9ggr-2464-2j32","PYSEC-2026-1200"],"related":[],"kind":"vulnerability","state":"published","title":"Authlib: JWS/JWT accepts unknown crit headers (RFC violation → possible authz bypass)","summary":"Authlib is a Python library which builds OAuth and OpenID Connect servers. Prior to version 1.6.4, Authlib’s JWS verification accepts tokens that declare unknown critical header parameters (crit), violating RFC 7515 “must‑understand” semantics. An attacker can craft a signed token with a critical header (for example, bork or cnf) that strict verifiers reject but Authlib accepts. In mixed‑language fleets, this enables split‑brain verification and can lead to policy bypass, replay, or privilege escalation. This issue has been patched in version 1.6.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Authlib is a Python library which builds OAuth and OpenID Connect servers. Prior to version 1.6.4, Authlib’s JWS verification accepts tokens that declare unknown critical header parameters (crit), violating RFC 7515 “must‑understand” semantics. An attacker can craft a signed token with a critical header (for example, bork or cnf) that strict verifiers reject but Authlib accepts. In mixed‑language fleets, this enables split‑brain verification and can lead to policy bypass, replay, or privilege escalation. This issue has been patched in version 1.6.4.","source":"cvelist"},{"lang":"en","text":"## Summary\nAuthlib’s JWS verification accepts tokens that declare unknown critical header parameters (`crit`), violating RFC 7515 “must‑understand” semantics. An attacker can craft a signed token with a critical header (for example, `bork` or `cnf`) that strict verifiers reject but Authlib accepts. In mixed‑language fleets, this enables split‑brain verification and can lead to policy bypass, replay, or privilege escalation.\n\n## Affected Component and Versions\n- Library: Authlib (JWS verification)\n- API: `authlib.jose.JsonWebSignature.deserialize_compact(...)`\n- Version tested: 1.6.3\n- Configuration: Default; no allowlist or special handling for `crit`\n\n## Details\nRFC 7515 (JWS) §4.1.11 defines `crit` as a “must‑understand” list: recipients MUST understand and enforce every header parameter listed in `crit`, otherwise they MUST reject the token. Security‑sensitive semantics such as token binding (e.g., `cnf` from RFC 7800) are often conveyed via `crit`.\n\nObserved behavior with Authlib 1.6.3:\n- When a compact JWS contains a protected header with `crit: [\"cnf\"]` and a `cnf` object, or `crit: [\"bork\"]` with an unknown parameter, Authlib verifies the signature and returns the payload without rejecting the token or enforcing semantics of the critical parameter.\n- By contrast, Java Nimbus JOSE+JWT (9.37.x) and Node `jose` v5 both reject such tokens by default when `crit` lists unknown names.\n\nImpact in heterogeneous fleets:\n- A strict ingress/gateway (Nimbus/Node) rejects a token, but a lenient Python microservice (Authlib) accepts the same token. This split‑brain acceptance bypasses intended security policies and can enable replay or privilege escalation if `crit` carries binding or policy information.\n\n## Proof of Concept (PoC)\nThis repository provides a multi‑runtime PoC demonstrating the issue across Python (Authlib), Node (`jose` v5), and Java (Nimbus).\n\n### Prerequisites\n- Python 3.8+\n- Node.js 18+\n- Java 11+ with Maven\n\n### Setup\n\nEnter the directory **authlib-crit-bypass-poc** & run following commands.\n```bash\nmake setup\nmake tokens\n```\n\n### Tokens minted\n- `tokens/unknown_crit.jwt` with protected header:\n  `{ \"alg\": \"HS256\", \"crit\": [\"bork\"], \"bork\": \"x\" }`\n- `tokens/cnf_header.jwt` with protected header:\n  `{ \"alg\": \"HS256\", \"crit\": [\"cnf\"], \"cnf\": {\"jkt\": \"thumb-42\"} }`\n\n### Reproduction\nRun the cross‑runtime demo:\n```bash\nmake  demo\n```\n\nExpected output for each token (strict verifiers reject; Authlib accepts):\n\nFor `tokens/unknown_crit.jwt`:\n```\nStrict(Nimbus): REJECTED (unknown critical header: bork)\nStrict(Node jose): REJECTED (unrecognized crit)\nLenient(Authlib): ACCEPTED -> payload={'sub': '123', 'role': 'user'}\n```\n\nFor `tokens/cnf_header.jwt`:\n```\nStrict(Nimbus): REJECTED (unknown critical header: cnf)\nStrict(Node jose): REJECTED (unrecognized crit)\nLenient(Authlib): ACCEPTED -> payload={'sub': '123', 'role': 'user'}\n```\n\nEnvironment notes:\n- Authlib version used: `1.6.3` (from PyPI)\n- Node `jose` version: `^5`\n- Nimbus JOSE+JWT version: `9.37.x`\n- HS256 secret is 32 bytes to satisfy strict verifiers: `0123456789abcdef0123456789abcdef`\n\n## Impact\n- Class: Violation of JWS `crit` “must‑understand” semantics; specification non‑compliance leading to authentication/authorization policy bypass.\n- Who is impacted: Any service that relies on `crit` to carry mandatory security semantics (e.g., token binding via `cnf`) or operates in a heterogeneous fleet with strict verifiers elsewhere.\n- Consequences: Split‑brain acceptance (gateway rejects while a backend accepts), replay, or privilege escalation if critical semantics are ignored.\n\n## References\n- RFC 7515: JSON Web Signature (JWS), §4.1.11 `crit`\n- RFC 7800: Proof‑of‑Possession Key Semantics for JWTs (`cnf`)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Authlib es una biblioteca de Python que construye servidores OAuth y OpenID Connect. Antes de la versión 1.6.4, la verificación JWS de Authlib acepta tokens que declaran parámetros de encabezado críticos (crit) desconocidos, violando la semántica de 'must-understand' de RFC 7515. Un atacante puede crear un token firmado con un encabezado crítico (por ejemplo, bork o cnf) que los verificadores estrictos rechazan pero Authlib acepta. En flotas de lenguaje mixto, esto permite la verificación de cerebro dividido y puede conducir a la omisión de políticas, la repetición o la escalada de privilegios. Este problema ha sido parcheado en la versión 1.6.4.","source":"nvd"}],"published":"2025-09-22T14:42:12.000Z","modified":"2026-10-19T16:10:00.260Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-345","CWE-863"],"affected":[{"ranges":[{"version":"< 1.6.4","status":"affected"}],"vendor":"authlib","product":"authlib","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.6.4"}],"ecosystem":"PyPI","package":"authlib","purl":"pkg:pypi/authlib","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.6.4"}],"vendor":"authlib","product":"authlib","cpe":"cpe:2.3:a:authlib:authlib:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.6.4"}],"ecosystem":"PyPI","package":"authlib","purl":"pkg:pypi/authlib","source":"pysec"}],"references":[{"url":"https://github.com/authlib/authlib/security/advisories/GHSA-9ggr-2464-2j32","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/authlib/authlib/commit/6b1813e4392eb7c168c276099ff7783b176479df","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00032.html","tags":["web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59420","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/authlib/authlib","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/authlib","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-9ggr-2464-2j32","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-09-22T18:04:06.580Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-59420","url":"https://www.cve.org/CVERecord?id=CVE-2025-59420","licence":"CVE Terms of Use","modified":"2025-11-03T17:45:19.901Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9ggr-2464-2j32","url":"https://github.com/advisories/GHSA-9ggr-2464-2j32","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:28.176Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-59420","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59420","licence":"Public domain","modified":"2026-10-19T16:10:00.260Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1200","url":"https://osv.dev/vulnerability/PYSEC-2026-1200","licence":"CC-BY-4.0","modified":"2026-07-07T17:46:32.324Z"}],"updatedAt":"2026-11-25T22:59:04.932Z","epss":{"score":0.00286,"percentile":0.22719,"date":"2026-12-01T12:00:22.000Z"}}