{"id":"CVE-2026-45363","aliases":["CVE-2026-45363","GHSA-c32j-vqhx-rx3x"],"related":[],"kind":"vulnerability","state":"published","title":"`jwt` (Ruby gem) - empty-key HMAC bypass","summary":"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 key_finder: 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#verify_signature!. This issue is fixed in versions 2.10.3 and 3.2.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 key_finder: 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#verify_signature!. This issue is fixed in versions 2.10.3 and 3.2.0.","source":"cvelist"},{"lang":"en","text":"`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:)`","format":"markdown","source":"ghsa"},{"lang":"es","text":"ruby-jwt es una implementación en Ruby del estándar RFC 7519 OAuth JSON Web Token. Antes de las versiones 2.10.3 y 3.2.0, JWT.decode(token, ’’, true, algorithm: ’HS256’) acepta un token forjado por un atacante porque OpenSSL::HMAC.digest(’SHA256’, ’’, payload) devuelve un digest válido con una clave vacía y no existe ninguna precondición de clave vacía en el algoritmo HMAC. Se alcanza la misma ruta cuando un bloque keyfinder o un argumento key_finder: devuelve una cadena vacía, nil, o un array que contiene nil para una clave desconocida, afectando la verificación de HS256, HS384 y HS512 a través de JWT.decode y JWT::EncodedToken#verify_signature!. Este problema está solucionado en las versiones 2.10.3 y 3.2.0.","source":"nvd"}],"published":"2026-05-18T17:24:55.000Z","modified":"2026-10-24T22:10:00.210Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","score":9.1,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","score":9.1,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N","score":7.4,"rating":"HIGH"}],"cwes":["CWE-287","CWE-326","CWE-1391"],"affected":[{"ranges":[{"version":"< 2.10.3","status":"affected"},{"version":">= 3.0.0, < 3.2.0","status":"affected"}],"vendor":"jwt","product":"ruby-jwt","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"3.0.0","status":"affected","fixed":"3.2.0"}],"ecosystem":"RubyGems","package":"jwt","purl":"pkg:gem/jwt","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.10.3"}],"ecosystem":"RubyGems","package":"jwt","purl":"pkg:gem/jwt","source":"ghsa"}],"references":[{"url":"https://github.com/jwt/ruby-jwt/security/advisories/GHSA-c32j-vqhx-rx3x","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/jwt/ruby-jwt/commit/9820020869ad147b941e49d96ab8beba35532964","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/jwt/ruby-jwt/commit/db560b769a07bd9724e77ff505011ac01872106f","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/jwt/ruby-jwt/releases/tag/v2.10.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/jwt/ruby-jwt/releases/tag/v3.2.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2026/09/msg00022.html","tags":[],"sources":["cvelist","nvd"]},{"url":"https://github.com/jwt/ruby-jwt/issues/724","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/jwt/ruby-jwt","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/jwt/CVE-2026-45363.yml","tags":["web"],"sources":["ghsa"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-45363","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2026-07-15T13:24:12.081Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-45363","url":"https://www.cve.org/CVERecord?id=CVE-2026-45363","licence":"CVE Terms of Use","modified":"2026-09-19T18:07:54.033Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c32j-vqhx-rx3x","url":"https://github.com/advisories/GHSA-c32j-vqhx-rx3x","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:46.749Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-45363","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45363","licence":"Public domain","modified":"2026-10-24T22:10:00.210Z"}],"updatedAt":"2026-11-25T22:59:28.235Z","epss":{"score":0.00275,"percentile":0.21325,"date":"2026-12-01T12:00:22.000Z"}}