Regular expression denial of service in Loofah SVG local-reference check
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-1333.
Summary
Loofah versions before 2.25.3 contain a regular expression denial of service flaw in the HTML5 sanitizer's check of href and xlink:href on SVG elements, caused by inefficient regular expression complexity. An unauthenticated remote attacker can submit an SVG reference element with a long multiline whitespace attribute, consuming CPU in a quadratic manner during sanitization. CRuby 3.1 and earlier and JRuby are affected, while CRuby 3.2 and later use linear-time matching. The default safelist reaches the vulnerable check without configuration changes.
Written with Claude Haiku 5.5 from the sources below · 2026-11-13
Description from the CNA
Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. Prior to 2.25.3, the Loofah HTML5 sanitizer checks href and xlink:href on elements in SVG_ALLOW_LOCAL_HREF with a regular expression whose line anchor and newline-matching whitespace cause an all-whitespace value to be rescanned from every line start. An attacker can submit an SVG reference element with a long multiline-whitespace attribute and consume CPU quadratically during sanitization. CRuby 3.1 and earlier and JRuby are affected, while CRuby 3.2 and later uses linear-time regular-expression matching. The default safelist reaches the vulnerable check without a configuration change. This issue is fixed in version 2.25.3.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| flavorjones | loofah | before 2.25.3 | 2.25.3 | Patch available | CNA |
| — | loofah (RubyGems) | before 2.25.3 | 2.25.3 | Patch available | GHSA-mf2j-8f84-cc9q |
- loofah Vendorflavorjones Affected before 2.25.3 Fixed in 2.25.3 Patch available CNA
- loofah (RubyGems) Vendor— Affected before 2.25.3 Fixed in 2.25.3 Patch available GHSA-mf2j-8f84-cc9q
Remediation
Upgrade Loofah to version 2.25.3, which fixes the issue. The sources list no fixed version for JRuby.
Written with Claude Haiku 5.5 from the sources below · 2026-11-13
- Fix · CNA loofah (flavorjones) Fixed in 2.25.3
- Fix · GHSA-mf2j-8f84-cc9q loofah (RubyGems) Fixed in 2.25.3 Advisory →
Timeline
- 2026-11-12 Threatist record created from CVE-2026-126205
- 2026-11-12 Alias added: GHSA-mf2j-8f84-cc9q
- 2026-11-12 Fix available: RubyGems/[email protected] · GHSA-mf2j-8f84-cc9q
- 2026-11-12 CVSS score added · GHSA-mf2j-8f84-cc9q
- 2026-11-12 Weakness changed · GHSA-mf2j-8f84-cc9q
- 2026-11-12 6 new references · GHSA-mf2j-8f84-cc9q
- 2026-11-16 CISA SSVC decision points changed
References
Other 6
- https://github.com/flavorjones/loofah/security/advisories/GHSA-mf2j-8f84-cc9q
- https://github.com/flavorjones/loofah/pull/324
- https://github.com/flavorjones/loofah/commit/2f31e7fae36036c9882d3d0fae720e1014c57cd1
- https://github.com/flavorjones/loofah/releases/tag/v2.25.3
- https://github.com/flavorjones/loofah
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-mf2j-8f84-cc9q.yml
More flavorjones vulnerabilities
- TI-2022-07573 Inefficient Regular Expression Complexity in Loofah CVSS 3.1HIGH 7.5
- TI-2022-07575 Uncontrolled Recursion in Loofah CVSS 3.1HIGH 7.5
- TI-2018-05825 In the Loofah gem through 2.2.0 for Ruby, non-whitelisted HTML attributes may occur in… CVSS 3.0MEDIUM 6.1
- TI-2026-91019 Cross-site scripting in Loofah URI validation via encoded data URIs CVSS 4.0MEDIUM 5.3
- TI-2022-07577 Improper neutralization of data URIs allows XSS in rails-html-sanitizer CVSS 3.1MEDIUM 6.1
- TI-2022-07574 Improper neutralization of data URIs may allow XSS in Loofah CVSS 3.1MEDIUM 6.1
Sources
- CVE-2026-126205 · CVE Program
- CVE-2026-126205 · NVD
- FIRST EPSS
- GHSA-mf2j-8f84-cc9q · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences