GHSA-JRFQ-GW62-2F3J

Vulnerability from github – Published: 2026-12-01 23:38 – Updated: 2026-12-01 23:38
VLAI
Summary
Addressable: Regular Expression Denial of Service in Addressable templates on MRI Ruby 3.2 and TruffleRuby
Details

Impact

Addressable 2.9.1 changed the regular expressions generated for URI templates to fix GHSA-9f42-57jx-vpp3 and GHSA-4w5q-wg7v-w6gp. The new regular expressions contain lookaround assertions for some expressions, such as {a}{b}, {a,b}, {/a,b}, {?a*,b} and expressions with an exploded variable followed by unexploded ones. MRI Ruby 3.2 doesn't memoize a regular expression that contains a lookaround, and memoization is decided for the whole template's regular expression, so one such expression makes the rest of the template backtrack as on older Rubies. TruffleRuby 40.0 also backtracks for some of these regular expressions.

As a result, templates that 2.9.0 matched in linear time on these runtimes are polynomial since 2.9.1. On MRI Ruby 3.2, this includes templates that combine a common shape with one of those expressions, such as /{year}-{month}-{day}/{a}{b}. 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, on MRI Ruby 3.2:

  • /{year}-{month}-{day}/{a}{b} takes 12 seconds to reject 2 KB of input. With 2.9.0, it takes under 0.001 seconds.
  • {?a,a*,a*}{a*}{.a*,b*,c} takes over 15 seconds to reject 2 KB of input. With 2.9.0, it takes 0.001 seconds.
  • {?a*,b,c*} takes about 1 second to reject 19 KB of input. With 2.9.0, it takes 0.003 seconds.
  • {a,b}{c,d}{e,f} takes 2.9 seconds to reject 1 KB of input. With 2.9.0, it takes under 0.001 seconds.

On TruffleRuby 40.0, {?a,a*,a*}{a*}{.a*,b*,c} takes over 10 minutes to reject 2 KB of input, and {?a*,b,c*} takes 7.7 seconds to reject 19 KB. With 2.9.0, each takes under 0.01 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.9.1, including 2.9.2, on MRI Ruby 3.2 and TruffleRuby 40.0. 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}.

MRI Ruby 3.3 and later memoize regular expressions with lookarounds and are not affected. On MRI Ruby < 3.2 and JRuby, which don't memoize, these templates were already slow with 2.9.0 and are covered by GHSA-xj9m-f88p-5j38, GHSA-xfg6-27c4-wr4r and GHSA-grhv-8jgq-r74x. MRI Ruby 3.2 reached its end of life on 2026-03-31. 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 Not affected by this issue
MRI Ruby 3.1 Not affected by this issue
MRI Ruby 3.2 Vulnerable
MRI Ruby 3.3 Not affected
MRI Ruby 4.0 Not affected
JRuby 9.4 Not affected by this issue
TruffleRuby 40.0 Vulnerable

Workarounds

  • Upgrade to MRI Ruby 3.3 or later.
  • 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, including TruffleRuby, where a timeout doesn't.
  • On MRI Ruby 3.2, 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. On TruffleRuby, it doesn't stop a regular expression match.
  • On MRI Ruby 3.2, setting Regexp.timeout makes a slow match raise Regexp::TimeoutError. It applies to every regular expression in the process.

Credits

Found by Bob Aman (@sporkmonger).

For more information

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

Show details on source website

