CVE-2026-45363: `jwt` (Ruby gem) - empty-key HMAC bypass

Published May 18, 2026
·
Updated

JWT.decode(token, '', true, algorithm: 'HS256') accepts an attacker-forged token. OpenSSL::HMAC.digest('SHA256', '', payload) returns a valid digest under an empty key, and no raise InvalidKeyError if key.empty? precondition exists in the HMAC algorithm.

JWT.decode(token, "", true, algorithm: 'HS256') -> JWA::Hmac.verify(verificationkey: "", ...) -> OpenSSL::HMAC.digest('SHA256', "", signinginput) == signature

The same path is reached when a keyfinder block or keyfinder: argument returns "", nil, or an array containing nil for an unknown key. JWT::Decode#findkey only rejects literal nil and empty arrays, and JWT::JWA::Hmac silently coerces nil to "" (signingkey ||= '') before signing.

JWT.decode(token, nil, true, algorithms: ['HS256']) { |h| "" } -> findkey returns "" # "" && !Array("").empty? == true -> JWA::Hmac.verify(verificationkey: "", ...) -> verifies Common application patterns that produce the unsafe value: redis.get("kid:#{kid}").tos, ORM string columns with default: '', ENV['SECRET'] || '', Hash.new('') lookups, [primary, fallback] where fallback may be nil. Applications passing a non-empty static key:, or whose keyfinder returns nil / raises on miss, are not affected.

The existing enforcehmackeylength option would block this but defaults to false. On OpenSSL ≥ 3.5 the empty-key HMAC.digest call no longer raises, so the OpenSSL-3.0 rescue in JWA::Hmac#sign does not fire.

Affects HS256/HS384/HS512 via both JWT.decode (positional key and block keyfinder) and JWT::EncodedToken#verifysignature!(keyfinder:)

Other sources

ruby-jwt is a Ruby implementation of the RFC 7519 OAuth JSON Web Token standard. Prior to 2.10.3 and 3.2.0, JWT.decode(token, '', true, algorithm: 'HS256') accepts an attacker-forged token because OpenSSL::HMAC.digest('SHA256', '', payload) returns a valid digest under an empty key and no empty-key precondition exists in the HMAC algorithm. The same path is reached when a keyfinder block or keyfinder: argument returns an empty string, nil, or an array containing nil for an unknown key, affecting HS256, HS384, and HS512 verification through JWT.decode and JWT::EncodedToken#verifysignature!. This issue is fixed in versions 2.10.3 and 3.2.0.

— MITRE

Affected Software

7 affected componentsFixes available
rubygems/jwt<3.2.0
3.2.0
ubuntu/ruby-jwt<1.0.0-3ubuntu0.1~esm1
1.0.0-3ubuntu0.1~esm1
ubuntu/ruby-jwt<1.5.6-1ubuntu0.1~esm1
1.5.6-1ubuntu0.1~esm1
ubuntu/ruby-jwt<2.1.0-2ubuntu0.1~esm1
2.1.0-2ubuntu0.1~esm1
ubuntu/ruby-jwt<2.2.2-1ubuntu0.1~esm1
2.2.2-1ubuntu0.1~esm1
ubuntu/ruby-jwt<2.7.1-1+deb13u1build0.24.04.1
2.7.1-1+deb13u1build0.24.04.1
ubuntu/ruby-jwt<2.7.1-1+deb13u1build0.26.04.1
2.7.1-1+deb13u1build0.26.04.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rubygems/jwt to a version that resolves this vulnerability.

    Fixed in 3.2.0
  2. Upgrade

    Upgrade ubuntu/ruby-jwt to a version that resolves this vulnerability.

    Fixed in 1.0.0-3ubuntu0.1~esm1
  3. Upgrade

    Upgrade ubuntu/ruby-jwt to a version that resolves this vulnerability.

    Fixed in 1.5.6-1ubuntu0.1~esm1
  4. Upgrade

    Upgrade ubuntu/ruby-jwt to a version that resolves this vulnerability.

    Fixed in 2.1.0-2ubuntu0.1~esm1
  5. Upgrade

    Upgrade ubuntu/ruby-jwt to a version that resolves this vulnerability.

    Fixed in 2.2.2-1ubuntu0.1~esm1
  6. Upgrade

    Upgrade ubuntu/ruby-jwt to a version that resolves this vulnerability.

    Fixed in 2.7.1-1+deb13u1build0.24.04.1
  7. Upgrade

    Upgrade ubuntu/ruby-jwt to a version that resolves this vulnerability.

    Fixed in 2.7.1-1+deb13u1build0.26.04.1
  8. Upgrade

    Upgrade jwt to a version that resolves this vulnerability.

    Fixed in 2.10.3
  9. Upgrade

    Upgrade jwt to a version that resolves this vulnerability.

    Fixed in 3.2.0
  10. Configuration

    Set `enforce_hmac_key_length` to true to block empty-key HMAC verification (the option defaults to false, and empty-key bypass is described for `JWT.decode(token, '', true, algorithm: 'HS256')`).

    jwt (Ruby gem) enforce_hmac_key_length = false

Event History

May 18, 2026
Advisory Published
via GitHub·05:24 PM
Data Sourced
via GitHub·05:24 PM
DescriptionSeverityWeaknessAffected Software
Jul 14, 2026
CVE Published
via MITRE·09:32 PM
Data Sourced
via MITRE·09:32 PM
DescriptionSeverityWeakness
Data Sourced
via Red Hat·10:03 PM
DescriptionSeverityAffected Software
Data Sourced
via OSV·10:16 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·10:16 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2026-45363?

CVE-2026-45363 is a high-severity vulnerability that allows attackers to decode and forge JSON Web Tokens without a valid key.

2

How do I fix CVE-2026-45363?

To fix CVE-2026-45363, upgrade the 'jwt' package to version 3.2.0 or later.

3

What type of attack does CVE-2026-45363 allow?

CVE-2026-45363 allows an attacker to forge and potentially manipulate JWT tokens by using an empty key.

4

Which versions of the 'jwt' package are affected by CVE-2026-45363?

CVE-2026-45363 affects all versions of the 'jwt' package prior to 3.2.0.

5

Is there any additional mitigation for CVE-2026-45363 beyond updating?

Beyond updating to version 3.2.0, ensure that tokens are always signed with a strong, non-empty key.

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