# CVE-2022-23647: PrismJS Prism cross-site scripting in Command Line plugin

Source: https://junglewise.ai/threats/cve-2022-23647-prismjs-prism-cross-site-scripting-in-command-line-plugin  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2022-02-22. Updated: 2026-05-14  
License: CC BY 4.0 with a link back

CVE-2022-23647 · Severity: low · CVSS 3.1 · Published 2022-02-22

Prism is a popular software library used by websites to display code snippets with clear, readable formatting. A security flaw in its Command Line plugin allows attackers to inject malicious scripts into a webpage if the site displays untrusted code using that specific plugin. This could lead to unauthorized actions being performed in a user's browser or the theft of sensitive session information.

Technologies: [prismjs (npm)](https://junglewise.ai/threats/technologies/prismjs). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2022-23647 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2022-23647 being exploited in the wild.

**How severe is CVE-2022-23647?** Low severity, with a CVSS score of 3.1, published 22 February 2022.

**Which products and versions are affected?** prismjs (npm) SEMVER:introduced=1.14.0,fixed=1.27.0.

**Is there a fix for CVE-2022-23647?** Yes. prismjs (npm): upgrade to 1.27.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2022-23647 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2022-23647?** Check whether you run prismjs (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- prismjs (npm): upgrade to 1.27.0 or later

  ```sh
  npm install prismjs@1.27.0
  ```


## Technical details

A Cross-Site Scripting (XSS) vulnerability exists in the Command Line plugin of PrismJS. The root cause is the failure to properly escape output markup when processing command-line code blocks, allowing input text to be inserted directly into the DOM as HTML. An attacker can exploit this by providing malicious code snippets to a website that uses the affected plugin to render untrusted content. Successful exploitation requires a victim to visit a page where the malicious snippet is rendered. Server-side usage of Prism is unaffected. The issue is fixed in version 1.27.0 by implementing proper encoding of output lines.

## Affected products

- PrismJS prismjs >= 1.14.0, < 1.27.0

## Identifiers

- CVE-2022-23647
- GHSA-3949-f494-cm99

## Timeline

- 2022-02-16: patched: Fix merged into master branch
- 2022-02-18: advisory: GitHub and NVD advisories published
- 2022-02-22: disclosed

## References

- [https://github.com/PrismJS/prism/security/advisories/GHSA-3949-f494-cm99](https://github.com/PrismJS/prism/security/advisories/GHSA-3949-f494-cm99)
- [https://github.com/PrismJS/prism/pull/3341](https://github.com/PrismJS/prism/pull/3341)
- [https://github.com/PrismJS/prism/commit/e002e78c343154e1c0ddf9d6a0bb85689e1a5c7c](https://github.com/PrismJS/prism/commit/e002e78c343154e1c0ddf9d6a0bb85689e1a5c7c)
- [https://github.com/PrismJS/prism](https://github.com/PrismJS/prism)

## Related threats

- [PrismJS DOM Clobbering vulnerability](https://junglewise.ai/threats/cve-2024-53382-prismjs-dom-clobbering-vulnerability)
- [PrismJS regular expression denial of service](https://junglewise.ai/threats/cve-2021-3801-prismjs-regular-expression-denial-of-service)
- [PrismJS Prism regular expression denial of service](https://junglewise.ai/threats/cve-2021-32723-prismjs-prism-regular-expression-denial-of-service)
- [PrismJS regular expression denial of service](https://junglewise.ai/threats/cve-2021-23341-prismjs-regular-expression-denial-of-service)
- [PrismJS cross-site scripting in easing preview](https://junglewise.ai/threats/cve-2020-15138-prismjs-cross-site-scripting-in-easing-preview)
