CVE-2026-126206: Loofah allowed_uri? treats data:text/html as safe text/plain
Published 2026-11-12 · Updated 2026-11-12 · Also known as GHSA-jcff-cj73-4w4f
Summary
Loofah's `allowed_uri?` helper incorrectly treats `data:` URIs containing HTML5 named character references like `/` as safe text/plain because it fails to fully normalize entities, while browsers decode them as `text/html`. Applications that directly call `allowed_uri?` on HTML-encoded strings should upgrade to secure their validation logic.
Who is affected
Applications that validate user-controlled URLs using the public `Loofah::HTML5::Scrub.allowed_uri?` helper (or its re-export in `Rails::HTML::Sanitizer.allowed_uri?`) and render the approved values into URI attributes are vulnerable to cross-site scripting. The issue specifically requires callers to pass HTML-encoded strings directly to the helper function. Loofah's default `sanitize()` path is not affected because Nokogiri decodes the entity during parsing beforehand.
Exploitability
The vulnerability has a CVSS 4.0 base vector indicating network attack vector, low attack complexity, no required privileges, and user interaction, potentially leading to low confidentiality and integrity impact on the scope. The EPSS score is 0.004, and CISA KEV lists active exploitation as no.
Remediation
- Upgrade the RubyGems package loofah to version 2.25.3 or later.
How to check your project
- Check Gemfile.lock or equivalent dependency manifests for the loofah gem version falling within the range introduced 2.25.2 and fixed 2.25.3.
- Search codebases for direct calls to `Loofah::HTML5::Scrub.allowed_uri?` or `Rails::HTML::Sanitizer.allowed_uri?`.
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.25.2, < 2.25.3 | 2.25.3 | bundle update loofah |
CVSS 4.0 vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
| Attack vector | Network |
|---|---|
| Attack complexity | Low |
| Attack requirements | None |
| Privileges required | None |
| User interaction | Passive |
| Confidentiality (vulnerable system) | None |
| Integrity (vulnerable system) | None |
| Availability (vulnerable system) | None |
| Confidentiality (subsequent systems) | Low |
| Integrity (subsequent systems) | Low |
| Availability (subsequent systems) | None |
Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.
FAQ
Is Loofah's default sanitize() method affected?
No, the default sanitize() path is not affected because Nokogiri decodes entities during parsing before Loofah evaluates the URI.
Which specific components are vulnerable?
Callers of the public `Loofah::HTML5::Scrub.allowed_uri?` string-level helper and `Rails::HTML::Sanitizer.allowed_uri?` that pass HTML-encoded strings are affected.
What is the fixed version for Loofah?
The vulnerability is fixed in Loofah version 2.25.3.
Original advisory description
References
- WEB https://github.com/flavorjones/loofah/security/advisories/GHSA-jcff-cj73-4w4f
- WEB https://github.com/flavorjones/loofah/pull/324
- WEB https://github.com/flavorjones/loofah/commit/ad92002966053309f83b550861e2ef04bc714744
- 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-jcff-cj73-4w4f.yml
Source records: GHSA-jcff-cj73-4w4f (OSV.dev) · EPSS by FIRST, 2026-11-26.