CVE-2026-114616: Authlib accepts an empty HMAC key, allowing JWS/JWT signature forgery (HS256/HS384/HS512)

Published Oct 22, 2026
·
Updated

Authlib is a Python library which builds OAuth and OpenID Connect servers. Prior to 1.9.1, Authlib's OctKey.importkey() and HMAC signing and verification path accept zero-length key material. If an application's secret lookup can return an empty string or empty bytes, a remote attacker can compute the deterministic HS256, HS384, or HS512 signature for arbitrary token claims and have Authlib treat the token as authentic. This issue is fixed in version 1.9.1.

Other sources

Reporter: Cavan Loughran, Celvex Group Inc.

Summary

Authlib's symmetric (oct) key handling accepts an empty key (empty bytes b'' / empty string '') as a valid HMAC signing and verification key. An empty HMAC key produces a deterministic digest that any party can reproduce, so an attacker who knows (or can cause) the application to verify a token with an empty key can forge arbitrary tokens that pass HS256/HS384/HS512 signature verification. This is the Authlib member of the cross-language empty-HMAC-key family already assigned CVE-2026-44351 (fast-jwt, npm) and CVE-2026-45363 (ruby-jwt, RubyGems).

This is DISTINCT from Authlib's existing recent JWT-verification advisories. It is not closed by CVE-2026-27962 / GHSA-wvwj-cvrp-7pv5 (JWS JWK header injection, the key=None case), nor by CVE-2026-28802 / GHSA-7wc2-qxgw-g8gg (alg:none blank-signature bypass), nor by GHSA-5357-c2jx-v7qh (algorithm confusion with asymmetric public keys). Those address header-driven key injection, the none algorithm, and asymmetric-vs-symmetric confusion respectively; none of them rejects a zero-length oct key.

Affected versions

Authlib <= 1.7.2 (latest release 1.7.2, 2026-05-06). Confirmed present at the v1.7.2 release tag and on the current main HEAD. The affected code is in authlib/jose/rfc7518/octkey.py and authlib/jose/rfc7518/jwsalgs.py.

Root cause (exact code location, release tag v1.7.2)

- authlib/jose/rfc7518/octkey.py, class OctKey: - validaterawkey is a type-only check: return isinstance(key, bytes). An empty bytes object passes. - importkey rejects only keys whose material starts with known unsafe prefixes (if rawkey.startswith(POSSIBLEUNSAFEKEYS): raise ValueError(...), i.e. PEM/SSH prefixes). Empty bytes do not match any unsafe prefix, so b'' is accepted. - getopkey loads the raw key without validating its length. - No check anywhere rejects a zero-length key, so an empty key b'' passes every gate. - authlib/jose/rfc7518/jwsalgs.py, class HMACAlgorithm: - preparekey: return OctKey.importkey(rawdata). - sign / verify call key.getopkey(...) then hmac.new(opkey, msg, self.hashalg) / hmac.comparedigest(...). With an empty op key this becomes hmac.new(b'', ...): a deterministic, publicly reproducible digest. There is no empty-key or minimum-length check.

Why this is a real signature bypass

An empty HMAC key makes the signature a public, deterministic function of the header and payload, so anyone can compute a valid signature and forge tokens. The realistic trigger matches the sibling CVEs: the deploying application sources the verification key from a place that can be empty at runtime, for example os.environ.get('JWTSECRET', ''), a database/config column whose default is '', or a key-resolver that returns '' on a miss. Authlib is widely used to BUILD token verifiers (OAuth 2.0 resource servers, OIDC relying parties), and Authlib's own recent advisory history shows the JWS/JWT verify path is the live attack surface, so a key-resolution path that can yield '' is a realistic exposure.

Reproduction (prose, no weaponized exploit)

1. In an application that uses Authlib to verify JWS/JWT, arrange for the verification key to be an empty value (e.g. an unset environment variable defaulted to ''). 2. An attacker constructs a token with header {alg: HS256} and an arbitrary payload, and computes the HS256 signature using an empty key (a value any party can reproduce because the key is empty). 3. Authlib's HMAC verification accepts the token as validly signed, because OctKey.importkey did not reject the empty key and hmac.comparedigest matches the attacker-computable digest. The forged token is treated as authentic.

No live system was probed; the above describes the class. The vulnerable code path and the absent guard are confirmed by direct reading of the public source at the v1.7.2 tag and on current main.

