# CVE-2026-126205: Loofah: Regular expression denial of service in the SVG local-reference check

> Attackers can submit SVG references with long whitespace to cause quadratic CPU use in Loofah sanitization; Ruby apps using Loofah should care.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Harmful if only installed:** No
- **Needs a specific call:** No
- **Fix available:** Yes
- **Published:** 12 Nov 2026
- **Updated:** 12 Nov 2026
- **Also known as:** GHSA-mf2j-8f84-cc9q

## What is CVE-2026-126205?

CVE-2026-126205 is a medium-severity denial of service vulnerability in flavorjones loofah, published on 12 Nov 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. Prior to 2.25.3, the Loofah HTML5 sanitizer checks href and xlink:href on elements in SVG_ALLOW_LOCAL_HREF with a regular expression whose line anchor and newline-matching whitespace cause an all-whitespace value to be rescanned from every line start. An attacker can submit an SVG reference element with a long multiline-whitespace attribute and consume CPU quadratically during sanitization. CRuby 3.1 and earlier and JRuby are affected, while CRuby 3.2 and later uses linear-time regular-expression matching. The default safelist reaches the vulnerable check without a configuration change. This issue is fixed in version 2.25.3.

Weakness: CWE-400 (Uncontrolled Resource Consumption), CWE-1333 (Inefficient Regular Expression Complexity)

## Which versions are affected by CVE-2026-126205?

1 open source package ship an affected version, including loofah.

An affected version is exposed as installed. No special setting or call is needed.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `loofah` | RubyGems | All versions | 2.25.3 |

## How do I fix CVE-2026-126205?

Upgrade loofah to 2.25.3 or later.

## Is CVE-2026-126205 being exploited?

There is no known exploitation of CVE-2026-126205 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-126205 and fix it if it is affected.

What it is: CVE-2026-126205 is a medium-severity denial of service vulnerability in flavorjones loofah, published on 12 Nov 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-126205 in the wild and no public exploit code.
Exposure: An affected version is exposed as installed. No special setting or call is needed.

Affected packages and fixed versions:
- loofah (RubyGems): affected all versions; fixed in 2.25.3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-126205/ (Markdown: https://insights.sbomify.com/CVE-2026-126205/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-126205
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-126205
- OSV: https://osv.dev/vulnerability/CVE-2026-126205

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-126205/
Summaries are generated and may contain mistakes; the official description above is the record.
