CVE-2026-126206: Loofah HTML5 Scrub XSS bypass via HTML entity encoding in data URIs

CVE-2026-126206 · Severity: medium · Published 2026-11-12

Loofah is a library that sanitizes HTML to prevent malicious content. An attacker can bypass its URI validation by encoding special characters as HTML entities (like / for /), causing the library to misidentify a data:text/html URI as the safe text/plain type. This could allow injected JavaScript to execute in users' browsers when an application uses Loofah to validate user-supplied URLs.

Technologies: Loofah, loofah (RubyGems). Vendors: Loofah, Ruby on Rails, RubyGems.

Quick answers

Is CVE-2026-126206 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-126206 being exploited in the wild.
How severe is CVE-2026-126206?
Medium severity, published 12 November 2026.
Which products and versions are affected?
Loofah before 2.25.3; Ruby on Rails Rails::HTML::Sanitizer unknown; loofah (RubyGems) = 2.25.2.
Is there a fix for CVE-2026-126206?
Yes: fixed in Loofah 2.25.3. Until then: Upgrade Loofah to version 2.25.3 or later. Note that the default sanitize() path is not affected as Nokogiri decodes entities during parsing; only direct callers of the allowed_uri? helper with HTML-encoded input are vulnerable. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-126206 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-126206?
Check whether you run Loofah, Ruby on Rails Rails::HTML::Sanitizer or loofah (RubyGems) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • Fixed in: Loofah 2.25.3

Upgrade Loofah to version 2.25.3 or later. Note that the default sanitize() path is not affected as Nokogiri decodes entities during parsing; only direct callers of the allowed_uri? helper with HTML-encoded input are vulnerable.

Technical details

The allowed_uri? method uses CGI.unescapeHTML which only decodes numeric character references, not HTML5 named character references. When / survives normalization, the MIME type lacks a forward slash and is treated as malformed, falling back to the allowed text/plain type. A browser decoding the same entity reads it as text/html, creating a parsing divergence that enables XSS injection via crafted data URIs using :, /, 	, or 
 entities.

Affected products

  • Loofah Loofah before 2.25.3
  • Ruby on Rails Rails::HTML::Sanitizer unknown

Identifiers

  • CVE-2026-126206
  • GHSA-jcff-cj73-4w4f

Timeline

  • 2026-11-12: disclosed

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.