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
- Upgrade rails-html-sanitizer to version 1.7.2 or later.
- Upgrade to Ruby 3.2 or later, which matches the pattern in linear time.
- Remove SVG reference elements from overridden allowed tags if upgrading is not immediately possible.
How to check your project
- Check the project's Gemfile.lock or dependency manifest to determine if the rails-html-sanitizer gem version falls within the range >= 1.0.3 and < 1.7.2.
- Review application configuration to verify whether allowed tags and attributes are overridden to include SVG reference elements like use with href or xlink:href.
Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| 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 vector | Network |
|---|---|
| Attack complexity | Low |
| Privileges required | None |
| User interaction | None |
| Scope | Unchanged |
| Confidentiality | None |
| Integrity | None |
| Availability | Low |
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
References
- WEB https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-cpgf-5mjf-73p7
- WEB https://github.com/rails/rails-html-sanitizer/commit/f776f963b9d9346271aade9cb903e793fd38e865
- PACKAGE https://github.com/rails/rails-html-sanitizer
- WEB https://github.com/rails/rails-html-sanitizer/releases/tag/v1.7.2
- WEB https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rails-html-sanitizer/GHSA-cpgf-5mjf-73p7.yml
Source records: GHSA-cpgf-5mjf-73p7 (OSV.dev) · EPSS by FIRST, 2026-11-21.