MEDIUM · CVSS 4.0 EPSS 0.6% · 41th percentile CWE-184CWE-79

CVE-2026-126209: Loofah allowed_uri? treats javascript&#x3a 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

How to check your project

Automated analysis of the published advisory data, generated 2026-11-18. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
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 vectorNetwork
Attack complexityLow
Attack requirementsNone
Privileges requiredNone
User interactionPassive
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
## 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&#x3a 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 `&#x3a alert` decodes as `&#x3aa` (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 `&#x6a\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.

References

Source records: GHSA-p9wj-w8xq-vjx6 (OSV.dev) · EPSS by FIRST, 2026-11-26.