ruby-jwt: Empty-key HMAC bypass; cross-language sibling of CVE-2026-44351
Description
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) == signature
The 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: "", ...)
-> verifies
Common 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:)
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
jwtRubyGems | >= 3.0.0, < 3.2.0 | 3.2.0 |
jwtRubyGems | < 2.10.3 | 2.10.3 |
Affected products
18- osv-coords17 versionspkg:apk/chainguard/cinc-auditorpkg:apk/chainguard/gitlab-rails-ce-18.10pkg:apk/chainguard/gitlab-rails-ce-18.11pkg:apk/chainguard/gitlab-rails-ce-19.0pkg:apk/chainguard/gitlab-rails-ce-fips-18.10pkg:apk/chainguard/gitlab-rails-ce-fips-18.11pkg:apk/chainguard/gitlab-rails-ce-fips-19.0pkg:apk/chainguard/kube-fluentd-operatorpkg:apk/chainguard/logstash-8.19pkg:apk/chainguard/logstash-8.19-iamguarded-compatpkg:apk/chainguard/logstash-8.19-with-output-opensearchpkg:apk/chainguard/ruby3.2-kube-logging-operator-fluentd-outputspkg:apk/chainguard/ruby3.4-kube-logging-operator-fluentd-outputspkg:apk/wolfi/cinc-auditorpkg:apk/wolfi/kube-fluentd-operatorpkg:apk/wolfi/ruby3.2-kube-logging-operator-fluentd-outputspkg:apk/wolfi/ruby3.4-kube-logging-operator-fluentd-outputs
< 7.1.7-r0+ 16 more
- (no CPE)range: < 7.1.7-r0
- (no CPE)range: < 18.10.8-r0
- (no CPE)range: < 18.11.5-r0
- (no CPE)range: < 19.0.2-r0
- (no CPE)range: < 18.10.8-r0
- (no CPE)range: < 18.11.5-r0
- (no CPE)range: < 19.0.1-r4
- (no CPE)range: < 1.18.2-r65
- (no CPE)range: < 8.19.16-r0
- (no CPE)range: < 8.19.16-r0
- (no CPE)range: < 8.19.16-r0
- (no CPE)range: < 6.5.2-r0
- (no CPE)range: < 6.5.2-r0
- (no CPE)range: < 7.1.7-r0
- (no CPE)range: < 1.18.2-r65
- (no CPE)range: < 6.5.2-r0
- (no CPE)range: < 6.5.2-r0
Patches
Vulnerability mechanics
References
8- github.com/advisories/GHSA-c32j-vqhx-rx3xghsaADVISORY
- github.com/jwt/ruby-jwt/commit/db560b769a07bd9724e77ff505011ac01872106fghsaWEB
- github.com/jwt/ruby-jwt/issues/724ghsaWEB
- github.com/jwt/ruby-jwt/releases/tag/v2.10.3ghsaWEB
- github.com/jwt/ruby-jwt/releases/tag/v3.2.0ghsaWEB
- github.com/jwt/ruby-jwt/security/advisories/GHSA-c32j-vqhx-rx3xghsaWEB
- github.com/rubysec/ruby-advisory-db/blob/master/gems/jwt/CVE-2026-45363.ymlghsaWEB
- www.cve.org/CVERecordghsaWEB
News mentions
0No linked articles in our index yet.