GHSA-H78H-GJ97-G737
Vulnerability from github – Published: 2026-12-01 23:48 – Updated: 2026-12-01 23:48Impact
Addressable::Template builds a regular expression from its pattern the first time it's needed, by #match, #extract, #to_regexp, #variables (and its aliases #keys and #names), #variable_defaults or #freeze. When the pattern has non-ASCII characters, or a long run of expressions with no literal text between them (such as {a}{b}{c}), building it takes time quadratic in the pattern's length. A non-ASCII pattern of a few hundred kilobytes takes seconds on MRI and longer on JRuby. A run of 5,000 expressions, 15 KB, takes about 4 seconds on MRI and 8 seconds on JRuby. Other templates build in linear time.
The cost is in the pattern, not in the URI being matched, so only an application that builds templates from untrusted input is affected. Matching untrusted URIs against the application's own templates isn't. The regular expression is cached on the template, so the cost is paid once per template, except that #match and #extract with a processor build it on every call. #expand and #partial_expand don't build it and aren't affected.
Templates from untrusted sources are uncommon, and the attacker needs a pattern of many kilobytes to cause a delay of seconds, so attack complexity is high.
Affected Versions
This vulnerability affects Addressable >= 2.9.1. Version 2.9.1 added a step that looks at what follows each expression. It finds each expression's position by character offset, and for each expression it looks through every later expression with no literal text before it, so either kind of pattern makes building the regular expression quadratic. It is fixed in 2.10.0, where the step works in byte offsets and in a single pass.
Workarounds
- Don't match, extract, list the variables of or freeze templates from untrusted sources, or limit their length.
- Reject templates with non-ASCII characters, or pct-encode those characters before building the template, and reject templates with long runs of expressions next to each other.
Proof of Concept
require "addressable/template"
[10_000, 20_000].each do |count|
template = Addressable::Template.new("é{a}" * count)
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
template.to_regexp
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started
puts "%6d expressions: %.2fs" % [count, elapsed]
end
On affected versions, doubling the number of expressions roughly triples to quadruples the time. On fixed versions, and with a in place of é on any version, it roughly doubles.
The same holds for expressions next to each other, at smaller sizes:
require "addressable/template"
[2_500, 5_000].each do |count|
template = Addressable::Template.new("{a}" * count)
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
template.to_regexp
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started
puts "%6d expressions: %.2fs" % [count, elapsed]
end
On affected versions, doubling the number of expressions quadruples the time. On fixed versions, and with a{a} in place of {a} on any version, it roughly doubles.
Credits
Found by Bob Aman (@sporkmonger).
For more information
If ther are any questions or comments about this advisory: * Open an issue
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 2.9.2"
},
"package": {
"ecosystem": "RubyGems",
"name": "addressable"
},
"ranges": [
{
"events": [
{
"introduced": "2.9.1"
},
{
"fixed": "2.10.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-141529"
],
"database_specific": {
"cwe_ids": [
"CWE-407"
],
"github_reviewed": true,
"github_reviewed_at": "2026-12-01T23:48:42Z",
"nvd_published_at": "2026-12-01T21:17:12Z",
"severity": "LOW"
},
"details": "### Impact\n\n`Addressable::Template` builds a regular expression from its pattern the first time it\u0027s needed, by `#match`, `#extract`, `#to_regexp`, `#variables` (and its aliases `#keys` and `#names`), `#variable_defaults` or `#freeze`. When the pattern has non-ASCII characters, or a long run of expressions with no literal text between them (such as `{a}{b}{c}`), building it takes time quadratic in the pattern\u0027s length. A non-ASCII pattern of a few hundred kilobytes takes seconds on MRI and longer on JRuby. A run of 5,000 expressions, 15 KB, takes about 4 seconds on MRI and 8 seconds on JRuby. Other templates build in linear time.\n\nThe cost is in the pattern, not in the URI being matched, so only an application that builds templates from untrusted input is affected. Matching untrusted URIs against the application\u0027s own templates isn\u0027t. The regular expression is cached on the template, so the cost is paid once per template, except that `#match` and `#extract` with a processor build it on every call. `#expand` and `#partial_expand` don\u0027t build it and aren\u0027t affected.\n\nTemplates from untrusted sources are uncommon, and the attacker needs a pattern of many kilobytes to cause a delay of seconds, so attack complexity is high.\n\n### Affected Versions\n\nThis vulnerability affects Addressable \u003e= 2.9.1. Version 2.9.1 added a step that looks at what follows each expression. It finds each expression\u0027s position by character offset, and for each expression it looks through every later expression with no literal text before it, so either kind of pattern makes building the regular expression quadratic. It is fixed in 2.10.0, where the step works in byte offsets and in a single pass.\n\n### Workarounds\n\n- Don\u0027t match, extract, list the variables of or freeze templates from untrusted sources, or limit their length.\n- Reject templates with non-ASCII characters, or pct-encode those characters before building the template, and reject templates with long runs of expressions next to each other.\n\n### Proof of Concept\n\n```ruby\nrequire \"addressable/template\"\n\n[10_000, 20_000].each do |count|\n template = Addressable::Template.new(\"\u00e9{a}\" * count)\n started = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n template.to_regexp\n elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started\n puts \"%6d expressions: %.2fs\" % [count, elapsed]\nend\n```\n\nOn affected versions, doubling the number of expressions roughly triples to quadruples the time. On fixed versions, and with `a` in place of `\u00e9` on any version, it roughly doubles.\n\nThe same holds for expressions next to each other, at smaller sizes:\n\n```ruby\nrequire \"addressable/template\"\n\n[2_500, 5_000].each do |count|\n template = Addressable::Template.new(\"{a}\" * count)\n started = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n template.to_regexp\n elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started\n puts \"%6d expressions: %.2fs\" % [count, elapsed]\nend\n```\n\nOn affected versions, doubling the number of expressions quadruples the time. On fixed versions, and with `a{a}` in place of `{a}` on any version, it roughly doubles.\n\n### Credits\n\nFound by Bob Aman (@sporkmonger).\n\n### For more information\n\nIf ther are any questions or comments about this advisory:\n* [Open an issue](https://github.com/sporkmonger/addressable/issues)",
"id": "GHSA-h78h-gj97-g737",
"modified": "2026-12-01T23:48:42Z",
"published": "2026-12-01T23:48:42Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/sporkmonger/addressable/security/advisories/GHSA-h78h-gj97-g737"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-141529"
},
{
"type": "WEB",
"url": "https://github.com/sporkmonger/addressable/commit/ebe911f8623bcc664d2e6df079c96c325ad181c8"
},
{
"type": "PACKAGE",
"url": "https://github.com/sporkmonger/addressable"
},
{
"type": "WEB",
"url": "https://github.com/sporkmonger/addressable/releases/tag/addressable-2.10.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L",
"type": "CVSS_V3"
}
],
"summary": "Addressable::Template builds its regexp in quadratic time for patterns with non-ASCII characters or many adjacent expressions"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
How durations are calculated
Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.
Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.