Mutation XSS in Loofah HTML5 scrubbers via unescaped attribute values
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- Low · Low · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-79.
Summary
Loofah from 2.21.0 before 2.25.3 can emit sanitized HTML that a browser reparses as different markup when used with Nokogiri before 1.19.5, which does not escape angle brackets in attribute values (CWE-116). MathML can place markup inside an allowed attribute, so the output becomes live HTML for a user who views it. The :strip scrubber is affected in every browser, while :prune and :escape are affected in WebKit browsers.
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. From 2.21.0 until 2.25.3, Loofah's HTML5 APIs Loofah.html5_fragment, Loofah.html5_document, and the scrub_html5_* methods can emit sanitized output that a browser reparses as different markup when used with Nokogiri before 1.19.5, because those Nokogiri versions do not escape angle brackets in attribute values. MathML can place markup inside an allowed attribute so the reparsed output becomes live HTML. The :strip scrubber is affected in every browser, while :prune and :escape are affected in WebKit browsers. Loofah's HTML4 APIs, Loofah::Helpers.sanitize, :whitewash, rails-html-sanitizer's default configuration, and JRuby are not affected. 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
- No
- 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 | 2.21.0 to before 2.25.3 | 2.25.3 | Patch available | CNA |
| — | loofah (RubyGems) | 2.21.0 to before 2.25.3 | 2.25.3 | Patch available | GHSA-h6v6-rg66-fqj4 |
- loofah Vendorflavorjones Affected 2.21.0 to before 2.25.3 Fixed in 2.25.3 Patch available CNA
- loofah (RubyGems) Vendor— Affected 2.21.0 to before 2.25.3 Fixed in 2.25.3 Patch available GHSA-h6v6-rg66-fqj4
Remediation
Upgrade the RubyGems package loofah from 2.21.0 before 2.25.3 to version 2.25.3. Nokogiri versions before 1.19.5 do not escape angle brackets in attribute values, so upgrade Nokogiri to 1.19.5 or later as well.
Written with Claude Haiku 5.5 from the sources below · 2026-11-13
- Fix · CNA loofah (flavorjones) Fixed in 2.25.3
- Fix · GHSA-h6v6-rg66-fqj4 loofah (RubyGems) Fixed in 2.25.3 Advisory →
Timeline
- 2026-11-12 Threatist record created from CVE-2026-126203
- 2026-11-12 CISA SSVC decision points changed
- 2026-11-12 Alias added: GHSA-h6v6-rg66-fqj4
- 2026-11-12 Fix available: RubyGems/[email protected] · GHSA-h6v6-rg66-fqj4
- 2026-11-12 CVSS score added · GHSA-h6v6-rg66-fqj4
- 2026-11-12 Weakness changed · GHSA-h6v6-rg66-fqj4
- 2026-11-12 9 new references · GHSA-h6v6-rg66-fqj4
References
Other 9
- https://github.com/flavorjones/loofah/security/advisories/GHSA-h6v6-rg66-fqj4
- https://github.com/flavorjones/loofah/pull/324
- https://github.com/sparklemotion/nokogiri/pull/3741
- https://github.com/flavorjones/loofah/commit/7ba1e7b77e043fb7dc832ef746fcbf83137135e6
- https://github.com/sparklemotion/nokogiri/commit/635abc8d65c75d594ddf8957fbfbfd822c2c0dbd
- https://github.com/flavorjones/loofah/releases/tag/v2.25.3
- https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5
- https://github.com/flavorjones/loofah
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-h6v6-rg66-fqj4.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-2026-91016 Regular expression denial of service in Loofah SVG local-reference check CVSS 3.1MEDIUM 5.3
- TI-2022-07577 Improper neutralization of data URIs allows XSS in rails-html-sanitizer CVSS 3.1MEDIUM 6.1
Sources
- CVE-2026-126203 · CVE Program
- CVE-2026-126203 · NVD
- FIRST EPSS
- GHSA-h6v6-rg66-fqj4 · 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