CVE-2026-126206 — Vulnerability in loofah — CVE Details
Loofah allowed_uri? treats data:text/html as safe text/plain
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.55%). Schedule for your next planned update.
Does your project use an affected loofah version?
Paste your Gemfile.lock to check it for CVE-2026-126206 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::HTML5::Scrub.allowed_uri? returns true for a data: URI whose mediatype is written with the HTML5 named character reference / in place of the solidus. Loofah reads that mediatype as malformed and falls back to the allowed text/plain, while a browser decodes the reference and reads the same URI as text/html.
Details
allowed_uri? decodes HTML entities with CGI.unescapeHTML, which handles numeric character references but not HTML5 named character references. / therefore survives normalization, so the mediatype carries no /, fails the MIME grammar, and falls back to the allowed text/plain under the WHATWG rule for a malformed mediatype.
:, /, 	 and 
 are the only named character references in the HTML5 table that decode to characters that change how a URI parses (U+003A, U+002F, U+0009 and U+000A; there is no named reference for U+000D), so this closes the set.
Loofah's default sanitize() path is not affected, because Nokogiri decodes the entity during parsing before Loofah evaluates the URI. This issue affects only callers of the public allowed_uri? string-level helper that pass it HTML-encoded strings.
Impact
Applications that validate a user-controlled URL with Loofah::HTML5::Scrub.allowed_uri? and then render the approved value into an href or another browser-interpreted URI attribute may be vulnerable to cross-site scripting. Rails::HTML::Sanitizer.allowed_uri? re-exports the same helper.
Mitigation
Upgrade to Loofah >= 2.25.3.
Credit
Responsibly reported by GitHub user @ngpestelos.
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.25.2 | 2.25.3 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-184
- CWE-79Cross-site Scripting (XSS)MITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 6.1 score means for each attack dimension.
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
References
- https://github.com/flavorjones/loofah/security/advisories/GHSA-jcff-cj73-4w4fWEB
- https://github.com/flavorjones/loofah/pull/324WEB
- https://github.com/flavorjones/loofah/commit/ad92002966053309f83b550861e2ef04bc714744WEB
- 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-jcff-cj73-4w4f.ymlWEB
Frequently Asked Questions
- What is CVE-2026-126206?
- Loofah allowed_uri? treats data:text/html as safe text/plain. 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-126206?
- CVE-2026-126206 affects loofah. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-126206 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 39.4% 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-126203MEDIUM
Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values
- 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