---
id: "CVE-2026-126208"
page: "https://infrastack.ai/live/CVE-2026-126208"
kind: "vulnerability"
aliases: ["CVE-2026-126208", "GHSA-345x-3rq2-jfrm"]
title: "Loofah: SVG `<textPath>` and `<mpath>` bypass local-reference restriction"
severity: "medium"
cvss: 4.7
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "loofah", "fixed": ["2.25.3"], "affected": "< 2.25.3", "ecosystem": "rubygems"}]
ecosystems: ["rubygems"]
tags: ["cwe-178", "cwe-184", "loofah", "package", "rails", "rails-html-sanitizer", "ruby"]
not_affected_if: ["no-user-svg", "static-content"]
published_at: "2026-11-12T21:17:22+00:00"
first_seen_at: "2026-11-12T21:29:45+00:00"
updated_at: "2026-11-12T21:40:31+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-345x-3rq2-jfrm", "first_seen_at": "2026-11-12T21:29:45+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-126208", "first_seen_at": "2026-11-12T21:40:31+00:00"}]
exploit_sources: []
---

# Loofah: SVG `<textPath>` and `<mpath>` bypass local-reference restriction

Link for people: https://infrastack.ai/live/CVE-2026-126208 (this .md is for agents)

Loofah's HTML sanitizer lets external href and xlink:href values survive on SVG textPath and mpath elements. When a user-supplied SVG is rendered in Firefox, the viewer's browser fetches the attacker's URL, leaking IP address, user agent and referrer.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- rubygems:loofah affected < 2.25.3 fixed 2.25.3

## How to check

- Check the Loofah version in `Gemfile.lock` or with `bundle list | grep loofah`
- Check whether `rails-html-sanitizer` is in `Gemfile.lock` and whether `PermitScrubber` is configured to allow SVG elements
- Look for code that sanitizes user-supplied SVG or HTML containing SVG

## Fix

- loofah: upgrade to `2.25.3` or later
- rails-html-sanitizer: the sources do not name a fixed version

## Timeline

- 2026-11-12T21:29:45+00:00 ghsa https://github.com/advisories/GHSA-345x-3rq2-jfrm
- 2026-11-12T21:40:31+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-126208

## Documents

- [advisory] Maintainer's advisory: api.github.com https://api.github.com/repos/flavorjones/loofah/security-advisories/GHSA-345x-3rq2-jfrm
- [advisory] Maintainer's advisory: github.com https://github.com/flavorjones/loofah/security/advisories/GHSA-345x-3rq2-jfrm
- [fix] Patch: github.com https://github.com/flavorjones/loofah/pull/324
- [fix] Patch: github.com https://github.com/flavorjones/loofah/commit/cdd6ff7fb51998eb181bd2da925ddbcfcc8a3b96
- [fix] Release notes: github.com https://github.com/flavorjones/loofah/releases/tag/v2.25.3

## From the sources

## Summary

Loofah restricts `href` and `xlink:href` on certain SVG elements to same-document references. Two elements escaped the restriction:

- `<textPath>`: `SVG_ALLOW_LOCAL_HREF` listed it in lowercase as `textpath`, but the HTML5 parser names the element `textPath` inside `<svg>`, so the check never matched on the HTML5 path.
- `<mpath>`: absent from `SVG_ALLOW_LOCAL_HREF`, so its references were never restricted on either path.

`rails-html-sanitizer` reuses this safelist in its `PermitScrubber`, so it is affected too.

## Impact

An external `href` or `xlink:href` on `<textPath>` or `<mpath>` survives sanitization. Firefox fetches the URL when rendering the content, which leaks the viewer's IP address, user agent, and referrer, and can reach hosts routable only from the viewer's network. Chrome and WebKit do not fetch external references on these elements. The impact is a network request to an attacker-chosen URL, not script execution.

Applications that sanitize user-supplied SVG, directly or inside HTML, with Loofah's default allowlist or with `rails-html-sanitizer` with SVG elements permitted are affected.

## Mitigation

Upgrade to Loofah >= 2.25.3.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
