GHSL-2020-305: Regular Expression Denial of Service (ReDoS) in Pure JavaScript HTML5 Parser - CVE-2020-26310
The Pure JavaScript HTML5 Parser contains regular expressions that are vulnerable to ReDoS, allowing an attacker to cause excessive CPU usage by supplying a crafted input string. This can lead to a denial of service.
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
Root cause
Likely the regular expressions for start tags and attributes contain ambiguous or overlapping clauses that cause exponential backtracking on crafted input.
Impact
This issue may lead to a denial of service.
What the attacker needed
Attacker can control input to the parser
How it was found
- Open the provided demo page.
- Observe the CPU usage spike.
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.
Some patterns used to search text (regular expressions) can be written in a way that makes them very slow when given certain inputs. An attacker can send a specially crafted string that makes the parser take a very long time to process, effectively freezing the application. This is called a regular expression denial of service (ReDoS).
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.