CVE-2026-141527: Addressable: Regular Expression Denial of Service in templates with literal text between expressions

Published Dec 1, 2026
·
Updated

Impact

Within the URI template implementation in Addressable, templates with literal text between expressions generate regular expressions vulnerable to excessive backtracking when a variable before the literal text can also match it. Realistic templates are affected:

- /{year}-{month}-{day}, where each variable can contain - - /v{major}.{minor}.{patch}, where each variable can contain . - {+base}/{+path}/{+file}, where each variable can contain / - {+path}/{name}-{+rest}, where path can contain / and name can contain -

A run of the literal's characters can be divided among k variables in O(n^k) ways. 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, /{year}-{month}-{day} and {+base}/{+path}/{+file} each take about 10 seconds to reject 2 KB of input on MRI Ruby 2.7, and over 15 seconds on JRuby. Because the cost is cubic for these templates, request-size limits of a few kilobytes don't prevent it.

GHSA-9f42-57jx-vpp3 covered expressions next to each other with no literal text between them. This shape wasn't covered by that advisory or its fix.

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.

Affected Versions

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. MRI Ruby 3.2 and later and TruffleRuby 40.0 are not affected by this issue, except that since 2.9.1, some templates that combine this shape with other expressions are slow on MRI Ruby 3.2, as described in GHSA-jrfq-gw62-2f3j. 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 | Not affected by this issue | | MRI Ruby 3.3 | Not affected | | MRI Ruby 4.0 | Not affected | | JRuby 9.4 | Vulnerable | | TruffleRuby 40.0 | Not affected |

Workarounds

- Upgrade to MRI Ruby 3.3 or later, if your application does not use JRuby. - Limit the length of user-supplied URIs before matching them. Because the cost is polynomial, this only bounds it, but it works on every runtime. - Apply a short timeout, such as 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.

Credits

Found by Bob Aman (@sporkmonger).

For more information

If there are any questions or comments about this advisory: Open an issue

Other sources

Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. From 2.3.0 until 2.10.0, Addressable URI templates containing literal text between expressions generate ambiguous regular expressions when a preceding variable can also consume that literal text on MRI Ruby before 3.2 and JRuby. Calling Template#match or Template#extract with a crafted URI can cause polynomial backtracking and denial of service. The remediation does not cover processor-supplied variable patterns or certain templates that combine exploded or multi-variable expressions with other expressions, which can remain polynomial on MRI Ruby before 3.3, JRuby, and TruffleRuby. This issue is fixed in version 2.10.0.

— MITRE

Affected Software

3 affected componentsFixes available
rubygems/addressable>=2.3.0<2.10.0
rubygems/addressable>=2.3.0<=2.9.2
2.10.0
rubygems/addressable>=2.3.0<2.10.0
2.10.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rubygems/addressable to a version that resolves this vulnerability.

    Fixed in 2.10.0
  2. Upgrade

    Upgrade Addressable to a version that resolves this vulnerability.

    Fixed in 2.10.0
  3. Upgrade

    Upgrade MRI Ruby to a version that resolves this vulnerability.

    Fixed in 3.3
  4. Compensating control

    Apply a short timeout, such as Timeout.timeout, around calls to Template#match or Template#extract that process user-supplied data; note that this can interrupt the matching thread at an arbitrary point and may not be safe for every application.

  5. Compensating control

    Limit the length of user-supplied URIs before matching them.

Event History

Dec 1, 2026
CVE Published
via MITRE·09:01 PM
Data Sourced
via MITRE·09:01 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·11:39 PM
Data Sourced
via GitHub·11:39 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·11:39 PM
Affected Software

Frequently Asked Questions

1

Which deployments are exposed to this denial-of-service issue?

Deployments using Addressable versions 2.3.0 through versions before 2.10.0 are affected when they match or extract URI templates containing literal text between expressions. The ambiguous regular expression behavior applies on MRI Ruby before 3.2 and on JRuby.

2

What must an attacker provide to trigger the issue?

An attacker needs to cause Template#match or Template#extract to process a crafted URI against a susceptible template. No privileges or user interaction are required according to the supplied vector.

3

Does upgrading to 2.10.0 eliminate all related polynomial-backtracking cases?

No. The remediation does not cover processor-supplied variable patterns or certain templates that combine exploded or multi-variable expressions with other expressions; those cases can remain polynomial on MRI Ruby before 3.3, JRuby, and TruffleRuby.

4

What is the available remediation?

Upgrade Addressable to version 2.10.0. For cases outside the remediation scope, review templates for processor-supplied variable patterns and combinations of exploded or multi-variable expressions with other expressions.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203