CVE-2026-126209 — Vulnerability in loofah — CVE Details
Loofah allowed_uri? treats javascript: alert(1) as safe
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (0.58%). Schedule for your next planned update.
Does your project use an affected loofah version?
Paste your Gemfile.lock to check it for CVE-2026-126209 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 javascript: or vbscript: URI whose scheme is split by a numeric character reference without a trailing semicolon, followed by a character that allowed_uri? strips, such as a space or tab. A browser ends the reference at that character and reads javascript: alert(1) as javascript: alert(1).
Details
allowed_uri? strips control characters and whitespace before it decodes numeric character references. Removing the character that ends a semicolon-less reference lets the reference run on into the following text, so : alert decodes as Ϊ (U+03AA) instead of a colon, and no scheme is detected. The same applies to decimal references and to references that encode a scheme letter, as in j\tavascript:alert(1).
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 @manus-pi.
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.0, 2.25.1, 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-p9wj-w8xq-vjx6WEB
- https://github.com/flavorjones/loofah/pull/324WEB
- https://github.com/flavorjones/loofah/commit/62c04841e8252a1b5373afcd2b89fb9b8279e317WEB
- 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-p9wj-w8xq-vjx6.ymlWEB
Frequently Asked Questions
- What is CVE-2026-126209?
- Loofah allowed_uri? treats javascript: alert(1) as safe. 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-126209?
- CVE-2026-126209 affects loofah. It has a 0.6% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-126209 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 41.3% 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