GHSA-46fp-8f5p-pf2m — Vulnerability in loofah — Advisory Details
Improper detection of disallowed URIs by Loofah `allowed_uri?`
Does your project use an affected loofah version?
Paste your Gemfile.lock to check it for GHSA-46fp-8f5p-pf2m and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
Loofah::HTML5::Scrub.allowed_uri? does not correctly reject javascript: URIs when the scheme is split by HTML entity-encoded control characters such as (carriage return), (line feed), or 	 (tab).
Details
The allowed_uri? method strips literal control characters before decoding HTML entities. Payloads like java script:alert(1) survive the control character strip, then is decoded to a carriage return, producing java\rscript:alert(1).
Note that the Loofah sanitizer's default sanitize() path is not affected because Nokogiri decodes HTML entities during parsing before Loofah evaluates the URI protocol. This issue only affects direct callers of the allowed_uri? string-level helper when passing HTML-encoded strings.
Impact
Applications that call Loofah::HTML5::Scrub.allowed_uri? to validate user-controlled URLs and then render approved URLs into href or other browser-interpreted URI attributes may be vulnerable to cross-site scripting (XSS).
This only affects Loofah 2.25.0.
Mitigation
Upgrade to Loofah >= 2.25.1.
Credit
Responsibly reported by HackOne user @smlee.
Advisory Timeline
- First published March 18, 2026 (253 days ago).
- Last revised September 10, 2026 — 175 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
gem install loofah -v 2.25.1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: RubyGems (1).
| Package | Fixed In |
|---|---|
| loofah RubyGems · Affected: 2.25.0 | 2.25.1 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-79Cross-site Scripting (XSS)MITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 7.2 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:U
References
Frequently Asked Questions
- What is GHSA-46fp-8f5p-pf2m?
- Improper detection of disallowed URIs by Loofah `allowed_uri?`. This vulnerability has been assigned a severity rating of LOW (CVSS score: 7.2/10).
- How do I check if my project is affected by GHSA-46fp-8f5p-pf2m?
- GHSA-46fp-8f5p-pf2m affects loofah. Use GeekWala's free vulnerability scanner to check your dependencies against GHSA-46fp-8f5p-pf2m and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
Related CVEs
- CVE-2022-23516HIGH
Uncontrolled Recursion in Loofah
- CVE-2022-23514HIGH
Inefficient Regular Expression Complexity in Loofah
- CVE-2022-23515MEDIUM
Improper neutralization of data URIs may allow XSS in Loofah
- CVE-2026-73490MEDIUM
Loofah: SVG `href` attribute bypasses local-reference restriction
- CVE-2026-126203MEDIUM
Loofah: Mutation XSS in the HTML5 scrubbers through unescaped attribute values
- CVE-2026-126206MEDIUM
Loofah allowed_uri? treats data:text/html as safe text/plain
- CVE-2026-73492LOW
Loofah `allowed_uri?` does not detect `javascript:` URIs split by numeric character references without semicolons
- CVE-2026-73491LOW
Loofah `allowed_uri?` does not detect `javascript:` URIs split by named whitespace character references