GHSL-2020-300: Regular Expression Denial of Service in markdown-to-jsx
The markdown-to-jsx library contains a regular expression that is vulnerable to ReDoS, allowing an attacker to cause a denial of service by supplying a crafted input string that triggers exponential backtracking.
Originally disclosed on GitHub Security Lab
The project contains one or more regular expressions that are vulnerable to ReDoS (Regular Expression Denial of Service)
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
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
Impact
This issue may lead to a denial of service.
What the attacker needed
Attacker controls input to markdown-to-jsx
How it was found
- Install markdown-to-jsx and React using npm.
- Create a JavaScript file that requires the compiler from markdown-to-jsx.
- Call the compiler with a crafted string containing an HTML tag with many escaped exclamation marks and set disableParsingRawHTML to false.
- Run the file with node to observe the denial of service.
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.
A regular expression is a pattern used to search or match text. Some patterns can become extremely slow when given certain inputs, causing the program to freeze. This report shows that a library for converting markdown to React components has such a pattern, so an attacker could send a specially crafted string to make the application hang.
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.