{"id":"CVE-2023-23627","aliases":["CVE-2023-23627","GHSA-fw3g-2h3j-qmm7"],"related":[],"kind":"vulnerability","state":"published","title":"Sanitize vulnerable to Cross-site Scripting via Improper neutralization of `noscript` element","summary":"Sanitize is an allowlist-based HTML and CSS sanitizer. Versions 5.0.0 and later, prior to 6.0.1, are vulnerable to Cross-site Scripting. When Sanitize is configured with a custom allowlist that allows `noscript` elements, attackers are able to include arbitrary HTML, resulting in XSS (cross-site scripting) or other undesired behavior when that HTML is rendered in a browser. The default configurations do not allow `noscript` elements and are not vulnerable. This issue only affects users who are using a custom config that adds `noscript` to the element allowlist. This issue has been patched in version 6.0.1. Users who are unable to upgrade can prevent this issue by using one of Sanitize's default configs or by ensuring that their custom config does not include `noscript` in the element allowlist.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Sanitize is an allowlist-based HTML and CSS sanitizer. Versions 5.0.0 and later, prior to 6.0.1, are vulnerable to Cross-site Scripting. When Sanitize is configured with a custom allowlist that allows `noscript` elements, attackers are able to include arbitrary HTML, resulting in XSS (cross-site scripting) or other undesired behavior when that HTML is rendered in a browser. The default configurations do not allow `noscript` elements and are not vulnerable. This issue only affects users who are using a custom config that adds `noscript` to the element allowlist. This issue has been patched in version 6.0.1. Users who are unable to upgrade can prevent this issue by using one of Sanitize's default configs or by ensuring that their custom config does not include `noscript` in the element allowlist.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nUsing carefully crafted input, an attacker may be able to sneak arbitrary HTML through Sanitize `>= 5.0.0, < 6.0.1` when Sanitize is configured with a custom allowlist that allows `noscript` elements. This could result in XSS (cross-site scripting) or other undesired behavior when that HTML is rendered in a browser.\n\nSanitize's default configs don't allow `noscript` elements and are not vulnerable. This issue only affects users who are using a custom config that adds `noscript` to the element allowlist.\n\n### Patches\n\nSanitize `>= 6.0.1` always removes `noscript` elements and their contents, even when `noscript` is in the allowlist.\n\n### Workarounds\n\nUsers who are unable to upgrade can prevent this issue by using one of Sanitize's default configs or by ensuring that their custom config does not include `noscript` in the element allowlist.\n\n### Details\n\nThe root cause of this issue is that HTML parsing rules treat the contents of a `noscript` element differently depending on whether scripting is enabled in the user agent. Nokogiri (the HTML parser Sanitize uses) doesn't support scripting so it follows the \"scripting disabled\" rules, but a web browser with scripting enabled will follow the \"scripting enabled\" rules. This means that Sanitize can't reliably make the contents of a `noscript` element safe for scripting enabled browsers. The safest thing to do is to remove the element and its contents entirely, which is now what Sanitize does in version 6.0.1 and later.\n\n### References\n\n- [Release Notes](https://github.com/rgrove/sanitize/releases/tag/v6.0.1)\n\n### Credit\n\nThanks to David Klein from [TU Braunschweig](https://www.tu-braunschweig.de/en/ias) (@leeN) for reporting this issue.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Sanitize es un desinfectante de HTML y CSS basado en listas de permitidos. Las versiones 5.0.0 y posteriores, anteriores a la 6.0.1, son vulnerables a cross-site scripting. Cuando Sanitize se configura con una lista de permitidos personalizada que permite elementos \"noscript\", los atacantes pueden incluir HTML arbitrario, lo que genera XSS (scripting entre sitios) u otro comportamiento no deseado cuando ese HTML se representa en un navegador. Las configuraciones predeterminadas no permiten elementos \"noscript\" y no son vulnerables. Este problema solo afecta a los usuarios que utilizan una configuración personalizada que agrega \"noscript\" a la lista de elementos permitidos. Este problema se solucionó en la versión 6.0.1. Los usuarios que no pueden actualizar pueden evitar este problema usando una de las configuraciones predeterminadas de Sanitize o asegurándose de que su configuración personalizada no incluya \"noscript\" en la lista de elementos permitidos.","source":"nvd"}],"published":"2023-01-27T23:44:17.617Z","modified":"2026-06-17T05:37:37.137Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 5.0.0, < 6.0.1","status":"affected"}],"vendor":"rgrove","product":"sanitize","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"5.0.0","status":"affected","fixed":"6.0.1"}],"ecosystem":"RubyGems","package":"sanitize","purl":"pkg:gem/sanitize","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"5.0.0","fixed":"6.0.1"}],"vendor":"sanitize_project","product":"sanitize","cpe":"cpe:2.3:a:sanitize_project:sanitize:*:*:*:*:*:ruby:*:*","source":"nvd"}],"references":[{"url":"https://github.com/rgrove/sanitize/security/advisories/GHSA-fw3g-2h3j-qmm7","tags":["mitigation","release-notes","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-23627","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rgrove/sanitize/commit/ec14265e530dc3fe31ce2ef773594d3a97778d22","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/rgrove/sanitize","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sanitize/CVE-2023-23627.yml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-03-10T20:58:50.279Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-23627","url":"https://www.cve.org/CVERecord?id=CVE-2023-23627","licence":"CVE Terms of Use","modified":"2025-03-10T21:17:49.562Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fw3g-2h3j-qmm7","url":"https://github.com/advisories/GHSA-fw3g-2h3j-qmm7","licence":"CC-BY-4.0","modified":"2023-11-08T04:11:41.856Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-23627","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-23627","licence":"Public domain","modified":"2026-06-17T05:37:37.137Z"}],"updatedAt":"2026-11-25T22:58:21.764Z","epss":{"score":0.00574,"percentile":0.4135,"date":"2026-11-30T12:00:22.000Z"}}