Advisory Database
  • Advisories
  • Dependency Scanning
  1. gem
  2. ›
  3. jwt
  4. ›
  5. CVE-2026-45363

CVE-2026-45363: ruby-jwt: Empty-key HMAC bypass; cross-language sibling of CVE-2026-44351

May 18, 2026 (updated June 2, 2026)

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:)

References

  • github.com/advisories/GHSA-c32j-vqhx-rx3x
  • github.com/jwt/ruby-jwt/commit/db560b769a07bd9724e77ff505011ac01872106f
  • github.com/jwt/ruby-jwt/issues/724
  • github.com/jwt/ruby-jwt/releases/tag/v2.10.3
  • github.com/jwt/ruby-jwt/releases/tag/v3.2.0
  • github.com/jwt/ruby-jwt/security/advisories/GHSA-c32j-vqhx-rx3x
  • github.com/rubysec/ruby-advisory-db/blob/master/gems/jwt/CVE-2026-45363.yml
  • nvd.nist.gov/vuln/detail/CVE-2026-45363
  • www.cve.org/CVERecord?id=CVE-2026-45363

Code Behaviors & Features

Detect and mitigate CVE-2026-45363 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.10.3, all versions starting from 3.0.0 before 3.2.0

Fixed versions

  • 2.10.3
  • 3.2.0

Solution

Upgrade to versions 2.10.3, 3.2.0 or above.

Impact 7.4 HIGH

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Learn more about CVSS

Weakness

  • CWE-1391: Use of Weak Credentials
  • CWE-287: Improper Authentication
  • CWE-326: Inadequate Encryption Strength

Source file

gem/jwt/CVE-2026-45363.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 23 Jun 2026 12:23:10 +0000.