4.7medium
Loofah: SVG `href` attribute bypasses local-reference restriction
- Severity
- 4.7medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.18% (higher than 7% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-9wjq-cp2p-hrgf
Description
Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. Prior to 2.25.2, Loofah's HTML5 sanitizer applies its local-reference restriction only to the xlink:href attribute on SVG use and feImage elements, while browsers also accept the plain href attribute. A crafted sanitized SVG can therefore reference an arbitrary same-origin external document; use may render external SVG content containing scripts or other dangerous content, and feImage may load external images for tracking. Applications that sanitize user-supplied SVG with Loofah's default allowlist are affected. This issue is fixed in version 2.25.2.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| flavorjones loofah | < 2.25.2 | CVE List |
| loofah (RubyGems) | before 2.25.2 | GitHub Advisory Database |
All scores
| GitHub_M | 4.7medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N |
| GitHub | 4.7medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. Prior to 2.25.2, Loofah's HTML5 sanitizer applies its local-reference restriction only to the xlink:href attribute on SVG use and feImage elements, while browsers also accept the plain href attribute. A crafted sanitized SVG can therefore reference an arbitrary same-origin external document; use may render external SVG content containing scripts or other dangerous content, and feImage may load external images for tracking. Applications that sanitize user-supplied SVG with Loofah's default allowlist are affected. This issue is fixed in version 2.25.2.
GitHub Advisory Database
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 <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.
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.
NVD (es)
Loofah es una biblioteca general para manipular y transformar documentos y fragmentos HTML/XML, construida sobre Nokogiri. Antes de la versión 2.25.2, el saneador HTML5 de Loofah aplica su restricción de referencia local solo al atributo xlink:href en los elementos SVG use y feImage, mientras que los navegadores también aceptan el atributo href simple. Un SVG saneado y elaborado puede, por lo tanto, hacer referencia a un documento externo de mismo origen arbitrario; use puede renderizar contenido SVG externo que contenga scripts u otro contenido peligroso, y feImage puede cargar imágenes externas para seguimiento. Las aplicaciones que sanean SVG proporcionado por el usuario con la lista de permitidos predeterminada de Loofah se ven afectadas. Este problema está solucionado en la versión 2.25.2.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-73490 changed 2026-08-13 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9wjq-cp2p-hrgf changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-73490 changed 2026-10-24 | Public domain |