Skip to content
DoS Disclosed report Intermediate CVE-2021-3801

prismjs Regular Expression Denial of Service vulnerability

The prismjs syntax highlighting library contains a regular expression that is vulnerable to catastrophic backtracking. An attacker who can supply a crafted HTML comment as input can cause the application to consume excessive CPU, leading to denial of service.

prismjs/prism

Originally disclosed on huntr

Prism is a syntax highlighting library. The prismjs package is vulnerable to ReDoS (regular expression denial of service). An attacker that is able to provide a crafted HTML comment as input may cause an application to consume an excessive amount of CPU.

From the GitHub Advisory Database (GHSA-hqhp-5p83-hx96, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a regular expression in Prism's HTML comment parsing is vulnerable to catastrophic backtracking (ReDoS).

Impact

An attacker could cause the application to consume excessive CPU, potentially leading to denial of service.

What the attacker needed

Attacker can supply input to Prism; input is an HTML comment

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Prism is a tool that adds colours to code on websites. A regular expression is a pattern used to find text, and some patterns can become extremely slow when given certain input. Here, a specially crafted HTML comment makes the pattern take a very long time, using up the computer's processing power and slowing down or stopping the service for everyone.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.