Vulnerabilities in pkg:gem/loofah

PACKAGE
Advisory Identifier: GHSA-mf2j-8f84-cc9q
Advisory Summary

CVE-2026-126205 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Loofah libraries in the RubyGems ecosystem. The issue involves regular expression denial of service in the svg local-reference check. Remediation is available by upgrading affected packages to version 2.25.3.

12 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/loofah

12 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/loofah. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-mf2j-8f84-cc9q CVE-2026-126205 MODERATE Loofah: Regular expression denial of service in the SVG local-reference check
GHSA-8whx-365g-h9vv CVE-2026-73491 LOW Loofah `allowed_uri?` does not detect `javascript:` URIs split by named whitespace character references
GHSA-9wjq-cp2p-hrgf CVE-2026-73490 MODERATE Loofah: SVG `href` attribute bypasses local-reference restriction
GHSA-5qhf-9phg-95m2 - LOW Loofah `allowed_uri?` does not detect `javascript:` URIs split by numeric character references without semicolons
GHSA-2j22-pr5w-6gq8 - LOW Loofah has improper detection of disallowed URIs via `allowed_uri?`
GHSA-46fp-8f5p-pf2m - LOW Improper detection of disallowed URIs by Loofah `allowed_uri?`
GHSA-3x8r-x6xp-q4vm CVE-2022-23516 HIGH Uncontrolled Recursion in Loofah
GHSA-228g-948r-83gx CVE-2022-23515 MODERATE Improper neutralization of data URIs may allow XSS in Loofah
GHSA-486f-hjj9-9vhh CVE-2022-23514 HIGH Inefficient Regular Expression Complexity in Loofah
GHSA-c3gv-9cxf-6f57 CVE-2019-15587 MODERATE Loofah Allows Cross-site Scripting
GHSA-x7rv-cr6v-4vm4 CVE-2018-8048 MODERATE Cross-site Scripting in loofah
GHSA-g4xq-jx4w-4cjv CVE-2018-16468 MODERATE Loofah Cross-site Scripting vulnerability

CVE-2026-126205 at a Glance

CVE Identifier CVE-2026-126205
GHSA Identifier GHSA-mf2j-8f84-cc9q
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Loofah
Package Ecosystem RubyGems
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-126205

To remediate this vulnerability, upgrade all affected Loofah dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

loofah fixed: 2.25.3
Upgrade loofah to 2.25.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for loofah

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-126205, inspect your project dependencies for Loofah:

inspect dependencies for loofah

Analyze the terminal output to locate any version of Loofah in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.25.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Loofah, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary Loofah's HTML5 sanitizer restricts the `href` and `xlink:href` attributes of SVG reference elements to local references. That check matched the attribute value against `/^\s*[^#\s].*/m`. In Ruby `^` anchors to every line start and `\s` matches newlines, so an all-whitespace value made the engine rescan the value from each of its line starts, taking time quadratic in its length. CRuby 3.1 and earlier, and JRuby, are affected. CRuby 3.2 added linear-time regexp matching, which makes the pattern linear. JRuby's regexp engine does not. ## Impact An attacker who supplies HTML to be sanitized can consume CPU out of proportion to the input size, by sending an SVG reference element whose `href` or `xlink:href` is a long run of whitespace. The default safelist allows the elements in `SVG_ALLOW_LOCAL_HREF`, so no configuration change is required. ## Mitigation Upgrade to Loofah >= 2.25.3. Applications on CRuby that cannot upgrade should run CRuby 3.2 or later, which matches the pattern in linear time. ## Credit Reported by scyoon through the Rails HackerOne program.

CVE-2026-126205 Affected Loofah Versions

1 component(s)
Fixed Versions:
2.25.3
Product / Package Ecosystem Affected Versions Fixed Version
loofah
RubyGems
< 2.25.3
2.25.3

References

Frequently Asked Questions

What is CVE-2026-126205?
CVE-2026-126205 is a security vulnerability in Loofah involving Regular expression denial of service in the SVG local-reference check under CWE-400: Uncontrolled Resource Consumption.
Which Loofah versions are affected?
Affected versions include releases prior to 2.25.3 across affected packages: loofah.
What version fixes CVE-2026-126205?
Upgrading to 2.25.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is loofah affected?
Yes, loofah is affected in releases prior to 2.25.3. Upgrade your dependency to 2.25.3 or later.
What is the CVSS score of CVE-2026-126205?
CVE-2026-126205 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-126205?
CVE-2026-126205 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check RubyGems dependencies for CVE-2026-126205?
Run the dependency tree command: 'inspect dependencies for loofah'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mf2j-8f84-cc9q",
  "modified" : "2026-12-02T16:23:58Z",
  "published" : "2026-11-12T21:00:42Z",
  "aliases" : [ "CVE-2026-126205" ],
  "summary" : "Loofah: Regular expression denial of service in the SVG local-reference check",
  "details" : "## Summary\n\nLoofah's HTML5 sanitizer restricts the `href` and `xlink:href` attributes of SVG reference elements to local references. That check matched the attribute value against `/^\\s*[^#\\s].*/m`. In Ruby `^` anchors to every line start and `\\s` matches newlines, so an all-whitespace value made the engine rescan the value from each of its line starts, taking time quadratic in its length.\n\nCRuby 3.1 and earlier, and JRuby, are affected. CRuby 3.2 added linear-time regexp matching, which makes the pattern linear. JRuby's regexp engine does not.\n\n## Impact\n\nAn attacker who supplies HTML to be sanitized can consume CPU out of proportion to the input size, by sending an SVG reference element whose `href` or `xlink:href` is a long run of whitespace.\n\nThe default safelist allows the elements in `SVG_ALLOW_LOCAL_HREF`, so no configuration change is required.\n\n## Mitigation\n\nUpgrade to Loofah >= 2.25.3. Applications on CRuby that cannot upgrade should run CRuby 3.2 or later, which matches the pattern in linear time.\n\n## Credit\n\nReported by scyoon through the Rails HackerOne program.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "loofah"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.25.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/flavorjones/loofah/security/advisories/GHSA-mf2j-8f84-cc9q"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-126205"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/flavorjones/loofah/pull/324"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/flavorjones/loofah/commit/2f31e7fae36036c9882d3d0fae720e1014c57cd1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/flavorjones/loofah"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/flavorjones/loofah/releases/tag/v2.25.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/GHSA-mf2j-8f84-cc9q.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333", "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-12T21:00:42Z",
    "nvd_published_at" : "2026-11-12T21:17:21Z"
  }
}