ruby-jwt: Empty-key HMAC bypass; cross-language sibling of CVE-2026-44351
Published 18 May 2026 · Updated 10 Sept 2026
Is your project on an affected jwt?
Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- >=3.0.0 <3.2.0
- Fixed in
- 3.2.0
bundle update --conservative jwt # Gemfile: '>= 3.2.0'- Affected
- <2.10.3
- Fixed in
- 2.10.3
bundle update --conservative jwt # Gemfile: '>= 2.10.3'Details
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(verification_key: "", ...)
-> OpenSSL::HMAC.digest('SHA256', "", signing_input) == signatureThe same path is reached when a keyfinder block or key_finder: argument returns "", nil, or an array containing nil for an unknown key. JWT::Decode#find_key only rejects literal nil and empty arrays, and JWT::JWA::Hmac silently coerces nil to "" (signing_key ||= '') before signing.
JWT.decode(token, nil, true, algorithms: ['HS256']) { |_h| "" }
-> find_key returns "" # "" && !Array("").empty? == true
-> JWA::Hmac.verify(verification_key: "", ...)
-> verifiesCommon application patterns that produce the unsafe value: redis.get("kid:#{kid}").to_s, 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 enforce_hmac_key_length 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#verify_signature!(key_finder:)
Is GHSA-c32j-vqhx-rx3x in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected jwt, and gives you the command that fixes it.
References
- Linkgithub.com/jwt/ruby-jwt/security/advisories/GHSA-c32j-vqhx-rx3x
- Linkgithub.com/jwt/ruby-jwt/issues/724
- Linkgithub.com/jwt/ruby-jwt/commit/db560b769a07bd9724e77ff505011ac01872106f
- Packagegithub.com/jwt/ruby-jwt
- Linkgithub.com/jwt/ruby-jwt/releases/tag/v2.10.3
- Linkgithub.com/jwt/ruby-jwt/releases/tag/v3.2.0
- Linkgithub.com/rubysec/ruby-advisory-db/blob/master/gems/jwt/CVE-2026-45363.yml
- Linkwww.cve.org/CVERecord?id=CVE-2026-45363
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.