CVE-2024-37568
Description
lepture Authlib before 1.3.1 has algorithm confusion with asymmetric public keys. Unless an algorithm is specified in a jwt.decode call, HMAC verification is allowed with any asymmetric public key. (This is similar to CVE-2022-29217 and CVE-2024-33663.)
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Authlib before 1.3.1 allows HMAC verification with any asymmetric public key when `algorithm` is not specified in `jwt.decode`, enabling algorithm confusion attacks.
Root
Cause
The vulnerability in lepture Authlib versions prior to 1.3.1 lies in the jwt.decode method. When the algorithm parameter is not explicitly specified, the library permits HMAC-based signature verification (HS256, HS384, HS512) using any asymmetric public key provided by the caller [2]. This is a classic algorithm confusion flaw, similar to CVE-2022-29217 and CVE-2024-33663, but with broader applicability as it affects all verification with asymmetric keys regardless of format [2].
Exploitation
An attacker can exploit this by presenting a valid-looking JWT signed with a symmetric HMAC key, then using any asymmetric public key (e.g., from the legitimate service) to fool the library into accepting the token as valid [2]. No authentication is required; the attacker only needs to provide a public key that the application trusts for asymmetric verification. The library fails to check whether the supplied key is actually asymmetric (e.g., PEM or SSH-encoded) before proceeding with HMAC verification [2].
Impact
Successful exploitation allows an attacker to forge arbitrary JWTs that pass signature validation, leading to unauthorized access, privilege escalation, or impersonation of legitimate users. The impact is heightened because the default code example in Authlib documentation is itself vulnerable, potentially leading developers to unknowingly deploy insecure authentication [2].
Mitigation
The vulnerability is fixed in Authlib version 1.3.1 [1][4]. Users should upgrade immediately. As a workaround, always explicitly specify the algorithm parameter in jwt.decode calls, ensuring only expected asymmetric algorithms are accepted. The fix mirrors the solution for previous CVEs: before using HMAC verification, the library must verify that the provided key is not an asymmetric public key [2].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
authlibPyPI | < 1.3.1 | 1.3.1 |
Affected products
5- lepture/Authlibdescription
- ghsa-coords4 versionspkg:pypi/authlibpkg:rpm/opensuse/python-Authlib&distro=openSUSE%20Leap%2015.6pkg:rpm/opensuse/python-Authlib&distro=openSUSE%20Tumbleweedpkg:rpm/suse/python-Authlib&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Python%203%2015%20SP6
< 1.3.1+ 3 more
- (no CPE)range: < 1.3.1
- (no CPE)range: < 1.3.1-150600.3.3.1
- (no CPE)range: < 1.3.1-1.1
- (no CPE)range: < 1.3.1-150600.3.3.1
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
10- github.com/advisories/GHSA-5357-c2jx-v7qhghsaADVISORY
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FHJI32SN4FNAUVNALVGOKWHNSQ6XS3M5/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IZI7HYGN7VZAYFV6UV3SRLYF7QGERXIU/mitrevendor-advisory
- nvd.nist.gov/vuln/detail/CVE-2024-37568ghsaADVISORY
- github.com/lepture/authlib/issues/654ghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/authlib/PYSEC-2024-52.yamlghsaWEB
- lists.debian.org/debian-lts-announce/2025/10/msg00032.htmlghsaWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FHJI32SN4FNAUVNALVGOKWHNSQ6XS3M5ghsaWEB
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IZI7HYGN7VZAYFV6UV3SRLYF7QGERXIUghsaWEB
- www.vicarius.io/vsociety/posts/algorithm-confusion-in-lepture-authlib-cve-2024-37568ghsaWEB
News mentions
0No linked articles in our index yet.