CVE-2026-126203 — Loofah: Mutation XSS in loofah — CVE Details
Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.35%). Schedule for your next planned update.
Does your project use an affected loofah version?
Paste your Gemfile.lock to check it for CVE-2026-126203 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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.
Advisory Timeline
- First published November 12, 2026 (14 days ago).
- Last revised November 12, 2026 — 0 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
gem install loofah -v 2.25.3
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: RubyGems (1).
| Package | Fixed In |
|---|---|
| loofah RubyGems · Affected: 2.21.0, 2.21.1, 2.21.2, 2.21.3 (+9 more) | 2.25.3 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.1 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
References
- https://github.com/flavorjones/loofah/security/advisories/GHSA-h6v6-rg66-fqj4WEB
- https://github.com/flavorjones/loofah/pull/324WEB
- https://github.com/sparklemotion/nokogiri/pull/3741WEB
- https://github.com/flavorjones/loofah/commit/7ba1e7b77e043fb7dc832ef746fcbf83137135e6WEB
- https://github.com/sparklemotion/nokogiri/commit/635abc8d65c75d594ddf8957fbfbfd822c2c0dbdWEB
- https://github.com/flavorjones/loofahPACKAGE
- https://github.com/flavorjones/loofah/releases/tag/v2.25.3WEB
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-h6v6-rg66-fqj4.ymlWEB
- https://github.com/sparklemotion/nokogiri/releases/tag/v1.19.5WEB
Frequently Asked Questions
- What is CVE-2026-126203?
- Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.1/10).
- How do I check if my project is affected by CVE-2026-126203?
- CVE-2026-126203 affects loofah. It has a 0.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-126203 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Exploitation requires specific conditions, or the impact is limited.
This is a below-median EPSS score — only 21.5% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.
Also Known As
Related CVEs
- CVE-2022-23516HIGH
Uncontrolled Recursion in Loofah
- CVE-2022-23514HIGH
Inefficient Regular Expression Complexity in Loofah
- CVE-2022-23515MEDIUM
Improper neutralization of data URIs may allow XSS in Loofah
- CVE-2026-73490MEDIUM
Loofah: SVG `href` attribute bypasses local-reference restriction
- CVE-2026-126206MEDIUM
Loofah allowed_uri? treats data:text/html as safe text/plain
- GHSA-46fp-8f5p-pf2mLOW
Improper detection of disallowed URIs by Loofah `allowed_uri?`
- CVE-2026-73492LOW
Loofah `allowed_uri?` does not detect `javascript:` URIs split by numeric character references without semicolons
- CVE-2026-73491LOW
Loofah `allowed_uri?` does not detect `javascript:` URIs split by named whitespace character references