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

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

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 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 vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityNone
IntegrityNone
AvailabilityLow

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
## Summary Loofah's HTML5 sanitizer 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. 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. The default safelist allows the elements in `SVG_ALLOW_LOCAL_HREF`, so no configuration change is required. ## Mitigation Upgrade to Loofah >= 2.25.3. Applications that cannot upgrade should run Ruby 3.2 or later, which matches the pattern in linear time. ## Credit Reported by scyoon through the Rails HackerOne program.

References

Source records: GHSA-mf2j-8f84-cc9q (OSV.dev) · EPSS by FIRST, 2026-11-26.