CVE-2026-126209: Loofah allowed_uri? treats javascript&#x3a alert(1) as safe

Published Nov 12, 2026
·
Updated

Summary

Loofah::HTML5::Scrub.alloweduri? 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 alloweduri? 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

alloweduri? 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 alloweduri? string-level helper that pass it HTML-encoded strings.

Impact

Applications that validate a user-controlled URL with Loofah::HTML5::Scrub.alloweduri? 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.alloweduri? re-exports the same helper.

Mitigation

Upgrade to Loofah >= 2.25.3.

Credit

Responsibly reported by GitHub user @manus-pi.

Other sources

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. From 2.25.0 until 2.25.3, Loofah::HTML5::Scrub.alloweduri? strips whitespace and control characters before decoding a semicolon-less numeric character reference, changing where the reference ends and hiding a javascript: or vbscript: scheme that a browser reconstructs. The bypass applies to encoded colons and encoded scheme letters when a stripped character terminates the numeric reference. An application that renders the approved value in href or another browser-interpreted URI attribute can allow cross-site scripting, and Rails::HTML::Sanitizer.alloweduri? re-exports the affected helper. Loofah's default sanitize() path is not affected because Nokogiri decodes entities before URI evaluation. This issue is fixed in version 2.25.3.

— MITRE

Affected Software

1 affected componentFixes available
rubygems/loofah>=2.25.0<2.25.3
2.25.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade rubygems/loofah to a version that resolves this vulnerability.

    Fixed in 2.25.3
  2. Upgrade

    Upgrade Loofah to a version that resolves this vulnerability.

    Fixed in 2.25.3

Event History

Nov 12, 2026
CVE Published
via MITRE·09:01 PM
Data Sourced
via MITRE·09:01 PM
DescriptionWeakness
Data Sourced
via NVD·09:17 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·09:26 PM
Data Sourced
via GitHub·09:26 PM
DescriptionWeaknessAffected Software
Data Sourced
via OSV·09:26 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Are applications using Loofah's default sanitization affected?

No. The default sanitize() path is not affected because Nokogiri decodes the entity during parsing before Loofah evaluates the URI.

2

What conditions are required for exploitation?

An application must call Loofah::HTML5::Scrub.allowed_uri? directly on an HTML-encoded, user-controlled URL and then render a URL that was approved by that check. The crafted value uses a semicolon-less numeric character reference split from the scheme by whitespace or a control character.

3

How can I determine whether my application is exposed?

Review code for direct uses of Loofah::HTML5::Scrub.allowed_uri? that receive HTML-encoded strings. Calls relying only on Loofah's default sanitize() path are not affected.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203