Vulnerabilities in pkg:gem/jwt

PACKAGE
Advisory Identifier: GHSA-c32j-vqhx-rx3x
Advisory Summary

CVE-2026-45363 is a HIGH (CVSS 7.4) empty-key hmac bypass; cross-language sibling vulnerability (CWE-287: Improper Authentication) affecting ruby-jwt libraries in the RubyGems ecosystem. The issue involves empty-key hmac bypass; cross-language sibling of cve-2026-44351. Remediation is available by upgrading affected packages to version 3.2.0, 2.10.3.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/jwt

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/jwt. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-c32j-vqhx-rx3x CVE-2026-45363 HIGH ruby-jwt: Empty-key HMAC bypass; cross-language sibling of CVE-2026-44351

CVE-2026-45363 at a Glance

CVE Identifier CVE-2026-45363
GHSA Identifier GHSA-c32j-vqhx-rx3x
Severity HIGH
CVSS v3.1 Base Score 7.4
CWE Classification CWE-287: Improper Authentication
Affected Product ruby-jwt
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 7.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-45363

To remediate this vulnerability, upgrade all affected ruby-jwt dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

jwt fixed: 3.2.0
Upgrade jwt to 3.2.0
jwt fixed: 2.10.3
Upgrade jwt to 2.10.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for jwt

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-45363, inspect your project dependencies for ruby-jwt:

inspect dependencies for jwt

Analyze the terminal output to locate any version of ruby-jwt in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In ruby-jwt, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2026-45363 Affected ruby-jwt Versions

2 component(s)
Fixed Versions:
3.2.02.10.3
Product / Package Ecosystem Affected Versions Fixed Version
jwt
RubyGems
≥ 3.0.0
< 3.2.0
3.2.0
jwt
RubyGems
< 2.10.3
2.10.3

References

Frequently Asked Questions

What is CVE-2026-45363?
CVE-2026-45363 is a security vulnerability in ruby-jwt involving Empty-key HMAC bypass; cross-language sibling of CVE-2026-44351 under CWE-287: Improper Authentication.
Which ruby-jwt versions are affected?
Affected versions include releases prior to 3.2.0, 2.10.3 across affected packages: jwt.
What version fixes CVE-2026-45363?
Upgrading to 3.2.0, 2.10.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jwt affected?
Yes, jwt is affected in releases prior to 3.2.0, 2.10.3. Upgrade your dependency to 3.2.0, 2.10.3 or later.
What is the CVSS score of CVE-2026-45363?
CVE-2026-45363 has a CVSS v3.1 base score of 7.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-45363?
CVE-2026-45363 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check RubyGems dependencies for CVE-2026-45363?
Run the dependency tree command: 'inspect dependencies for jwt'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c32j-vqhx-rx3x",
  "modified" : "2026-06-02T22:12:50Z",
  "published" : "2026-05-18T17:24:55Z",
  "aliases" : [ "CVE-2026-45363" ],
  "summary" : "ruby-jwt: Empty-key HMAC bypass; cross-language sibling of CVE-2026-44351",
  "details" : "`JWT.decode(token, '', true, algorithm: 'HS256')` accepts an attacker-forged token.\n`OpenSSL::HMAC.digest('SHA256', '', payload)` returns a valid digest under an empty key, and no `raise\n  InvalidKeyError if key.empty?` precondition exists in the HMAC algorithm.\n\n```\nJWT.decode(token, \"\", true, algorithm: 'HS256')\n  -> JWA::Hmac.verify(verification_key: \"\", ...)\n  -> OpenSSL::HMAC.digest('SHA256', \"\", signing_input) == signature\n```\n\nThe same path is reached when a keyfinder block or key_finder: argument returns \"\", nil, or an\narray containing nil for an unknown key. JWT::Decode#find_key only rejects literal nil and empty\narrays, and JWT::JWA::Hmac silently coerces nil to \"\" (signing_key ||= '') before signing.\n\n```\nJWT.decode(token, nil, true, algorithms: ['HS256']) { |_h| \"\" }\n  -> find_key returns \"\"               # \"\" && !Array(\"\").empty? == true\n  -> JWA::Hmac.verify(verification_key: \"\", ...)\n  -> verifies\n```\nCommon 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.\n\nThe 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.\n\nAffects HS256/HS384/HS512 via both JWT.decode (positional key and block keyfinder) and\n`JWT::EncodedToken#verify_signature!(key_finder:)`",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "jwt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.2.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "jwt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.10.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jwt/ruby-jwt/security/advisories/GHSA-c32j-vqhx-rx3x"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jwt/ruby-jwt/issues/724"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jwt/ruby-jwt/commit/db560b769a07bd9724e77ff505011ac01872106f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jwt/ruby-jwt"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jwt/ruby-jwt/releases/tag/v2.10.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jwt/ruby-jwt/releases/tag/v3.2.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/jwt/CVE-2026-45363.yml"
  }, {
    "type" : "WEB",
    "url" : "https://www.cve.org/CVERecord?id=CVE-2026-45363"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1391", "CWE-287", "CWE-326" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-18T17:24:55Z",
    "nvd_published_at" : null
  }
}