MEDIUM · CVSS 3.1 6.1 EPSS 0.4% · 22th percentile CWE-116CWE-79

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

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 >= 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 vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionRequired
ScopeChanged
ConfidentialityLow
IntegrityLow
AvailabilityNone

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
## Summary Loofah's HTML5 scrubbers could emit output that a browser parses into different markup, allowing mutation XSS. Nokogiri < 1.19.5 did not escape `<` and `>` in attribute values. When the output contained certain MathML, a browser treated markup inside an allowed attribute as live HTML. The `:strip` scrubber is affected in every browser. The `:prune` and `:escape` scrubbers are affected in WebKit browsers such as Safari. Nokogiri 1.19.5 escapes `<` and `>` in attribute values, as the HTML standard requires. Loofah 2.25.3 requires Nokogiri >= 1.19.5. ## Impact Applications that sanitize untrusted HTML with Loofah's HTML5 API (`Loofah.html5_fragment`, `Loofah.html5_document` and the `scrub_html5_*` methods) and display the result to other people are affected, including with the default allowlist. Not affected: Loofah's HTML4 API (including `Loofah::Helpers.sanitize`), the `:whitewash` scrubber, rails-html-sanitizer's default configuration, and JRuby. ## Mitigation Upgrade to Loofah >= 2.25.3, or upgrade Nokogiri to >= 1.19.5.

References

Source records: GHSA-h6v6-rg66-fqj4 (OSV.dev) · EPSS by FIRST, 2026-11-26.