Within the URI template implementation in Addressable, some templates with several variables still generate regular expressions vulnerable to excessive backtracking. GHSA-9f42-57jx-vpp3 reported these templates and listed 2.9.1 as patched, but its fix didn't cover these shapes:
{+a,b,c},{+d} or {+v1,v2,v3,v4,v5,v6,v7,v8}{c*}, or, with exploded variables, {c*,d*},{+a*}). A run of commas can be divided between the expression's last variable and what follows it in O(n^2) ways, and the cost grows quickly with the number of variables, especially exploded ones.{+a,c,c,c}). Its regular expression is the one 2.9.0 generated, which is cubic in the input length for this example.{a,b}{c} or {a,b}{c,d}{e,f}). The 2.9.1 fix for this form, GHSA-9f42-57jx-vpp3's third, only covered an expression with one variable followed by another expression. A run of characters can be divided among the adjacent variables in O(n^k) ways.The first two shapes are GHSA-9f42-57jx-vpp3's second form, and behave as they did in 2.9.0.
When Template#match or Template#extract is called with a maliciously crafted URI, this can result in uncontrolled resource consumption, leading to denial of service. With 2.9.2, {+v1,v2,v3,v4,v5,v6,v7,v8}{c*} takes about 4 seconds to reject 200 bytes of input on MRI Ruby 2.7 and 3.2, and over 15 seconds on JRuby and TruffleRuby, ,{c*,d*,a*},{+a*}.json takes 3.6 seconds to reject 206 bytes on MRI Ruby 2.7 and 3.2, and over 5 seconds on JRuby, and {a,b}{c,d}{e,f} takes 2.6 seconds to reject 1 KB on MRI Ruby 2.7 and over 15 seconds on JRuby.
Users of the URI parsing capabilities in Addressable but not the URI template matching capabilities are unaffected. Users who only call Template#expand are unaffected.
This vulnerability affects Addressable >= 2.3.0 (note: 2.3.0 and 2.3.1 were yanked; the earliest installable release is 2.3.2), including 2.9.2. It is fixed in 2.10.0, with two exceptions where matching can still take polynomial time on MRI Ruby < 3.3, JRuby and TruffleRuby: when a processor's match method gives a variable its own pattern, since 2.10.0 then keeps every choice open, as earlier versions did, so that the pattern decides the values; and for some templates that combine an exploded variable, or several variables in one expression, with other expressions, such as {+c*,d}{&b}.{b}.
The vulnerability is exploitable on Ruby implementations whose regular expression engine backtracks without memoization: MRI Ruby < 3.2 and JRuby. The first two shapes are also exploitable on MRI Ruby 3.2, which does not memoize their regular expressions, and on TruffleRuby 40.0, whose regular expression engine falls back to backtracking for them. The third shape is fast on MRI Ruby 3.2 and TruffleRuby 40.0 with 2.9.0; since 2.9.1 it is slow on MRI Ruby 3.2 for the reason described in GHSA-jrfq-gw62-2f3j. MRI Ruby 3.3 and later are not affected. Earlier TruffleRuby versions were not tested.
This has been confirmed on the following runtimes with Addressable 2.9.2:
| Runtime | Status |
|---|---|
| MRI Ruby 2.7 | Vulnerable |
| MRI Ruby 3.1 | Vulnerable |
| MRI Ruby 3.2 | Vulnerable |
| MRI Ruby 3.3 | Not affected |
| MRI Ruby 4.0 | Not affected |
| JRuby 9.4 | Vulnerable |
| TruffleRuby 40.0 | Vulnerable (first two shapes) |
+ or # expression followed by a comma or another expression, with a variable name repeated in one expression, or with expressions next to each other where one has several variables.Timeout.timeout, around any call to Template#match or Template#extract that processes user-supplied data. It interrupts the matching thread at an arbitrary point, so it isn't safe in every application. On TruffleRuby, it doesn't stop a regular expression match.Regexp.timeout makes a slow match raise Regexp::TimeoutError. It applies to every regular expression in the process.Found by Bob Aman (@sporkmonger).
If there are any questions or comments about this advisory:
{
"cwe_ids": [
"CWE-1333"
],
"github_reviewed": true,
"github_reviewed_at": "2026-12-01T23:47:52Z",
"nvd_published_at": "2026-12-01T21:17:12Z",
"severity": "MODERATE"
}