CVE-2026-126205
Loofah: Regular expression denial of service in the SVG local-reference check
CVE-2026-126205 is a medium vulnerability (CVSS 5.3) in Flavorjones Loofah, published November 12, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.40%, the 35th percentile. Fixed in loofah 2.25.3.
- Severity
- 5.3 MediumCVSS 3.1, CVE List
- Exploit chance
- 0.40%EPSS, 35th percentile
- Exploitation
- None knownNot on CISA’s or ENISA’s lists
- Fixed in
2.25.3loofah +8 more
Description
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- Low
Exploit likelihood
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
loofahRubyGems | before 2.25.3 | 2.25.3 |
loofahRubyGems | before 2.25.3, plus listed versions 0.2.00.2.10.2.20.3.00.3.1 Show 45 moreShow less0.4.00.4.10.4.20.4.30.4.40.4.50.4.60.4.71.0.01.0.0.beta.11.1.01.2.01.2.12.0.02.0.12.0.22.0.32.1.02.1.0.rc12.1.0.rc22.1.12.10.02.11.02.12.02.13.02.14.02.15.02.16.02.17.02.18.02.19.02.19.12.2.02.2.12.2.22.2.32.20.02.21.02.21.0.rc12.21.12.21.22.21.32.21.42.22.02.23.0 | 2.25.3 |
ruby-loofahUbuntu:16.04:LTS | All versions, plus listed versions 2.0.2-12.0.3-12.0.3-22.0.3-2+deb9u1build0.16.04.12.0.3-2+deb9u2build0.16.04.12.0.3-2+deb9u3build0.16.04.1 | None known |
ruby-loofahUbuntu:18.04:LTS | All versions, plus listed versions 2.0.3-22.2.2-1 | None known |
ruby-loofahUbuntu:20.04:LTS | All versions, plus listed versions 2.2.3-12.3.1+dfsg-12.4.0+dfsg-1 | None known |
ruby-loofahUbuntu:22.04:LTS | All versions, plus listed versions 2.12.0-12.13.0-12.13.0-2 | None known |
ruby-loofahUbuntu:24.04:LTS | All versions, plus listed versions 2.21.3-12.21.4-12.22.0-1 | None known |
ruby-loofahUbuntu:26.10 | All versions, plus listed versions 2.25.0-12.25.1-22.25.2-1 | None known |
ruby-loofahUbuntu:26.04:LTS | All versions, plus listed versions 2.24.1-12.25.0-1 | None known |
What each source reports
CVE List Score used 5.3
Loofah: Regular expression denial of service in the SVG local-reference check
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.
- Record
CVE-2026-126205- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L - Weakness
- CWE-400, CWE-1333
- Updated
- 2026-11-12
EUVDEUVD-2026-124678 5.3
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.
- Record
EUVD-2026-124678- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L - Updated
- 2026-11-12
GitHub AdvisoriesGHSA-mf2j-8f84-cc9q 5.3
Loofah: Regular expression denial of service in the SVG local-reference check
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.
- Record
GHSA-mf2j-8f84-cc9q- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L - Weakness
- CWE-400, CWE-1333
- Updated
- 2026-11-12
NVD 5.3
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.
- Record
CVE-2026-126205- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L - Weakness
- CWE-400, CWE-1333
- Updated
- 2026-11-12
OSV 5.3
Loofah: Regular expression denial of service in the SVG local-reference check
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.
- Record
CVE-2026-126205- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L - Weakness
- CWE-1333, CWE-400
- Updated
- 2026-11-14
OSVGHSA-mf2j-8f84-cc9q 5.3
Loofah: Regular expression denial of service in the SVG local-reference check
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.
- Record
GHSA-mf2j-8f84-cc9q- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L - Weakness
- CWE-1333, CWE-400
- Updated
- 2026-11-12
OSVUBUNTU-CVE-2026-126205 5.3
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.
- Record
UBUNTU-CVE-2026-126205- CVSS 3.1
- 5.3 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L - Updated
- 2026-11-13
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, aliases, references | OSV | |
| references | OSV | |
| published | EUVD, NVD | |
| published | EUVD | |
| description, references, severity | CVE List | |
| affected, references | OSV | |
| aliases, products, published | EUVD | |
| first indexed | GitHub Advisories |
Dates are when Every CVE recorded each change. Upstream dates may differ.
References
github.com/flavorjones/loofah/security/advisories/GHSA-mf2j-8f84-cc9q
github.com/flavorjones/loofah/pull/324
github.com/flavorjones/loofah/commit/2f31e7fae36036c9882d3d0fae720e1014c57cd1
github.com/flavorjones/loofah/releases/tag/v2.25.3
github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-mf2j-8f84-cc9q.yml
github.com/advisories/GHSA-mf2j-8f84-cc9q
Left out here: 15 versions. The JSON record has them.