Skip to content

Commit 74e417f

Browse files
committed
fix: cr feedback
1 parent dee174c commit 74e417f

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

gems/jwt/CVE-2026-45363.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,45 @@ url: https://github.com/jwt/ruby-jwt/security/advisories/GHSA-c32j-vqhx-rx3x
66
title: 'ruby-jwt: Empty-key HMAC bypass; cross-language sibling of CVE-2026-44351'
77
date: 2026-05-18
88
description: |
9-
`JWT.decode(token, '', true, algorithm: 'HS256')` accepts an attacker-forged token.
10-
`OpenSSL::HMAC.digest('SHA256', '', payload)` returns a valid digest under an empty key, and no `raise
11-
InvalidKeyError if key.empty?` precondition exists in the HMAC algorithm.
9+
`JWT.decode(token, '', true, algorithm: 'HS256')` accepts an
10+
attacker-forged token. `OpenSSL::HMAC.digest('SHA256', '', payload)`
11+
returns a valid digest under an empty key, and no
12+
`raise InvalidKeyError if key.empty?` precondition exists in the HMAC
13+
algorithm.
1214
1315
```
1416
JWT.decode(token, "", true, algorithm: 'HS256')
1517
-> JWA::Hmac.verify(verification_key: "", ...)
1618
-> OpenSSL::HMAC.digest('SHA256', "", signing_input) == signature
1719
```
1820
19-
The same path is reached when a keyfinder block or key_finder: argument returns "", nil, or an
20-
array containing nil for an unknown key. JWT::Decode#find_key only rejects literal nil and empty
21-
arrays, and JWT::JWA::Hmac silently coerces nil to "" (signing_key ||= '') before signing.
21+
The same path is reached when a keyfinder block or key_finder: argument
22+
returns "", nil, or an array containing nil for an unknown key.
23+
JWT::Decode#find_key only rejects literal nil and empty arrays, and
24+
JWT::JWA::Hmac silently coerces nil to "" (signing_key ||= '') before
25+
signing.
2226
2327
```
2428
JWT.decode(token, nil, true, algorithms: ['HS256']) { |_h| "" }
2529
-> find_key returns "" # "" && !Array("").empty? == true
2630
-> JWA::Hmac.verify(verification_key: "", ...)
2731
-> verifies
2832
```
29-
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.
3033
31-
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.
34+
Common application patterns that produce the unsafe value:
35+
`redis.get("kid:#{kid}").to_s`, ORM string columns with `default: ''`,
36+
`ENV['SECRET'] || ''`, `Hash.new('')` lookups, `[primary, fallback]`
37+
where fallback may be nil. Applications passing a non-empty static
38+
`key:`, or whose keyfinder returns nil / raises on miss, are not
39+
affected.
3240
33-
Affects HS256/HS384/HS512 via both JWT.decode (positional key and block keyfinder) and
34-
`JWT::EncodedToken#verify_signature!(key_finder:)`
41+
The existing `enforce_hmac_key_length` option would block this but
42+
defaults to false. On OpenSSL ≥ 3.5 the empty-key HMAC.digest call no
43+
longer raises, so the OpenSSL-3.0 rescue in JWA::Hmac#sign does not
44+
fire.
45+
46+
Affects HS256/HS384/HS512 via both JWT.decode (positional key and block
47+
keyfinder) and `JWT::EncodedToken#verify_signature!(key_finder:)`.
3548
cvss_v3: 7.4
3649
patched_versions:
3750
- ">= 3.2.0"
@@ -41,3 +54,5 @@ related:
4154
- https://github.com/jwt/ruby-jwt/commit/db560b769a07bd9724e77ff505011ac01872106f
4255
- https://github.com/jwt/ruby-jwt/releases/tag/v3.2.0
4356
- https://github.com/advisories/GHSA-c32j-vqhx-rx3x
57+
- https://www.cve.org/CVERecord?id=CVE-2026-45363
58+
notes: "CVE has been reserved, but not filled out."

0 commit comments

Comments
 (0)