---
id: "CVE-2026-126206"
page: "https://infrastack.ai/live/CVE-2026-126206"
kind: "vulnerability"
aliases: ["CVE-2026-126206", "GHSA-jcff-cj73-4w4f"]
title: "Loofah allowed_uri? treats data:text&sol;html as safe text/plain"
severity: "medium"
cvss: 5.3
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "loofah", "fixed": ["2.25.3"], "affected": "= 2.25.2", "ecosystem": "rubygems"}]
ecosystems: ["rubygems"]
tags: ["cwe-184", "cwe-79", "loofah", "package", "rails", "ruby"]
not_affected_if: ["default-sanitize-only", "no-allowed-uri-calls"]
published_at: "2026-11-12T20:56:30+00:00"
first_seen_at: "2026-11-12T20:58:53+00:00"
updated_at: "2026-11-12T21:40:31+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-jcff-cj73-4w4f", "first_seen_at": "2026-11-12T20:58:53+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-126206", "first_seen_at": "2026-11-12T21:40:31+00:00"}]
exploit_sources: []
---

# Loofah allowed_uri? treats data:text&sol;html as safe text/plain

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

Loofah's allowed_uri? helper accepts a data: URI whose media type is written with the &sol; named entity, treating it as safe text/plain while browsers read it as text/html. An attacker can pass a script-capable data URL through the check and get cross-site scripting when the approved value is rendered into an href.

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

## Affected

- rubygems:loofah affected = 2.25.2 fixed 2.25.3

## How to check

- Check the Loofah version in Gemfile.lock, e.g. `grep -i loofah Gemfile.lock`, and compare it to the affected version `2.25.2`.
- Search application code for calls to `Loofah::HTML5::Scrub.allowed_uri?` or `Rails::HTML::Sanitizer.allowed_uri?` on user-supplied URLs.
- Confirm whether those approved URLs are rendered into href or other browser-interpreted URI attributes.

## Fix

- `loofah` `2.25.3` (per the affected range `2.25.2` fixed in `2.25.3`; upgrade to Loofah >= 2.25.3).

## Timeline

- 2026-11-12T20:58:53+00:00 ghsa https://github.com/advisories/GHSA-jcff-cj73-4w4f
- 2026-11-12T21:40:31+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-126206

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/flavorjones/loofah/security-advisories/GHSA-jcff-cj73-4w4f
- [advisory] Maintainer's advisory: github.com https://github.com/flavorjones/loofah/security/advisories/GHSA-jcff-cj73-4w4f
- [fix] Patch: github.com https://github.com/flavorjones/loofah/pull/324
- [fix] Patch: github.com https://github.com/flavorjones/loofah/commit/ad92002966053309f83b550861e2ef04bc714744
- [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 `data:` URI whose mediatype is written with the HTML5 named character reference `&sol;` in place of the solidus. Loofah reads that mediatype as malformed and falls back to the allowed `text/plain`, while a browser decodes the reference and reads the same URI as `text/html`.

## Details

`allowed_uri?` decodes HTML entities with `CGI.unescapeHTML`, which handles numeric character references but not HTML5 named character references. `&sol;` therefore survives normalization, so the mediatype carries no `/`, fails the MIME grammar, and falls back to the allowed `text/plain` under the WHATWG rule for a malformed mediatype.

`&colon;`, `&sol;`, `&Tab;` and `&NewLine;` are the only named character references in the HTML5 table that decode to characters that change how a URI parses (U+003A, U+002F, U+0009 and U+000A; there is no named reference for U+000D), so this closes the set.

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 @ngpestelos.

---

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