CVE-2026-126205: Loofah: Regular expression denial of service in the SVG local-reference check
Published 2026-11-12 · Updated 2026-11-12 · Also known as GHSA-mf2j-8f84-cc9q
Summary
Loofah contains a regular expression denial of service (ReDoS) vulnerability in its SVG attribute sanitizer that triggers quadratic complexity when processing long whitespace strings. Engineering teams using Ruby 3.1 or earlier should upgrade to Loofah 2.25.3 or migrate to Ruby 3.2+.
Who is affected
The vulnerability affects applications that use Loofah to sanitize untrusted HTML/SVG input containing 'href' or 'xlink:href' attributes. By providing a long run of whitespace as an attribute value, an attacker can trigger excessive CPU consumption. This issue is specific to Ruby versions prior to 3.2, which lack linear-time regular expression matching for this pattern.
Exploitability
The vulnerability carries a CVSS 3.1 base score of 5.3 (Medium), indicating a low-complexity network-based attack that requires no special privileges or user interaction. With an EPSS score of 0.004, the probability of exploitation is currently low, and CISA has not listed this as a known exploited vulnerability.
Remediation
- Upgrade the loofah gem to version 2.25.3 or higher.
- Upgrade to Ruby 3.2 or later to benefit from linear-time regular expression matching.
How to check your project
- Check the Gemfile.lock file for the loofah version entry.
- Use 'bundle info loofah' to verify the currently installed version in your environment.
- Check the Ruby environment version using 'ruby -v' to determine if your runtime is susceptible to the non-linear regular expression matching.
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 | loofah |
>= 0, < 2.25.3 | 2.25.3 | bundle update loofah |
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
Is this vulnerability exploitable on Ruby 3.2 or later?
No, Ruby 3.2 introduced linear-time regular expression matching, which mitigates the quadratic complexity issue caused by the regex pattern.
Do I need to change my Loofah configuration to fix this?
No, the fix is handled within the library's internal logic; no configuration changes regarding the SVG safelist are required.
Is there any evidence of active exploitation?
No, CISA has not listed this vulnerability as a known exploited vulnerability (KEV).
Original advisory description
References
- WEB https://github.com/flavorjones/loofah/security/advisories/GHSA-mf2j-8f84-cc9q
- WEB https://github.com/flavorjones/loofah/pull/324
- WEB https://github.com/flavorjones/loofah/commit/2f31e7fae36036c9882d3d0fae720e1014c57cd1
- PACKAGE https://github.com/flavorjones/loofah
- WEB https://github.com/flavorjones/loofah/releases/tag/v2.25.3
- WEB https://github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-mf2j-8f84-cc9q.yml
Source records: GHSA-mf2j-8f84-cc9q (OSV.dev) · EPSS by FIRST, 2026-11-26.