{"id":"CVE-2018-3740","aliases":["DEBIAN-CVE-2018-3740","DSA-4358-1","EUVD-2018-0174","GHSA-7f42-p84j-f58p","UBUNTU-CVE-2018-3740"],"status":"published","title":"Sanitize vulnerable to Improper Input Validation and Cross-site Scripting","description":"A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.","severity":{"version":"3.0","score":7.5,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"high","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-08","score":0.01468,"percentile":0.73905,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-20","CWE-79"],"published":"2018-03-21T11:56:32Z","modified":"2026-10-23T18:03:21Z","fixes":[{"ecosystem":"RubyGems","package":"sanitize","fixed_in":["4.6.3"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:12","package":"ruby-sanitize","fixed_in":["4.6.6-1"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"ruby-sanitize","fixed_in":["4.6.6-1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"ruby-sanitize","fixed_in":["4.6.6-1"],"sources":["osv"]},{"ecosystem":"Debian:9","package":"ruby-sanitize","fixed_in":["2.1.0-2+deb9u1"],"sources":["osv"]},{"ecosystem":"Ubuntu:16.04:LTS","package":"ruby-sanitize","fixed_in":["2.1.0-2+deb9u1build0.16.04.1"],"sources":["osv"]},{"ecosystem":"Ubuntu:18.04:LTS","package":"ruby-sanitize","fixed_in":["2.1.0-2+deb9u1build0.18.04.1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"RubyGems","package":"sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"4.6.3"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.6.6-1"}]}]},{"source":"osv","ecosystem":"Debian:13","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.6.6-1"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.6.6-1"}]}]},{"source":"osv","ecosystem":"Debian:9","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.1.0-2+deb9u1"}]}],"versions":["2.1.0-2"]},{"source":"osv","ecosystem":"RubyGems","package":"sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"4.6.3"}]}],"versions":["3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.1.0","3.1.1","3.1.2","4.0.0","4.0.1","4.1.0","4.2.0","4.3.0","4.4.0","4.5.0","4.6.0","4.6.1","4.6.2"]},{"source":"osv","ecosystem":"Ubuntu:16.04:LTS","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.1.0-2+deb9u1build0.16.04.1"}]}],"versions":["2.1.0-1","2.1.0-2"]},{"source":"osv","ecosystem":"Ubuntu:18.04:LTS","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.1.0-2+deb9u1build0.18.04.1"}]}],"versions":["2.1.0-2"]}],"products":[{"vendor":"ryan grove","product":"sanitize (ruby gem)"},{"vendor":"sanitize_project","product":"sanitize"}],"references":[{"url":"https://www.debian.org/security/2018/dsa-4358","tags":["vendor-advisory","x_refsource_DEBIAN","x_transferred","advisory","web"]},{"url":"https://github.com/rgrove/sanitize/issues/176","tags":["x_refsource_CONFIRM","x_transferred","Issue Tracking","Third Party Advisory","report","web"]},{"url":"https://about.gitlab.com/2018/06/25/security-release-gitlab-11-dot-0-dot-1-released/","tags":["x_refsource_CONFIRM","x_transferred","web"]},{"url":"https://github.com/rgrove/sanitize/commit/01629a162e448a83d901456d0ba8b65f3b03d46e","tags":["x_refsource_CONFIRM","x_transferred","Patch","Third Party Advisory","fix","web","report"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2018-3740","tags":["advisory"]},{"url":"https://github.com/rgrove/sanitize/commit/93feeb38e21864146bb29191792b971dbe1ec62e","tags":["web"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sanitize/CVE-2018-3740.yml","tags":["web"]},{"url":"https://github.com/advisories/GHSA-7f42-p84j-f58p"},{"url":"https://security-tracker.debian.org/tracker/CVE-2018-3740","tags":["advisory"]},{"url":"https://about.gitlab.com/2018/06/25/security-release-gitlab-11-dot-0-dot-1-released","tags":["web"]},{"url":"https://github.com/rgrove/sanitize","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2018-3740","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2018-3740","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2018-3740","description":"A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.","status":"published","published":"2018-03-30T19:00:00Z","modified":"2024-08-05T04:50:30.616Z","cwes":["CWE-79"],"updated_at":"2026-11-02T14:35:05.262903Z"}],"euvd":[{"id":"EUVD-2018-0174","description":"A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.","status":"published","published":"2018-03-30T19:00:00Z","modified":"2024-08-05T04:50:30Z","updated_at":"2026-11-03T02:40:15.759349Z"}],"ghsa":[{"id":"GHSA-7f42-p84j-f58p","title":"Sanitize vulnerable to Improper Input Validation and Cross-site Scripting","description":"When Sanitize \u003c= 4.6.2 is used in combination with libxml2 \u003e= 2.9.2, a specially crafted HTML fragment can cause libxml2 to generate improperly escaped output, allowing non-whitelisted attributes to be used on whitelisted elements.\n\nThis can allow HTML and JavaScript injection, which could result in XSS if Sanitize's output is served to browsers.","status":"published","published":"2018-03-21T11:56:32Z","modified":"2023-01-23T20:47:12Z","cvss":[{"version":"3.0","score":7.5,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"high"}],"cwes":["CWE-20","CWE-79"],"updated_at":"2026-11-02T14:36:14.033357Z"}],"nvd":[{"id":"CVE-2018-3740","description":"A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.","status":"published","published":"2018-03-30T19:29:00.27Z","modified":"2026-06-17T01:57:45.18Z","cvss":[{"version":"3.0","score":7.5,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"high","assessor":"primary"},{"version":"2.0","score":5,"vector":"AV:N/AC:L/Au:N/C:N/I:P/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-79","CWE-20"],"updated_at":"2026-11-02T14:04:24.700429Z"}],"osv":[{"id":"CVE-2018-3740","description":"A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.","status":"published","published":"2018-03-30T19:29:00.27Z","modified":"2026-10-20T10:50:27.807921225Z","cvss":[{"version":"3.0","score":7.5,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"high"}],"updated_at":"2026-11-02T15:44:09.442568Z"},{"id":"DEBIAN-CVE-2018-3740","description":"A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.","status":"published","published":"2018-03-30T19:29:00.27Z","modified":"2026-10-23T18:03:21.988605046Z","cvss":[{"version":"3.0","score":7.5,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"high"}],"updated_at":"2026-11-02T15:45:30.867575Z"},{"id":"GHSA-7f42-p84j-f58p","title":"Sanitize vulnerable to Improper Input Validation and Cross-site Scripting","description":"When Sanitize \u003c= 4.6.2 is used in combination with libxml2 \u003e= 2.9.2, a specially crafted HTML fragment can cause libxml2 to generate improperly escaped output, allowing non-whitelisted attributes to be used on whitelisted elements.\n\nThis can allow HTML and JavaScript injection, which could result in XSS if Sanitize's output is served to browsers.","status":"published","published":"2018-03-21T11:56:32Z","modified":"2024-02-16T08:20:34.576085Z","cvss":[{"version":"3.0","score":7.5,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"high"}],"cwes":["CWE-20","CWE-79"],"updated_at":"2026-11-02T15:46:41.002603Z"},{"id":"UBUNTU-CVE-2018-3740","description":"A specially crafted HTML fragment can cause Sanitize gem for Ruby to allow non-whitelisted attributes to be used on a whitelisted HTML element.","status":"published","published":"2018-03-30T19:29:00Z","modified":"2025-07-17T16:53:47Z","cvss":[{"version":"3.0","score":7.5,"vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"high"}],"updated_at":"2026-11-02T15:54:18.33562Z"},{"id":"DSA-4358-1","title":"ruby-sanitize - security update","status":"published","published":"2018-12-27T00:00:00Z","modified":"2026-03-09T02:09:27.232139Z","updated_at":"2026-11-02T15:46:16.862196Z"}]}}
