Skip to main content

GHSA-46fp-8f5p-pf2m — Vulnerability in loofah — Advisory Details

LOW

Improper detection of disallowed URIs by Loofah `allowed_uri?`

Published March 18, 2026Updated September 10, 2026Source: OSV

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.

Check my Gemfile.lock

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.

Bundler
Update loofah to 2.25.1 or later
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).

PackageFixed In
loofah RubyGems · Affected: 2.25.02.25.1

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-79
    Cross-site Scripting (XSS)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 7.2 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
—
Confidentiality
—
Integrity
—
Availability
—

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

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

CVSS Score
7.2

Significant impact if exploited, or exploitable with modest effort.

Related CVEs

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my Gemfile.lock