|
| 1 | +--- |
| 2 | +layout: advisory |
| 3 | +title: 'CVE-2026-73648 (rails-html-sanitizer): Possible XSS vulnerability with certain |
| 4 | + configurations of rails-html-sanitizer' |
| 5 | +comments: false |
| 6 | +categories: |
| 7 | +- rails-html-sanitizer |
| 8 | +- rails |
| 9 | +advisory: |
| 10 | + gem: rails-html-sanitizer |
| 11 | + framework: rails |
| 12 | + cve: 2026-73648 |
| 13 | + ghsa: cj75-f6xr-r4g7 |
| 14 | + url: https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-cj75-f6xr-r4g7 |
| 15 | + title: Possible XSS vulnerability with certain configurations of rails-html-sanitizer |
| 16 | + date: 2026-07-15 |
| 17 | + description: |- |
| 18 | + ## Summary |
| 19 | +
|
| 20 | + There is a possible cross-site scripting vulnerability in |
| 21 | + rails-html-sanitizer when the sanitizer is configured to allow an |
| 22 | + SVG reference element such as <use>. |
| 23 | + See related GHSA-9wjq-cp2p-hrgf in Loofah, whose SVG local-reference |
| 24 | + logic rails-html-sanitizer mirrors. |
| 25 | +
|
| 26 | + ## Impact |
| 27 | +
|
| 28 | + `Rails::HTML::PermitScrubber` restricts SVG reference elements in the |
| 29 | + `SVG_ALLOW_LOCAL_HREF` collection to local, same-document references, |
| 30 | + but that restriction covered only the `xlink:href` attribute. Browsers |
| 31 | + also accept a plain `href` attribute per the SVG 2 spec, and it was |
| 32 | + not restricted, so those elements could reference arbitrary external |
| 33 | + documents. SVG `<use>` can load and render external SVG content by |
| 34 | + reference, and if the referenced document is same-origin and contains |
| 35 | + scripts, it could execute in the context of the sanitized document. |
| 36 | + `<feImage>` can load external images, which can be used for tracking. |
| 37 | +
|
| 38 | + Applications are impacted only when the allowed tags are overridden |
| 39 | + to include one of these SVG reference elements, for example `<use>` |
| 40 | + or `<feImage>`. The default allowed tags do not include these SVG |
| 41 | + elements, so applications using the default configuration are not affected. |
| 42 | +
|
| 43 | + ## Credit |
| 44 | +
|
| 45 | + Found by maintainer Mike Dalessio during a security audit. |
| 46 | + cvss_v4: 5.1 |
| 47 | + unaffected_versions: |
| 48 | + - "< 1.0.3" |
| 49 | + patched_versions: |
| 50 | + - ">= 1.7.1" |
| 51 | + related: |
| 52 | + url: |
| 53 | + - https://nvd.nist.gov/vuln/detail/CVE-2026-73648 |
| 54 | + - https://rubygems.org/gems/rails-html-sanitizer/versions/1.7.1 |
| 55 | + - https://github.com/rails/rails-html-sanitizer/releases/tag/v1.7.1 |
| 56 | + - https://github.com/rails/rails-html-sanitizer/blob/main/CHANGELOG.md#v171--2026-07-15 |
| 57 | + - https://github.com/rails/rails-html-sanitizer/commit/74dcb8053e6da9921246ce71b06ad9fd65b19586 |
| 58 | + - https://discuss.rubyonrails.org/t/ghsa-cj75-f6xr-r4g7-possible-xss-vulnerability-with-certain-configurations-of-rails-html-sanitizer/91359#post_1 |
| 59 | + - https://github.com/flavorjones/loofah/security/advisories/GHSA-9wjq-cp2p-hrgf |
| 60 | + - https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-cj75-f6xr-r4g7 |
| 61 | + - https://github.com/advisories/GHSA-cj75-f6xr-r4g7 |
| 62 | + notes: "- cvss_v4 in GHSA and nvd.nist.gov URLs.\n" |
| 63 | +--- |
0 commit comments