Loofah `allowed_uri?` does not detect `javascript:` URIs split by numeric character references without semicolons
Loofah's allowed_uri? method fails to detect javascript: or vbscript: URIs when the scheme is split by numeric character references without trailing semicolons. Browsers decode these references and execute the URI, but allowed_uri? incorrectly marks them as safe. This affects callers that validate user-controlled URLs with allowed_uri? and then render them into browser-interpreted URI attributes, potentially enabling cross-site scripting (XSS). The default sanitize() method is not affected. The issue is fixed in Loofah version 2.25.2.
AI Analysis
Technical Summary
The Loofah Ruby gem's allowed_uri? method does not properly reject javascript: or vbscript: URIs if the scheme is obfuscated using numeric character references lacking trailing semicolons (e.g., : instead of :). While allowed_uri? uses CGI.unescapeHTML which only decodes numeric character references with semicolons, browsers decode these references even without semicolons, causing the scheme to be interpreted as executable javascript:. This discrepancy allows bypassing the URI scheme validation, leading to potential XSS when user-controlled URLs validated by allowed_uri? are rendered in HTML attributes. The default Loofah sanitize() method is unaffected because Nokogiri decodes entities before Loofah processes URIs. The vulnerability affects Loofah versions >=2.25.0 and <2.25.2 and was responsibly disclosed by GitHub user @MoonFuji.
Potential Impact
Applications that use Loofah's allowed_uri? method to validate user-supplied URLs before rendering them into href or other URI attributes may be vulnerable to cross-site scripting (XSS) attacks. This includes direct calls to allowed_uri? and higher-level features relying on it, such as Action Text 8.2's markdown link validation. The vulnerability allows malicious javascript: URIs to bypass validation due to incomplete decoding of numeric character references, potentially enabling script execution in the browser.
Mitigation Recommendations
Upgrade Loofah to version 2.25.2 or later, where this issue is fixed. The vendor advisory explicitly states that upgrading to Loofah >= 2.25.2 mitigates the vulnerability. No other mitigation actions are indicated.
Loofah `allowed_uri?` does not detect `javascript:` URIs split by numeric character references without semicolons
Description
Loofah's allowed_uri? method fails to detect javascript: or vbscript: URIs when the scheme is split by numeric character references without trailing semicolons. Browsers decode these references and execute the URI, but allowed_uri? incorrectly marks them as safe. This affects callers that validate user-controlled URLs with allowed_uri? and then render them into browser-interpreted URI attributes, potentially enabling cross-site scripting (XSS). The default sanitize() method is not affected. The issue is fixed in Loofah version 2.25.2.
CVSS v4.0
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The Loofah Ruby gem's allowed_uri? method does not properly reject javascript: or vbscript: URIs if the scheme is obfuscated using numeric character references lacking trailing semicolons (e.g., : instead of :). While allowed_uri? uses CGI.unescapeHTML which only decodes numeric character references with semicolons, browsers decode these references even without semicolons, causing the scheme to be interpreted as executable javascript:. This discrepancy allows bypassing the URI scheme validation, leading to potential XSS when user-controlled URLs validated by allowed_uri? are rendered in HTML attributes. The default Loofah sanitize() method is unaffected because Nokogiri decodes entities before Loofah processes URIs. The vulnerability affects Loofah versions >=2.25.0 and <2.25.2 and was responsibly disclosed by GitHub user @MoonFuji.
Potential Impact
Applications that use Loofah's allowed_uri? method to validate user-supplied URLs before rendering them into href or other URI attributes may be vulnerable to cross-site scripting (XSS) attacks. This includes direct calls to allowed_uri? and higher-level features relying on it, such as Action Text 8.2's markdown link validation. The vulnerability allows malicious javascript: URIs to bypass validation due to incomplete decoding of numeric character references, potentially enabling script execution in the browser.
Mitigation Recommendations
Upgrade Loofah to version 2.25.2 or later, where this issue is fixed. The vendor advisory explicitly states that upgrading to Loofah >= 2.25.2 mitigates the vulnerability. No other mitigation actions are indicated.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-5qhf-9phg-95m2
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["RubyGems"]
- Database Specific Severity
- LOW
- Cvss Version
- 4.0
Threat ID: 6a600aa09c2644c7f8fdfa7f
Added to database: 07/22/2026, 00:11:12 UTC
Last enriched: 07/22/2026, 00:37:50 UTC
Last updated: 07/22/2026, 03:53:13 UTC
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.