{"id":"GHSA-9wjq-cp2p-hrgf","title":"Loofah: SVG `href` attribute bypasses local-reference restriction","summary":"Loofah: SVG `href` attribute bypasses local-reference restriction","severity":"medium","cvss":4.7,"cwe":["CWE-79"],"vendor":"loofah","product":"loofah","ecosystem":"rubygems","affected":["loofah < 2.25.2"],"patched":["loofah 2.25.2"],"published":"2026-07-21","updated":"2026-07-21","source":"GHSA","sourceUrl":"https://github.com/advisories/GHSA-9wjq-cp2p-hrgf","references":[{"url":"https://github.com/flavorjones/loofah/security/advisories/GHSA-9wjq-cp2p-hrgf"},{"url":"https://github.com/flavorjones/loofah/commit/20867b9be689521887364b74822c41ef830523c9"},{"url":"https://github.com/flavorjones/loofah/releases/tag/v2.25.2"},{"url":"https://github.com/advisories/GHSA-9wjq-cp2p-hrgf"}],"tags":["ghsa","rubygems"],"ingestedAt":"2026-07-21T22:55:08.701Z","slug":"GHSA-9wjq-cp2p-hrgf","body":"## Overview\n\n## Summary\n\nLoofah'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.\n\n## Impact\n\nSVG `<use>` 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. `<feImage>` can load external images, which can be used for tracking. Modern browsers restrict cross-origin `<use>` fetches, which limits but does not eliminate the risk.\n\nApplications that sanitize user-supplied SVG (directly, or as part of HTML) with Loofah's default allowlist are affected.\n\n## Mitigation\n\nUpgrade to Loofah >= 2.25.2.\n\n## Credit\n\nFound by the maintainer, Mike Dalessio, during a security audit.\n\n## Affected packages\n\n- `loofah < 2.25.2`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `loofah 2.25.2`","depth":"sunlit","depthScore":26,"depthScoreParts":{"impact":25.9,"likelihood":0,"exploitation":0,"ransomware":0},"changes":[]}