CVE-2026-126203: Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values
Published 2026-11-12 · Updated 2026-11-12 · Also known as GHSA-h6v6-rg66-fqj4
Summary
Loofah contains a mutation XSS vulnerability in its HTML5 scrubbers due to unescaped attribute values. Engineering teams maintaining applications that sanitize untrusted HTML using Loofah's HTML5 API should update their dependencies.
Who is affected
Applications using Loofah's HTML5 API (`Loofah.html5_fragment`, `Loofah.html5_document`, and `scrub_html5_*` methods) to sanitize untrusted HTML and display it to users are affected, even with the default allowlist. The issue allows browsers to parse scrubbed output into different markup, executing cross-site scripting under specific conditions involving MathML or WebKit browsers depending on the scrubber used.
Exploitability
The vulnerability has a CVSS score of 6.1 (Medium) with a vector of CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N, indicating it can be exploited remotely over the network with low complexity, requiring user interaction and resulting in scoped changes with low confidentiality and integrity impact. Its EPSS score is 0.003, and it is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
Remediation
- Upgrade Loofah to version 2.25.3 or greater.
- Upgrade Nokogiri to version 1.19.5 or greater.
How to check your project
- Check project dependency files (such as Gemfile.lock) for RubyGems loofah versions introduced at 2.21.0 and prior to 2.25.3.
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 |
>= 2.21.0, < 2.25.3 | 2.25.3 | bundle update loofah |
CVSS 3.1 vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
| Attack vector | Network |
|---|---|
| Attack complexity | Low |
| Privileges required | None |
| User interaction | Required |
| Scope | Changed |
| Confidentiality | Low |
| Integrity | Low |
| Availability | None |
FAQ
Are applications using Loofah's HTML4 API affected?
No, Loofah's HTML4 API, including Loofah::Helpers.sanitize, is not affected.
Does JRuby suffer from this vulnerability?
No, JRuby environments are not affected.
Is the default configuration of rails-html-sanitizer affected?
No, rails-html-sanitizer's default configuration is not affected.
Original advisory description
References
- WEB https://github.com/flavorjones/loofah/security/advisories/GHSA-h6v6-rg66-fqj4
- WEB https://github.com/flavorjones/loofah/pull/324
- WEB https://github.com/sparklemotion/nokogiri/pull/3741
- WEB https://github.com/flavorjones/loofah/commit/7ba1e7b77e043fb7dc832ef746fcbf83137135e6
- WEB https://github.com/sparklemotion/nokogiri/commit/635abc8d65c75d594ddf8957fbfbfd822c2c0dbd
- 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-h6v6-rg66-fqj4.yml
- WEB https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5
Source records: GHSA-h6v6-rg66-fqj4 (OSV.dev) · EPSS by FIRST, 2026-11-26.