CVE-2019-15587
Description
In the Loofah gem for Ruby through v2.3.0 unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Loofah gem through v2.3.0 fails to sanitize the SVG animate 'values' attribute, allowing XSS via crafted SVG elements.
Vulnerability
CVE-2019-15587 is a cross-site scripting (XSS) vulnerability in the Loofah gem for Ruby, affecting versions through 2.3.0. Loofah is a library for HTML/XML sanitization and transformation built on Nokogiri. The flaw exists because the sanitizer does not remove the values attribute from SVG `` elements, allowing an attacker to inject JavaScript code via a crafted SVG element [1][2][4].
Exploitation
An attacker can exploit this vulnerability by publishing a sanitized SVG element that contains a malicious values attribute on an `` tag. The Loofah sanitizer, when configured to escape or prune unsafe content, fails to strip this attribute, leaving the JavaScript payload intact. The attack requires the attacker to supply crafted SVG markup that passes through the sanitizer but still executes code in the user's browser [2][4].
Impact
If successful, the attacker can execute arbitrary JavaScript in the context of the user's session, potentially leading to theft of sensitive data, session hijacking, or other client-side attacks. While the user must view the crafted SVG content (e.g., through a web application that republishes user-supplied sanitized HTML), the vulnerability bypasses the intended XSS protections provided by Loofah [1][2][4].
Mitigation
The issue was addressed in Loofah commit 0c6617a, which extends sanitization to cover the values attribute on SVG animate elements. Users should upgrade to Loofah version 2.3.1 or later to apply this fix [4]. No workaround is publicly documented; the safest mitigation is to update the gem.
AI Insight generated on May 22, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
loofahRubyGems | < 2.3.1 | 2.3.1 |
Affected products
13- Ruby/Loofah gemdescription
- ghsa-coords12 versionspkg:gem/loofahpkg:rpm/opensuse/ruby3.2-rubygem-loofah&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/rubygem-loofah&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/rubygem-loofah&distro=openSUSE%20Leap%2015.4pkg:rpm/opensuse/rubygem-loofah&distro=openSUSE%20Tumbleweedpkg:rpm/suse/rubygem-loofah&distro=SUSE%20Linux%20Enterprise%20High%20Availability%20Extension%2015pkg:rpm/suse/rubygem-loofah&distro=SUSE%20Linux%20Enterprise%20High%20Availability%20Extension%2015%20SP1pkg:rpm/suse/rubygem-loofah&distro=SUSE%20Linux%20Enterprise%20High%20Availability%20Extension%2015%20SP2pkg:rpm/suse/rubygem-loofah&distro=SUSE%20Linux%20Enterprise%20High%20Availability%20Extension%2015%20SP3pkg:rpm/suse/rubygem-loofah&distro=SUSE%20Linux%20Enterprise%20High%20Availability%20Extension%2015%20SP4pkg:rpm/suse/rubygem-loofah&distro=SUSE%20OpenStack%20Cloud%20Crowbar%208pkg:rpm/suse/rubygem-loofah&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209
< 2.3.1+ 11 more
- (no CPE)range: < 2.3.1
- (no CPE)range: < 2.19.1-1.2
- (no CPE)range: < 2.2.2-150000.4.6.1
- (no CPE)range: < 2.2.2-150000.4.6.1
- (no CPE)range: < 2.14.0-1.1
- (no CPE)range: < 2.2.2-150000.4.6.1
- (no CPE)range: < 2.2.2-150000.4.6.1
- (no CPE)range: < 2.2.2-150000.4.6.1
- (no CPE)range: < 2.2.2-150000.4.6.1
- (no CPE)range: < 2.2.2-150000.4.6.1
- (no CPE)range: < 2.0.2-3.11.1
- (no CPE)range: < 2.0.2-3.11.1
Patches
10c6617af4408mitigate XSS vulnerability in SVG animate attributes
2 files changed · +24 −9
lib/loofah/html5/safelist.rb+0 −3 modified@@ -360,7 +360,6 @@ module SafeList "baseProfile", "bbox", "begin", - "by", "calcMode", "cap-height", "class", @@ -467,7 +466,6 @@ module SafeList "systemLanguage", "target", "text-anchor", - "to", "transform", "type", "u1", @@ -477,7 +475,6 @@ module SafeList "unicode", "unicode-range", "units-per-em", - "values", "version", "viewBox", "visibility",
test/integration/test_ad_hoc.rb+24 −6 modified@@ -188,14 +188,32 @@ def test_dont_remove_whitespace_between_tags end end - # see: - # - https://github.com/flavorjones/loofah/issues/154 - # - https://hackerone.com/reports/429267 - context "xss protection from svg xmlns:xlink animate attribute" do - it "sanitizes appropriate attributes" do - html = %Q{<svg><a xmlns:xlink=http://www.w3.org/1999/xlink xlink:href=?><circle r=400 /><animate attributeName=xlink:href begin=0 from=javascript:alert(1) to=%26>} + context "xss protection from svg animate attributes" do + # see recommendation from https://html5sec.org/#137 + # to sanitize "to", "from", "values", and "by" attributes + + it "sanitizes 'from', 'to', and 'by' attributes" do + # for CVE-2018-16468 + # see: + # - https://github.com/flavorjones/loofah/issues/154 + # - https://hackerone.com/reports/429267 + html = %Q{<svg><a xmlns:xlink=http://www.w3.org/1999/xlink xlink:href=?><circle r=400 /><animate attributeName=xlink:href begin=0 from=javascript:alert(1) to=%26 by=5>} + sanitized = Loofah.scrub_fragment(html, :escape) assert_nil sanitized.at_css("animate")["from"] + assert_nil sanitized.at_css("animate")["to"] + assert_nil sanitized.at_css("animate")["by"] + end + + it "sanitizes 'values' attribute" do + # for CVE-2019-15587 + # see: + # - https://github.com/flavorjones/loofah/issues/171 + # - https://hackerone.com/reports/709009 + html = %Q{<svg> <animate href="#foo" attributeName="href" values="javascript:alert('xss')"/> <a id="foo"> <circle r=400 /> </a> </svg>} + + sanitized = Loofah.scrub_fragment(html, :escape) + assert_nil sanitized.at_css("animate")["values"] end end end
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
15- github.com/advisories/GHSA-c3gv-9cxf-6f57ghsaADVISORY
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/4WK2UG7ORKRQOJ6E4XJ2NVIHYJES6BYZ/mitrevendor-advisoryx_refsource_FEDORA
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XMCWPLYPNIWYAY443IZZJ4IHBBLIHBP5/mitrevendor-advisoryx_refsource_FEDORA
- nvd.nist.gov/vuln/detail/CVE-2019-15587ghsaADVISORY
- usn.ubuntu.com/4498-1/mitrevendor-advisoryx_refsource_UBUNTU
- www.debian.org/security/2019/dsa-4554ghsavendor-advisoryx_refsource_DEBIANWEB
- github.com/flavorjones/loofah/commit/0c6617af440879ce97440f6eb6c58636456dc8ecghsaWEB
- github.com/flavorjones/loofah/issues/171ghsax_refsource_CONFIRMWEB
- github.com/rubysec/ruby-advisory-db/blob/master/gems/loofah/CVE-2019-15587.ymlghsaWEB
- hackerone.com/reports/709009ghsax_refsource_MISCWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4WK2UG7ORKRQOJ6E4XJ2NVIHYJES6BYZghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XMCWPLYPNIWYAY443IZZJ4IHBBLIHBP5ghsaWEB
- security.netapp.com/advisory/ntap-20191122-0003ghsaWEB
- security.netapp.com/advisory/ntap-20191122-0003/mitrex_refsource_CONFIRM
- usn.ubuntu.com/4498-1ghsaWEB
News mentions
0No linked articles in our index yet.