A AegiFlow
MEDIUMCVSS 4.7

GHSA-9wjq-cp2p-hrgf

Loofah: SVG `href` attribute bypasses local-reference restriction

Published
2026-07-21
Modified
2026-07-21
Sources
github-advisory

Summary

## Summary Loofah's HTML5 sanitizer restricted only the `xlink:href` attribute on certain SVG elements to local, same-document references. Browsers also accept a plain `href` attribute as an alternative to the deprecated `xlink:href` per the SVG 2 spec, but Loofah did not apply the same restriction to it, allowing those elements to reference arbitrary external documents. ## Impact SVG ` ` can load and render external SVG content by reference. If the referenced external SVG is same-origin and contains scripts or other dangerous content, it could execute in the context of the sanitized document. ` ` can load external images, which can be used for tracking. Modern browsers restrict cross-origin ` ` fetches, which limits but does not eliminate the risk. Applications that sanitize user-supplied SVG (directly, or as part of HTML) with Loofah's default allowlist are affected. ## Mitigation Upgrade to Loofah >= 2.25.2. ## Credit Found by the maintainer, Mike Dalessio, during a security audit.

Affected packages

EcosystemPackageAffected versionsFixed versions
RubyGemsloofah2.25.2

Remediation: Upgrade to 2.25.2 or later.

References

Includes data from the GitHub Advisory Database, licensed under CC-BY 4.0.