MEDIUM · CVSS 3.1 5.3 EPSS 0.5% · 40th percentile CWE-1333CWE-400

CVE-2026-128068: rails-html-sanitizer: Possible regular expression denial of service with certain configurations

Published 2026-11-13 · Updated 2026-11-13 · Also known as GHSA-cpgf-5mjf-73p7

Summary

A regular expression denial of service vulnerability exists in rails-html-sanitizer due to inefficient handling of specific href attribute values. Engineering teams using vulnerable versions of rails-html-sanitizer on Ruby 3.1 and earlier with custom SVG configurations should update.

Who is affected

Applications utilizing rails-html-sanitizer are affected only when allowed tags are overridden to include an SVG reference element such as use alongside href or xlink:href in allowed attributes on Ruby 3.1 or earlier. An attacker can supply a long run of whitespace in these attributes to consume excessive CPU resources and cause a denial of service. The default configuration is not affected since default allowed tags include no SVG elements.

Exploitability

The vulnerability is network-exploitable with low attack complexity, requiring no privileges or user interaction, resulting in a low availability impact with a CVSS base score of 5.3. The EPSS score is 0.005, and it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
RubyGems rails-html-sanitizer >= 1.0.3, < 1.7.2 1.7.2 bundle update rails-html-sanitizer

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Attack vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityNone
IntegrityNone
AvailabilityLow

FAQ

What causes the vulnerability in rails-html-sanitizer?

The vulnerability is caused by a regular expression (/^\s*[^#\s].*/m) used to check href and xlink:href attributes of SVG reference elements, where all-whitespace values cause quadratic time complexity on Ruby 3.1 and earlier.

Are default configurations of rails-html-sanitizer vulnerable?

No, the default configuration is not affected because the default allowed tags include no SVG elements.

Does Ruby version affect this vulnerability?

Yes. Only Ruby 3.1 and earlier are affected because Ruby 3.2 added linear-time regexp matching which renders the pattern linear.

Original advisory description
## Summary `Rails::HTML::PermitScrubber` restricts the `href` and `xlink:href` attributes of SVG reference elements to local references. That check matched the attribute value against `/^\s*[^#\s].*/m`. In Ruby `^` anchors to every line start and `\s` matches newlines, so an all-whitespace value made the engine rescan the value from each of its line starts, taking time quadratic in its length. - Versions affected: `>= 1.0.3, < 1.7.2` - Not affected: `< 1.0.3` - Fixed versions: `1.7.2` Only Ruby 3.1 and earlier are affected. Ruby 3.2 added linear-time regexp matching, which makes the pattern linear. ## Impact An attacker who supplies HTML to be sanitized can consume CPU out of proportion to the input size, by sending an SVG reference element whose `href` or `xlink:href` is a long run of whitespace. Applications are affected only when the allowed tags are overridden to include an SVG reference element such as `use`, along with `href` or `xlink:href` in the allowed attributes. The default allowed tags include no SVG elements, so the default configuration is not affected. Applications that use Loofah directly are exposed through its own copy of the check, fixed in Loofah 2.25.3. ## Workarounds Run Ruby 3.2 or later, which matches the pattern in linear time, or remove the SVG reference elements from the overridden allowed tags. ## Credit Reported by scyoon through the Rails HackerOne program.

References

Source records: GHSA-cpgf-5mjf-73p7 (OSV.dev) · EPSS by FIRST, 2026-11-21.