{"id":"GHSA-v6hg-69pc-4f3f","summary":"Addressable URI normalization takes quadratic time on long runs of combining marks","details":"### Impact\n\nNormalizing a URI that contains a long run of combining marks takes time quadratic in the length of the run. A 16 kB path takes about 2 seconds of CPU time. The marks can also be pct-encoded, so a URI with only ASCII characters triggers it. An attacker who can submit a URI that an application normalizes, compares or matches against a template can hold a worker for seconds per request, and for over a minute with longer input. There is no confidentiality or integrity impact.\n\n`String#unicode_normalize` orders the combining marks after a character with a loop that is quadratic in their number, and Addressable calls it on attacker-controlled text. It is reached from:\n\n- `URI.normalize_component`, so `#normalize`, `#normalized_path` and the other `normalized_*` methods, `#==`, `#===`, `#display_uri`, `#route_from` and `#route_to`\n- `URI.normalized_encode`\n- `Template#expand`, `#match` and `#extract`\n- `IDNA.to_ascii` with the pure-Ruby IDNA implementation, for hosts. With the native implementation (libidn), the host is linear.\n\n`URI.parse` by itself doesn't normalize and is unaffected.\n\n### Affected Versions\n\nThis vulnerability affects Addressable \u003e= 2.0.0. Versions 2.0.0 through 2.2.4 are affected on every Ruby. From 2.2.5 on, it affects only Rubies whose `String#unicode_normalize` has the quadratic loop: every Ruby 3.2 release and earlier, 3.3.0 through 3.3.10 and 3.4.0 through 3.4.7. Ruby 3.3.11, 3.4.8 and 4.0.0 fixed the loop. It is fixed in 2.10.0 on every Ruby, where a run of more than 30 combining marks, the limit of the Stream-Safe Text Format in UAX #15, is left as it is instead of being normalized. The text around it is normalized as before.\n\n### Workarounds\n\n- Upgrade to Ruby 3.3.11, 3.4.8, 4.0.0 or later, if you use Addressable 2.2.5 or later.\n- Otherwise, limit the length of URIs before normalizing them, or reject input with long runs of combining marks, such as `/\\p{M}{31,}/` after pct-decoding.\n\n### Proof of Concept\n\nThe script normalizes, compares and expands URIs with 8,000 combining marks, as they are and pct-encoded. It makes no network requests.\n\n```ruby\nrequire \"addressable/uri\"\nrequire \"addressable/template\"\n\ndef seconds\n  started = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n  yield\n  (Process.clock_gettime(Process::CLOCK_MONOTONIC) - started).round(2)\nend\n\n# Ruby caches each normalized unit, so each call uses different marks.\npath = \"\\u0301\\u0323\" * 4000                # 16 kB\nencoded = \"%CC%80%CC%A4\" * 4000             # 48 kB, ASCII only\nvalue = \"\\u0302\\u0325\" * 4000\n\nputs \"ruby #{RUBY_VERSION}\"\nputs \"normalize: #{seconds { Addressable::URI.parse(\"http://example.com/a#{path}\").normalize }} s\"\nputs \"==:        #{seconds { Addressable::URI.parse(\"http://example.com/a#{encoded}\") == Addressable::URI.parse(\"http://example.com/\") }} s\"\nputs \"expand:    #{seconds { Addressable::Template.new(\"/{x}\").expand(\"x\" =\u003e \"a#{value}\") }} s\"\n```\n\nOutput with 2.9.2:\n\n```\nruby 3.2.11\nnormalize: 2.08 s\n==:        2.07 s\nexpand:    2.08 s\n\nruby 4.0.9\nnormalize: 0.01 s\n==:        0.01 s\nexpand:    0.01 s\n```\n\nOutput with the fix:\n\n```\nruby 3.2.11\nnormalize: 0.01 s\n==:        0.01 s\nexpand:    0.0 s\n```\n\n\n### Credits\n\nReported by Patrik Ragnarsson (@dentarg), who also provided the fix.\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)","aliases":["CVE-2026-141537"],"modified":"2026-12-02T00:15:03.574779585Z","published":"2026-12-01T23:53:53Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2026-12-01T23:53:53Z","nvd_published_at":null,"cwe_ids":["CWE-407"],"severity":"LOW"},"references":[{"type":"WEB","url":"https://github.com/sporkmonger/addressable/security/advisories/GHSA-v6hg-69pc-4f3f"},{"type":"WEB","url":"https://github.com/sporkmonger/addressable/commit/971be7cf4b484d4fed43dad57d5c8d967b5d08e6"},{"type":"PACKAGE","url":"https://github.com/sporkmonger/addressable"},{"type":"WEB","url":"https://github.com/sporkmonger/addressable/releases/tag/addressable-2.10.0"}],"affected":[{"package":{"name":"addressable","ecosystem":"RubyGems","purl":"pkg:gem/addressable"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.0.0"},{"fixed":"2.10.0"}]}],"versions":["2.0.0","2.0.1","2.0.2","2.1.0","2.1.1","2.1.2","2.2.0","2.2.1","2.2.2","2.2.3","2.2.4","2.2.5","2.2.6","2.2.7","2.2.8","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.3.8","2.4.0","2.5.0","2.5.1","2.5.2","2.6.0","2.7.0","2.8.0","2.8.1","2.8.10","2.8.2","2.8.3","2.8.4","2.8.5","2.8.6","2.8.7","2.8.8","2.8.9","2.9.0","2.9.1","2.9.2"],"database_specific":{"last_known_affected_version_range":"\u003c= 2.9.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-v6hg-69pc-4f3f/GHSA-v6hg-69pc-4f3f.json"}}],"schema_version":"1.9.2","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L"}]}