GHSA-2J22-PR5W-6GQ8

GHSA-2J22-PR5W-6GQ8 is a low-severity cross-site scripting (XSS) vulnerability in loofah (rubygems), affecting versions = 2.25.0. It is fixed in 2.25.1.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Loofah has improper detection of disallowed URIs via allowed_uri?

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.

Mitigation

Upgrade to Loofah >= 2.25.1.

Credit

Responsibly reported by HackOne user @smlee.

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.

Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.

Affected versions

loofah (= 2.25.0)

Security releases

loofah → 2.25.1 (rubygems)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade loofah to 2.25.1 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is GHSA-2J22-PR5W-6GQ8? GHSA-2J22-PR5W-6GQ8 is a low-severity cross-site scripting (XSS) vulnerability in loofah (rubygems), affecting versions = 2.25.0. It is fixed in 2.25.1. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
  2. Which versions of loofah are affected by GHSA-2J22-PR5W-6GQ8? loofah (rubygems) versions = 2.25.0 is affected.
  3. Is there a fix for GHSA-2J22-PR5W-6GQ8? Yes. GHSA-2J22-PR5W-6GQ8 is fixed in 2.25.1. Upgrade to this version or later.
  4. Is GHSA-2J22-PR5W-6GQ8 exploitable, and should I be worried? Whether GHSA-2J22-PR5W-6GQ8 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  5. What actually determines whether GHSA-2J22-PR5W-6GQ8 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  6. How do I fix GHSA-2J22-PR5W-6GQ8? Upgrade loofah to 2.25.1 or later.

Other vulnerabilities in loofah

Stop the waste.
Protect your environment with Kodem.