{
  "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-141525"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-1333"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-12-01T23:38:16Z",
    "nvd_published_at": "2026-12-01T21:17:12Z",
    "severity": "MODERATE"
  },
  "details": "### Impact\n\nAddressable 2.9.1 changed the regular expressions generated for URI templates to fix GHSA-9f42-57jx-vpp3 and GHSA-4w5q-wg7v-w6gp. The new regular expressions contain lookaround assertions for some expressions, such as `{a}{b}`, `{a,b}`, `{/a,b}`, `{?a*,b}` and expressions with an exploded variable followed by unexploded ones. MRI Ruby 3.2 doesn\u0027t memoize a regular expression that contains a lookaround, and memoization is decided for the whole template\u0027s regular expression, so one such expression makes the rest of the template backtrack as on older Rubies. TruffleRuby 40.0 also backtracks for some of these regular expressions.\n\nAs a result, templates that 2.9.0 matched in linear time on these runtimes are polynomial since 2.9.1. On MRI Ruby 3.2, this includes templates that combine a common shape with one of those expressions, such as `/{year}-{month}-{day}/{a}{b}`. 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.\n\nWith 2.9.2, on MRI Ruby 3.2:\n\n- `/{year}-{month}-{day}/{a}{b}` takes 12 seconds to reject 2 KB of input. With 2.9.0, it takes under 0.001 seconds.\n- `{?a,a*,a*}{a*}{.a*,b*,c}` takes over 15 seconds to reject 2 KB of input. With 2.9.0, it takes 0.001 seconds.\n- `{?a*,b,c*}` takes about 1 second to reject 19 KB of input. With 2.9.0, it takes 0.003 seconds.\n- `{a,b}{c,d}{e,f}` takes 2.9 seconds to reject 1 KB of input. With 2.9.0, it takes under 0.001 seconds.\n\nOn TruffleRuby 40.0, `{?a,a*,a*}{a*}{.a*,b*,c}` takes over 10 minutes to reject 2 KB of input, and `{?a*,b,c*}` takes 7.7 seconds to reject 19 KB. With 2.9.0, each takes under 0.01 seconds.\n\nUsers of the URI parsing capabilities in Addressable but not the URI template matching capabilities are unaffected. Users who only call `Template#expand` are unaffected.\n\n### Affected Versions\n\nThis vulnerability affects Addressable \u003e= 2.9.1, including 2.9.2, on MRI Ruby 3.2 and TruffleRuby 40.0. It is fixed in 2.10.0, with two exceptions where matching can still take polynomial time on MRI Ruby \u003c 3.3, JRuby and TruffleRuby: when a processor\u0027s `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}{\u0026b}.{b}`.\n\nMRI Ruby 3.3 and later memoize regular expressions with lookarounds and are not affected. On MRI Ruby \u003c 3.2 and JRuby, which don\u0027t memoize, these templates were already slow with 2.9.0 and are covered by GHSA-xj9m-f88p-5j38, GHSA-xfg6-27c4-wr4r and GHSA-grhv-8jgq-r74x. MRI Ruby 3.2 reached its end of life on 2026-03-31. Earlier TruffleRuby versions were not tested.\n\nThis has been confirmed on the following runtimes with Addressable 2.9.2:\n\n| Runtime | Status |\n|---------|--------|\n| MRI Ruby 2.7 | Not affected by this issue |\n| MRI Ruby 3.1 | Not affected by this issue |\n| MRI Ruby 3.2 | Vulnerable |\n| MRI Ruby 3.3 | Not affected |\n| MRI Ruby 4.0 | Not affected |\n| JRuby 9.4 | Not affected by this issue |\n| TruffleRuby 40.0 | Vulnerable |\n\n### Workarounds\n\n- Upgrade to MRI Ruby 3.3 or later.\n- 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, including TruffleRuby, where a timeout doesn\u0027t.\n- On MRI Ruby 3.2, 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\u0027t safe in every application. On TruffleRuby, it doesn\u0027t stop a regular expression match.\n- On MRI Ruby 3.2, setting `Regexp.timeout` makes a slow match raise `Regexp::TimeoutError`. It applies to every regular expression in the process.\n\n### Credits\n\nFound by Bob Aman (@sporkmonger).\n\n### For more information\n\nIf there are any questions or comments about this advisory:\n* [Open an issue](https://github.com/sporkmonger/addressable/issues)",
  "id": "GHSA-jrfq-gw62-2f3j",
  "modified": "2026-12-01T23:38:16Z",
  "published": "2026-12-01T23:38:16Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/sporkmonger/addressable/security/advisories/GHSA-jrfq-gw62-2f3j"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-141525"
    },
    {
      "type": "WEB",
      "url": "https://github.com/sporkmonger/addressable/commit/576662e4791df3cfd17c944041a98f516d3c0734"
    },
    {
      "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:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Addressable: Regular Expression Denial of Service in Addressable templates on MRI Ruby 3.2 and TruffleRuby"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

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.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

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

JSON
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.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    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.