CVE-2022-23647
JSON

7.5high

Cross-site Scripting in Prism

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
1.48% (higher than 74% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-3949-f494-cm99

Description

Prism is a syntax highlighting library. Starting with version 1.14.0 and prior to version 1.27.0, Prism's command line plugin can be used by attackers to achieve a cross-site scripting attack. The command line plugin did not properly escape its output, leading to the input text being inserted into the DOM as HTML code. Server-side usage of Prism is not impacted. Websites that do not use the Command Line plugin are also not impacted. This bug has been fixed in v1.27.0. As a workaround, do not use the command line plugin on untrusted inputs, or sanitize all code blocks (remove all HTML code text) from all code blocks that use the command line plugin.

Affected

Product or packageVersionsReported by
PrismJS prism>= 1.14.0, < 1.27.0, from 1.14.0 before 1.27.0CVE List, NVD
prismjs (npm)from 1.14.0 before 1.27.0GitHub Advisory Database

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:L/A:L
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:L/A:L
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD4.3medium CVSS:2.0AV:N/AC:M/Au:N/C:N/I:P/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Prism is a syntax highlighting library. Starting with version 1.14.0 and prior to version 1.27.0, Prism's command line plugin can be used by attackers to achieve a cross-site scripting attack. The command line plugin did not properly escape its output, leading to the input text being inserted into the DOM as HTML code. Server-side usage of Prism is not impacted. Websites that do not use the Command Line plugin are also not impacted. This bug has been fixed in v1.27.0. As a workaround, do not use the command line plugin on untrusted inputs, or sanitize all code blocks (remove all HTML code text) from all code blocks that use the command line plugin.

GitHub Advisory Database
Impact

Prism's Command line plugin can be used by attackers to achieve an XSS attack. The Command line plugin did not properly escape its output, leading to the input text being inserted into the DOM as HTML code.

Server-side usage of Prism is not impacted. Websites that do not use the Command Line plugin are also not impacted.

Patches

This bug has been fixed in v1.27.0.

Workarounds

Do not use the Command line plugin on untrusted inputs, or sanitized all code blocks (remove all HTML code text) from all code blocks that use the Command line plugin.

References
NVD (es)

Prism es una biblioteca de resaltado de sintaxis. A partir de la versión 1.14.0 y versiones anteriores a 1.27.0, el plugin de línea de comandos de Prism puede ser usado por atacantes para lograr un ataque de tipo cross-site scripting. El plugin de línea de comandos no escapaba apropiadamente su salida, conllevando a que el texto de entrada fuera insertado en el DOM como código HTML. El uso del lado del servidor de Prism no está afectado. Los sitios web que no usan el plugin de línea de comandos tampoco están afectados. Este error ha sido corregido en la versión 1.27.0. Como medida de mitigación, no use el complemento de línea de comandos en entradas no confiables, o sanee todos los bloques de código (elimine todo el texto de código HTML) de todos los bloques de código que usen el complemento de línea de comandos

References

Sources

SourceRecordLicence
CVE ListCVE-2022-23647 changed 2025-04-23CVE Terms of Use
GitHub Advisory DatabaseGHSA-3949-f494-cm99 changed 2023-11-08CC-BY-4.0
NVDCVE-2022-23647 changed 2026-06-17Public domain