---
id: "CVE-2026-126209"
page: "https://infrastack.ai/live/CVE-2026-126209"
kind: "vulnerability"
aliases: ["CVE-2026-126209", "GHSA-p9wj-w8xq-vjx6"]
title: "Loofah allowed_uri? treats javascript&#x3a alert(1) as safe"
severity: "medium"
cvss: 5.3
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "loofah", "fixed": ["2.25.3"], "affected": ">= 2.25.0, < 2.25.3", "ecosystem": "rubygems"}]
ecosystems: ["rubygems"]
tags: ["cwe-184", "cwe-79", "loofah", "package", "rails", "ruby", "web-apps"]
not_affected_if: ["default-sanitize-only", "no-allowed_uri-calls"]
published_at: "2026-11-12T21:17:22+00:00"
first_seen_at: "2026-11-12T21:29:46+00:00"
updated_at: "2026-11-12T21:40:31+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-p9wj-w8xq-vjx6", "first_seen_at": "2026-11-12T21:29:46+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-126209", "first_seen_at": "2026-11-12T21:40:31+00:00"}]
exploit_sources: []
---

# Loofah allowed_uri? treats javascript&#x3a alert(1) as safe

Link for people: https://infrastack.ai/live/CVE-2026-126209 (this .md is for agents)

Loofah's allowed_uri? helper accepts javascript: and vbscript: URLs when the scheme is hidden in a numeric character reference without a semicolon, followed by a space or tab. If an application renders that approved value into an href, a browser runs the script, which is cross-site scripting.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- rubygems:loofah affected >= 2.25.0, < 2.25.3 fixed 2.25.3

## How to check

- Search your Gemfile.lock for `loofah` and note the version.
- Search your code for calls to `allowed_uri?` (Loofah::HTML5::Scrub or Rails::HTML::Sanitizer) whose results are placed in href or other URI attributes.
- Default `sanitize()` use is not affected according to the advisory.

## Fix

- Loofah `2.25.3` (affected range `>= 2.25.0, < 2.25.3`)

## Timeline

- 2026-11-12T21:29:46+00:00 ghsa https://github.com/advisories/GHSA-p9wj-w8xq-vjx6
- 2026-11-12T21:40:31+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-126209

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/flavorjones/loofah/security-advisories/GHSA-p9wj-w8xq-vjx6
- [advisory] Maintainer's advisory: github.com https://github.com/flavorjones/loofah/security/advisories/GHSA-p9wj-w8xq-vjx6
- [fix] Patch: github.com https://github.com/flavorjones/loofah/pull/324
- [fix] Patch: github.com https://github.com/flavorjones/loofah/commit/62c04841e8252a1b5373afcd2b89fb9b8279e317
- [fix] Release notes: github.com https://github.com/flavorjones/loofah/releases/tag/v2.25.3

## From the sources

## 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.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
