CVE-2026-126209: Loofah allowed_uri? treats javascript: alert(1) as safe
Published 2026-11-12 · Updated 2026-11-12 · Also known as GHSA-p9wj-w8xq-vjx6
Summary
Loofah's `allowed_uri?` function improperly handles numeric character references in JavaScript and VBScript URIs, treating malicious schemes as safe. Developers using Loofah version 2.25.0 up to 2.25.3 must upgrade to secure their applications.
Who is affected
Applications that directly call the public `allowed_uri?` string-level helper (or `Rails::HTML::Sanitizer.allowed_uri?`) with HTML-encoded strings to validate user-controlled URLs may be vulnerable to cross-site scripting. When the approved value is rendered into an `href` or browser-interpreted URI attribute, a browser can execute arbitrary script content due to improper scheme parsing. Loofah's default `sanitize()` path is not affected.
Exploitability
The vulnerability has a CVSS 4.0 base score and vector indicating network attack vector, low complexity, and requires user interaction. The EPSS score is 0.004 with a percentile of 0.364, and CISA Known Exploited Vulnerabilities status is no, meaning active exploitation is not documented.
Remediation
- Upgrade the RubyGems loofah package to version 2.25.3 or later.
How to check your project
- Check Gemfile.lock or equivalent dependency manifests for loofah versions between 2.25.0 and 2.25.3.
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.0, < 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 the default sanitize() path affected?
No, Loofah's default sanitize() path is not affected because Nokogiri decodes the entity during parsing before Loofah evaluates the URI.
Does this vulnerability affect Rails::HTML::Sanitizer?
Yes, Rails::HTML::Sanitizer.allowed_uri? re-exports the same helper method and is similarly affected when processing vulnerable inputs.
Which package versions are affected?
RubyGems loofah introduced in version 2.25.0 and fixed in version 2.25.3.
Original advisory description
References
- WEB https://github.com/flavorjones/loofah/security/advisories/GHSA-p9wj-w8xq-vjx6
- WEB https://github.com/flavorjones/loofah/pull/324
- WEB https://github.com/flavorjones/loofah/commit/62c04841e8252a1b5373afcd2b89fb9b8279e317
- 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-p9wj-w8xq-vjx6.yml
Source records: GHSA-p9wj-w8xq-vjx6 (OSV.dev) · EPSS by FIRST, 2026-11-26.