Skip to content
DoS Advisory Intermediate CVE-2020-26307

GHSL-2020-301: Regular Expression Denial of Service (ReDoS) in HTML2Markdown - CVE-2020-26307

The HTML2Markdown library contains regular expressions for parsing HTML tags and attributes that are vulnerable to catastrophic backtracking. An attacker could supply a crafted HTML string to cause excessive CPU usage and a denial of service.

ghsecuritylab Follow

Originally disclosed on GitHub Security Lab

The project contains one or more regular expressions that are vulnerable to ReDoS (Regular Expression Denial of Service)

ghsecuritylab, on GitHub Security Lab

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 have ambiguous repetition that allows exponential backtracking on crafted input.

What the attacker needed

Attacker controls HTML input; application uses html2markdown

How it was found

  1. Install the html2markdown package using npm.
  2. Create a JavaScript file that requires the package and calls it with a crafted HTML string containing many repeated attributes.
  3. Run the file with Node.js to observe the slowdown.

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.

Regular expressions are patterns used to match text. Some patterns can take a very long time to process certain inputs, especially if they have overlapping rules. Here, a specially crafted HTML string makes the library's pattern matching slow down dramatically, which can freeze the application.

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.

More by ghsecuritylab

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

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.