All vulnerabilities

RubyGems

CVE-2026-141529

Addressable::Template builds its regexp in quadratic time for patterns with non-ASCII characters or many adjacent expressions

Severity
Low 3.7
Published
1 Dec 2026
Last changed
2 Dec 2026
Added to UpHeron
2 Dec 2026
Fixed in
2.10.0
Exploit chance
0.6% in the next 30 daysHigher than 51% of CVEs. EPSS by FIRST, 2 Dec 2026
Weakness
Inefficient algorithmic complexity (CWE-407)
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Slow it down
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
Also known as
GHSA-h78h-gj97-g737
Sources
OSV.dev and GitHub

Description

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.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

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.
Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
addressableRubyGems · osv:RubyGems:addressable
  • From 2.9.1 before 2.10.0

About addressable

Total downloads (RubyGems)
1,323,514,580RubyGems, 1 Dec 2026

References