Advisories for Gem/Loofah package

2026

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

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.

2022

Uncontrolled Recursion in Loofah

Loofah >= 2.2.0, < 2.19.1 uses recursion for sanitizing CDATA sections, making it susceptible to stack exhaustion and raising a SystemStackError exception. This may lead to a denial of service through CPU resource consumption.

2019
2018

XSS Vulnerability

Loofah allows attributes that are not explicitly allowed to be present in sanitized output when input with specially-crafted HTML fragments.