Vulnerability GHSA-jcff-cj73-4w4f

Medium Risk
MEDIUM RISK
CVSS Score: 6.0
Score Range: 4.0–6.9
Medium severity vulnerabilities (CVSS 4.0–6.9). Important issues that meaningfully reduce security confidence.
19 hours ago
November 12, 2026 at 08:56 PM UTC
Loofah allowed_uri? treats data:text/html as safe text/plain
2.25.2
2.25.2

Summary

Loofah allowed_uri? treats data:text/html as safe text/plain

Details

Summary

Loofah::HTML5::Scrub.allowed_uri? returns true for a data: URI whose mediatype is written with the HTML5 named character reference / 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. / 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.

:, /, 	 and 
 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.

Related Vulnerabilities

Other vulnerabilities affecting the same packages

Medium Risk
18 hours ago
Loofah: SVG `<textPath>` and `<mpath>` bypass local-reference restriction
0.2.0 - 0.4.7 and 1.0.0.beta.1 and 1.0.0 - 2.0.3 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0 - 2.20.0 and 2.21.0.rc1 and 2.21.0 - 2.25.2 GHSA-345x-3rq2-jfrm
0.2.0 - 0.4.7 and 1.0.0.beta.1 and 1.0.0 - 2.0.3 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0 - 2.20.0 and 2.21.0.rc1 and 2.21.0 - 2.25.2 GHSA-345x-3rq2-jfrm
Medium Risk
18 hours ago
Loofah allowed_uri? treats javascript&#x3a alert(1) as safe
2.25.0 - 2.25.2 GHSA-p9wj-w8xq-vjx6
2.25.0 - 2.25.2 GHSA-p9wj-w8xq-vjx6
Medium Risk
19 hours ago
Loofah: CSS url() sanitization bypass via escaped parentheses
0.2.0 - 0.4.7 and 1.0.0.beta.1 and 1.0.0 - 2.0.3 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0 - 2.20.0 and 2.21.0.rc1 and 2.21.0 - 2.25.2 GHSA-m3x9-938q-5767
0.2.0 - 0.4.7 and 1.0.0.beta.1 and 1.0.0 - 2.0.3 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0 - 2.20.0 and 2.21.0.rc1 and 2.21.0 - 2.25.2 GHSA-m3x9-938q-5767
Medium Risk
19 hours ago
Loofah: Regular expression denial of service in the SVG local-reference check
0.2.0 - 0.4.7 and 1.0.0.beta.1 and 1.0.0 - 2.0.3 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0 - 2.20.0 and 2.21.0.rc1 and 2.21.0 - 2.25.2 GHSA-mf2j-8f84-cc9q
0.2.0 - 0.4.7 and 1.0.0.beta.1 and 1.0.0 - 2.0.3 and 2.1.0.rc1 and 2.1.0.rc2 and 2.1.0 - 2.20.0 and 2.21.0.rc1 and 2.21.0 - 2.25.2 GHSA-mf2j-8f84-cc9q
Medium Risk
19 hours ago
Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values
2.21.0 - 2.25.2 GHSA-h6v6-rg66-fqj4
2.21.0 - 2.25.2 GHSA-h6v6-rg66-fqj4
View all vulnerabilities for these packages

Impacted packages

Timeline

Published
19 hours ago
November 12, 2026 at 08:56 PM UTC
Fixed (2.25.3)
11 days ago
November 02, 2026 at 05:00 AM UTC
Last Modified
19 hours ago
November 12, 2026 at 09:00 PM UTC