CVE-2021-32723: Regular Expression Denial of Service (ReDoS) in PrismJS

prismjs Updated 02 Oct 2025

Summary

28/06/2021
Yes i
High
7.4

CVE-2021-32723: Regular Expression Denial of Service (ReDoS) in Prism. Affects prismjs versions < 1.24.0. Fixed in 1.24.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

PrismJS is an open-source syntax highlighting library used to add color and formatting to code snippets on websites. It supports various programming languages and markup formats. However, versions before 1.24.0 are susceptible to a Regular Expression Denial of Service (ReDoS) vulnerability.

Vulnerability Detail

The vulnerability arises when Prism is employed to highlight untrusted text provided by users. An attacker can create a specially crafted string that will cause the highlighting process to take an extremely long time, potentially leading to a denial of service. This vulnerability affects the ASCIIDoc and ERB languages, while other languages remain unaffected.

How To Fix

Latest published version: 1.30.0 as of 23 Oct 2026

npm install prismjs@1.30.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.24.0

This is the first release that contains the fix.

npm install prismjs@1.24.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. Updating to the fixed version is the recommended solution.

Conclusion

The Regular Expression Denial of Service vulnerability in PrismJS versions prior to 1.24.0 can be mitigated by updating to the fixed version. It is recommended to promptly update the library to ensure the security and stability of code highlighting functionality. For further assistance or support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for prismjs →

Share this vulnerability

FAQ

Versions prior to 1.24.0 are vulnerable to this Regular Expression Denial of Service (ReDoS) issue.

An attacker can exploit this vulnerability to cause a denial of service by providing a specially crafted string that takes an excessively long time to highlight.

The ASCIIDoc and ERB languages are affected. Other languages supported by PrismJS are not vulnerable.

No, there is no known workaround. Updating to the fixed version is the recommended solution.

Related vulnerabilities

Recent vulnerabilities recorded for prismjs.

How To Fix

Latest published version: 1.30.0 as of 23 Oct 2026

npm install prismjs@1.30.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.24.0

This is the first release that contains the fix.

npm install prismjs@1.24.0

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback