---
id: "CVE-2026-126352"
page: "https://infrastack.ai/live/CVE-2026-126352"
kind: "vulnerability"
aliases: ["CVE-2026-126352", "GHSA-9f42-57jx-vpp3"]
title: "Addressable: Regular Expression Denial of Service in templates with multiple variables"
severity: "medium"
cvss: 5.9
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "addressable", "fixed": ["2.9.1"], "affected": ">= 2.3.0, < 2.9.1", "ecosystem": "rubygems"}]
ecosystems: ["rubygems"]
tags: ["addressable", "cwe-1333", "package", "rails", "ruby", "rubygems"]
not_affected_if: ["expand-only", "mri-ruby-3.3-or-later", "no-user-supplied-uris", "uri-parsing-only"]
published_at: "2026-11-12T22:19:20+00:00"
first_seen_at: "2026-11-12T22:31:51+00:00"
updated_at: "2026-11-12T22:40:38+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-9f42-57jx-vpp3", "first_seen_at": "2026-11-12T22:31:51+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-126352", "first_seen_at": "2026-11-12T22:40:38+00:00"}]
exploit_sources: []
---

# Addressable: Regular Expression Denial of Service in templates with multiple variables

Link for people: https://infrastack.ai/live/CVE-2026-126352 (this .md is for agents)

Addressable's URI template matcher builds regular expressions that backtrack excessively when a template has several variables in one expression. A crafted URI passed to Template#match or Template#extract can tie up a thread for seconds, causing denial of service.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- rubygems:addressable affected >= 2.3.0, < 2.9.1 fixed 2.9.1

## How to check

- Check the locked version in Gemfile.lock for `addressable` and see whether it is at least `2.9.1`.
- Run `ruby -v` to confirm the runtime; MRI Ruby 3.3 or later is not affected by any form, per the advisory.
- Search the codebase for `Template#match` or `Template#extract` calls that process user-supplied URIs.

## Timeline

- 2026-11-12T22:31:51+00:00 ghsa https://github.com/advisories/GHSA-9f42-57jx-vpp3
- 2026-11-12T22:40:38+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-126352

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/sporkmonger/addressable/security-advisories/GHSA-9f42-57jx-vpp3
- [advisory] Maintainer's advisory: github.com https://github.com/sporkmonger/addressable/security/advisories/GHSA-9f42-57jx-vpp3
- [fix] Patch: github.com https://github.com/sporkmonger/addressable/commit/f2b27b3ab252e56b3fa3519f7ebb491d54cf7b7c
- [fix] Release: github.com https://github.com/sporkmonger/addressable/releases/tag/addressable-2.9.1

## From the sources

### Impact

Within the URI template implementation in Addressable, templates that put several variables in one expression generate regular expressions vulnerable to excessive backtracking:

1. Expressions with any operator other than `+` and `#` (e.g., `{/owner,repo,ref}`, `{.a,b}`, `{a,b,c}`, `{;a,b,c}`). The values are joined by an optional separator, so a run of characters can be divided among the variables in O(n^k) ways for k variables.
2. Expressions with the `+` or `#` operators and many variables (e.g., `{+v1,v2,v3,v4,v5,v6,v7,v8,v9,v10}`). A failing match is exponential in the number of variables.
3. Several single-variable expressions next to each other (e.g., `{+a}{+b}{+c}` or `{a}{b}{c}`), which are polynomial in the input length.

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. A three-variable path template such as `http://example.com/repos{/owner,repo,ref}` needs about 2 KB of input to occupy a thread for many seconds.

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.0. It is fixed in 2.9.1.

The vulnerability is exploitable on Ruby implementations whose regular expression engine backtracks without memoization: MRI Ruby < 3.2 and JRuby. The second form, many-variable `+` and `#` expressions, is also exploitable on MRI Ruby 3.2, which does not memoize a regular expression that contains possessive quantifiers, and 2.9.0 generates those for these operators. It is also exploitable on TruffleRuby 40.0, whose regular expression engine falls back to backtracking for them. MRI Ruby 3.3 and later are not affected by any form, because they memoize those regular expressions too. TruffleRuby 40.0 is not affected by the other two forms. Earlier TruffleRuby versions were not tested.

This has been confirmed on the following runtimes with Addressable 2.9.0:

| 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 3.4 | Not affected |
| MRI Ruby 4.0 | Not affected |
| JRuby 9.4 | Vulnerable |
| JRuby 10.1 | Vulnerable |
| TruffleRuby 40.0 | Vulnerable |

### Workarounds

- Upgrade to MRI Ruby 3.3 or later, if a consuming application does not use JRuby or TruffleRuby.
- Avoid matching user-supplied input on unpatched versions of the library against templates with several variables in one expression, or with several expressions next to each other.
- Apply a short timeout around any call to `Template#match` or `Template#extract` that processes user-supplied data.

### Credits

Reported by Matthew Mongeau (@halogenandtoast), Ruby Central Gem Security.

### For more information

If there are any questions or comments about this advisory:
* [Open an issue](https://github.com/sporkmonger/addressable/issues)

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
