{"id":"CVE-2023-36823","aliases":["DEBIAN-CVE-2023-36823","DLA-3652-1","DSA-5616-1","EUVD-2023-2045","GHSA-f5ww-cq3m-q3g7","UBUNTU-CVE-2023-36823","USN-6748-1"],"status":"published","title":"Sanitize vulnerable to Cross-site Scripting via insufficient neutralization of `style` element content","description":"Sanitize is an allowlist-based HTML and CSS sanitizer. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize starting with version 3.0.0 and prior to version 6.0.2 when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in cross-site scripting or other undesired behavior when the malicious HTML and CSS are rendered in a browser. Sanitize 6.0.2 performs additional escaping of CSS in `style` element content, which fixes this issue. Users who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.","severity":{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.00712,"percentile":0.5391,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79"],"published":"2023-07-06T15:06:00Z","modified":"2026-10-28T02:31:06Z","fixes":[{"ecosystem":"RubyGems","package":"sanitize","fixed_in":["6.0.2"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:12","package":"ruby-sanitize","fixed_in":["6.0.0-1.1+deb12u1"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"ruby-sanitize","fixed_in":["6.0.2-1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"ruby-sanitize","fixed_in":["6.0.2-1"],"sources":["osv"]},{"ecosystem":"Debian:10","package":"ruby-sanitize","fixed_in":["4.6.6-2.1~deb10u2"],"sources":["osv"]},{"ecosystem":"Debian:11","package":"ruby-sanitize","fixed_in":["5.2.1-2+deb11u1"],"sources":["osv"]},{"ecosystem":"Ubuntu:20.04:LTS","package":"ruby-sanitize","fixed_in":["4.6.6-2.1~0.20.04.2"],"sources":["osv"]},{"ecosystem":"Ubuntu:22.04:LTS","package":"ruby-sanitize","fixed_in":["6.0.0-1ubuntu0.1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"RubyGems","package":"sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"6.0.2"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.0-1.1+deb12u1"}]}],"versions":["6.0.0-1.1"]},{"source":"osv","ecosystem":"Debian:13","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.2-1"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.2-1"}]}]},{"source":"osv","ecosystem":"Debian:10","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.6.6-2.1~deb10u2"}]}],"versions":["4.6.6-2","4.6.6-2.1~deb10u1"]},{"source":"osv","ecosystem":"Debian:11","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.1-2+deb11u1"}]}],"versions":["5.2.1-2"]},{"source":"osv","ecosystem":"Debian:12","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.0-1.1+deb12u1"}]}],"versions":["6.0.0-1.1"]},{"source":"osv","ecosystem":"RubyGems","package":"sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"6.0.2"}]}],"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","4.6.3","4.6.4","4.6.5","4.6.6","5.0.0","5.1.0","5.2.0","5.2.1","5.2.2","5.2.3","6.0.0","6.0.1"]},{"source":"osv","ecosystem":"Ubuntu:20.04:LTS","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.6.6-2.1~0.20.04.2"}]}],"versions":["4.6.6-2","4.6.6-2.1~0.20.04.1"]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.0-1ubuntu0.1"}]}],"versions":["5.2.1-2","5.2.3-1","6.0.0-1"]},{"source":"osv","ecosystem":"Ubuntu:20.04:LTS","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.6.6-2.1~0.20.04.2"}]}],"versions":["4.6.6-2","4.6.6-2.1~0.20.04.1"],"bundled":2},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"ruby-sanitize","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.0.0-1ubuntu0.1"}]}],"versions":["5.2.1-2","5.2.3-1","6.0.0-1"],"bundled":2}],"products":[{"vendor":"debian","product":"debian_linux"},{"vendor":"rgrove","product":"sanitize"},{"vendor":"sanitize_project","product":"sanitize"}],"references":[{"url":"https://github.com/rgrove/sanitize/security/advisories/GHSA-f5ww-cq3m-q3g7","tags":["x_refsource_CONFIRM","x_transferred","Vendor Advisory","advisory","web","report"]},{"url":"https://github.com/rgrove/sanitize/commit/76ed46e6dc70820f38efe27de8dabd54dddb5220","tags":["x_refsource_MISC","x_transferred","Patch","fix","web","report"]},{"url":"https://github.com/rgrove/sanitize/releases/tag/v6.0.2","tags":["x_refsource_MISC","x_transferred","Release Notes","web","report"]},{"url":"https://lists.debian.org/debian-lts-announce/2023/11/msg00008.html","tags":["x_transferred","Mailing List","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-36823","tags":["advisory"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sanitize/CVE-2023-36823.yml","tags":["web"]},{"url":"https://github.com/advisories/GHSA-f5ww-cq3m-q3g7"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/36xxx/CVE-2023-36823.json","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2023-36823","tags":["advisory"]},{"url":"https://github.com/rgrove/sanitize","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2023-36823","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2023-36823","tags":["report"]},{"url":"https://ubuntu.com/security/notices/USN-6748-1","tags":["advisory"]},{"url":"https://ubuntu.com/security/CVE-2023-23627","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2023-36823","title":"Sanitize vulnerable to Cross-site Scripting via insufficient neutralization of `style` element content","description":"Sanitize is an allowlist-based HTML and CSS sanitizer. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize starting with version 3.0.0 and prior to version 6.0.2 when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in cross-site scripting or other undesired behavior when the malicious HTML and CSS are rendered in a browser. Sanitize 6.0.2 performs additional escaping of CSS in `style` element content, which fixes this issue. Users who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.","status":"published","published":"2023-07-06T15:06:00.509Z","modified":"2025-02-13T16:56:27.159Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high","assessor":"cna"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:35:27.810438Z"}],"euvd":[{"id":"EUVD-2023-2045","description":"Sanitize is an allowlist-based HTML and CSS sanitizer. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize starting with version 3.0.0 and prior to version 6.0.2 when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in cross-site scripting or other undesired behavior when the malicious HTML and CSS are rendered in a browser. Sanitize 6.0.2 performs additional escaping of CSS in `style` element content, which fixes this issue. Users who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.","status":"published","published":"2023-07-06T15:06:00Z","modified":"2025-02-13T16:56:27Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high"}],"updated_at":"2026-11-03T00:03:50.021705Z"}],"ghsa":[{"id":"GHSA-f5ww-cq3m-q3g7","title":"Sanitize vulnerable to Cross-site Scripting via insufficient neutralization of `style` element content","description":"### Impact\n\nUsing carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize `\u003e= 3.0.0, \u003c 6.0.2` when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in XSS (cross-site scripting) or other undesired behavior when the malicious HTML and CSS are rendered in a browser.\n\n### Patches\n\nSanitize `\u003e= 6.0.2` performs additional escaping of CSS in `style` element content, which fixes this issue.\n\n### Workarounds\n\nUsers who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.\n\n### Credit\n\nThis issue was found by @cure53 during an audit of a project that uses Sanitize and was reported by one of that project's maintainers. Thank you!","status":"published","published":"2023-07-06T19:45:44Z","modified":"2023-11-23T05:05:19Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:37:22.840002Z"}],"nvd":[{"id":"CVE-2023-36823","description":"Sanitize is an allowlist-based HTML and CSS sanitizer. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize starting with version 3.0.0 and prior to version 6.0.2 when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in cross-site scripting or other undesired behavior when the malicious HTML and CSS are rendered in a browser. Sanitize 6.0.2 performs additional escaping of CSS in `style` element content, which fixes this issue. Users who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.","status":"published","published":"2023-07-06T16:15:10.147Z","modified":"2026-06-17T06:07:09.173Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high","assessor":"secondary"},{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:08:15.127597Z"}],"osv":[{"id":"CVE-2023-36823","title":"Sanitize vulnerable to Cross-site Scripting via insufficient neutralization of `style` element content","description":"Sanitize is an allowlist-based HTML and CSS sanitizer. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize starting with version 3.0.0 and prior to version 6.0.2 when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in cross-site scripting or other undesired behavior when the malicious HTML and CSS are rendered in a browser. Sanitize 6.0.2 performs additional escaping of CSS in `style` element content, which fixes this issue. Users who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.","status":"published","published":"2023-07-06T15:06:00.509Z","modified":"2026-10-28T02:31:06.477079194Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:44:32.510144Z"},{"id":"DEBIAN-CVE-2023-36823","description":"Sanitize is an allowlist-based HTML and CSS sanitizer. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize starting with version 3.0.0 and prior to version 6.0.2 when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in cross-site scripting or other undesired behavior when the malicious HTML and CSS are rendered in a browser. Sanitize 6.0.2 performs additional escaping of CSS in `style` element content, which fixes this issue. Users who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.","status":"published","published":"2023-07-06T16:15:10.147Z","modified":"2026-10-26T18:03:05.508000441Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T15:45:39.980321Z"},{"id":"GHSA-f5ww-cq3m-q3g7","title":"Sanitize vulnerable to Cross-site Scripting via insufficient neutralization of `style` element content","description":"### Impact\n\nUsing carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize `\u003e= 3.0.0, \u003c 6.0.2` when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in XSS (cross-site scripting) or other undesired behavior when the malicious HTML and CSS are rendered in a browser.\n\n### Patches\n\nSanitize `\u003e= 6.0.2` performs additional escaping of CSS in `style` element content, which fixes this issue.\n\n### Workarounds\n\nUsers who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.\n\n### Credit\n\nThis issue was found by @cure53 during an audit of a project that uses Sanitize and was reported by one of that project's maintainers. Thank you!","status":"published","published":"2023-07-06T19:45:44Z","modified":"2024-02-16T07:55:20.89324Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:46.006631Z"},{"id":"UBUNTU-CVE-2023-36823","description":"Sanitize is an allowlist-based HTML and CSS sanitizer. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML and CSS through Sanitize starting with version 3.0.0 and prior to version 6.0.2 when Sanitize is configured to use the built-in \"relaxed\" config or when using a custom config that allows `style` elements and one or more CSS at-rules. This could result in cross-site scripting or other undesired behavior when the malicious HTML and CSS are rendered in a browser. Sanitize 6.0.2 performs additional escaping of CSS in `style` element content, which fixes this issue. Users who are unable to upgrade can prevent this issue by using a Sanitize config that doesn't allow `style` elements, using a Sanitize config that doesn't allow CSS at-rules, or by manually escaping the character sequence `\u003c/` as `\u003c\\/` in `style` element content.","status":"published","published":"2023-07-06T16:15:00Z","modified":"2026-02-05T03:01:50.664099Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"},{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L","level":"high"}],"updated_at":"2026-11-02T16:54:21.882004Z"},{"id":"DLA-3652-1","title":"ruby-sanitize - security update","status":"published","published":"2023-11-14T00:00:00Z","modified":"2026-03-09T01:20:09.719892Z","updated_at":"2026-11-02T15:46:12.203458Z"},{"id":"DSA-5616-1","title":"ruby-sanitize - security update","status":"published","published":"2024-02-05T00:00:00Z","modified":"2026-03-09T02:08:43.389914Z","updated_at":"2026-11-02T15:46:17.892347Z"},{"id":"USN-6748-1","title":"ruby-sanitize vulnerabilities","description":"It was discovered that Sanitize incorrectly handled noscript elements\nunder certain circumstances. An attacker could possibly use this issue to\nexecute a cross-site scripting (XSS) attack. This issue only affected\nUbuntu 22.04 LTS. (CVE-2023-23627)\n\nIt was discovered that Sanitize incorrectly handled style elements under\ncertain circumstances. An attacker could possibly use this issue to\nexecute a cross-site scripting (XSS) attack. (CVE-2023-36823)\n","status":"published","published":"2024-04-24T05:23:38Z","modified":"2026-02-10T04:43:41Z","updated_at":"2026-11-02T16:58:17.914523Z"}]}}