Proof the fix is known-good (no novelty risk)

The same maintainer's newer JOSE library, joserfc, ALREADY rejects empty oct key material outright. In src/joserfc/rfc7518/octkey.py, importkey raises a ValueError on empty oct material, with an explicit note that an empty oct key produces a deterministic HMAC digest that any party can reproduce, allowing trivial signature forgery in JWS HS256/HS384/HS512 verification. (joserfc additionally warns on keys below 112 bits.) The same guard is simply absent from the older, far more widely deployed Authlib rfc7518 package. The flagship Python JOSE libraries also guard: PyJWT raises InvalidKeyError('HMAC key must not be empty.') for zero-length keys, and jwcrypto enforces an RFC 7518 minimum key length.

Impact

Token forgery / authentication bypass in OAuth 2.0 resource servers and OIDC relying parties built on Authlib whenever the HMAC verification key can be empty at runtime. An attacker can mint tokens with arbitrary claims (for example elevated scopes or another user's subject) that pass signature verification.

Suggested remediation

Reject empty oct key material in OctKey.importkey (and/or validaterawkey), exactly as the maintainer's joserfc library already does, before the key can reach hmac.new in HMACAlgorithm.sign / verify. Consider also adopting joserfc's sub-112-bit minimum-length warning/rejection for HMAC keys.

Disclosure

Reporter: Cavan Loughran, Celvex Group Inc.

— GitHub

Affected Software

17 affected componentsFixes available
pypi/authlib<1.9.1
pip/authlib<1.9.1
1.9.1
pip/authlib<1.9.1
1.9.1
Authlib Authlib<1.9.1
ubuntu/python-authlib*
ubuntu/python-authlib*
ubuntu/python-authlib*
ubuntu/python-authlib*
debian/python-authlib*
debian/python-authlib*
debian/python-authlib<1.9.1-1
1.9.1-1
debian/python-authlib<=1.2.0-1+deb12u1, <=1.2.0-1+deb12u2, <=1.6.0-1+deb13u1
1.9.1-1
IBM Engineering AI Hub<=1.0.0
IBM 1.1.0<=undefined
IBM 1.2.0<=undefined
IBM 1.3.0<=undefined
IBM 1.4.0<=undefined

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/Authlib to a version that resolves this vulnerability.

    Fixed in 1.9.1
  2. Upgrade

    Upgrade debian/python-authlib to a version that resolves this vulnerability.

    Fixed in 1.9.1-1
  3. Upgrade

    Upgrade pip/authlib to a version that resolves this vulnerability.

    Fixed in 1.9.1
  4. Upgrade

    Upgrade Authlib to a version that resolves this vulnerability.

    Fixed in 1.9.1

Event History

Oct 22, 2026
CVE Published
via Ubuntu·12:00 AM
Data Sourced
via Ubuntu·12:00 AM
RemedyDescriptionSeverityAffected Software
CVE Published
via MITRE·09:14 PM
Data Sourced
via MITRE·09:14 PM
DescriptionSeverityWeakness
Advisory Published
via OSV·10:18 PM
Data Sourced
via NVD·10:18 PM
RemedyDescriptionSeverityWeaknessAffected Software
Oct 27, 2026
Advisory Published
via GitHub·04:09 PM
Data Sourced
via GitHub·04:09 PM
DescriptionSeverityWeaknessAffected Software
Oct 31, 2026
Data Sourced
via OSV·03:30 AM
Affected Software
Nov 18, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

Which deployments are actually exposed?

Deployments using Authlib before 1.9.1 are exposed if their application’s secret lookup can return an empty string or empty bytes for an HMAC-signed JWS or JWT. The affected algorithms are HS256, HS384, and HS512.

2

What does an attacker need to exploit this issue?

An attacker needs the application to accept a token whose HMAC key resolves to zero-length key material. No credentials or user interaction are required, and the attacker can create a valid deterministic signature over arbitrary token claims.

3

Are applications using asymmetric JWT signing affected?

The provided information identifies the vulnerable signing and verification path as HMAC-based HS256, HS384, and HS512. It does not identify asymmetric signing algorithms as affected.

4

What should be done if an immediate upgrade is not possible?

Ensure secret lookup cannot return an empty string or empty bytes for any HMAC JWS/JWT key, and reject tokens when key material is missing or empty. Upgrade Authlib to version 1.9.1 when possible.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203