SVG `` and `` bypass local-reference restriction in Loofah
Published: November 02, 2026
SECURITY IDENTIFIERS
- GHSA: GHSA-345x-3rq2-jfrm
- Vendor Advisory: https://github.com/flavorjones/loofah/security/advisories/GHSA-345x-3rq2-jfrm
GEM
SEVERITY
CVSS v3.x: 4.7 (Medium)
PATCHED VERSIONS
>= 2.25.3
DESCRIPTION
Summary
Loofah restricts href and xlink:href on certain SVG elements to
same-document references. Two elements escaped the restriction:
<textPath>:SVG_ALLOW_LOCAL_HREFlisted it in lowercase astextpath, but the HTML5 parser names the elementtextPathinside<svg>, so the check never matched on the HTML5 path.<mpath>: absent fromSVG_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.
