RubySec

Providing security resources for the Ruby community

CVE-2026-73648 (rails-html-sanitizer): Possible XSS vulnerability with certain configurations of rails-html-sanitizer

Possible XSS vulnerability with certain configurations of rails-html-sanitizer

Published: July 15, 2026

SECURITY IDENTIFIERS

GEM

rails-html-sanitizer

FRAMEWORK

Ruby on Rails

UNAFFECTED VERSIONS

< 1.0.3

PATCHED VERSIONS

>= 1.7.1

DESCRIPTION

Summary

There is a possible cross-site scripting vulnerability in rails-html-sanitizer when the sanitizer is configured to allow an SVG reference element such as <use>. See related GHSA-9wjq-cp2p-hrgf in Loofah, whose SVG local-reference logic rails-html-sanitizer mirrors.

Impact

Rails::HTML::PermitScrubber restricts SVG reference elements in the SVG_ALLOW_LOCAL_HREF collection to local, same-document references, but that restriction covered only the xlink:href attribute. Browsers also accept a plain href attribute per the SVG 2 spec, and it was not restricted, so those elements could reference arbitrary external documents. SVG &lt;use&gt; can load and render external SVG content by reference, and if the referenced document is same-origin and contains scripts, it could execute in the context of the sanitized document. &lt;feImage&gt; can load external images, which can be used for tracking.

Applications are impacted only when the allowed tags are overridden to include one of these SVG reference elements, for example &lt;use&gt; or &lt;feImage&gt;. The default allowed tags do not include these SVG elements, so applications using the default configuration are not affected.

Credit

Found by maintainer Mike Dalessio during a security audit.

RELATED