Skip to content
DoS Advisory Intermediate

GHSL-2021-028: ReDoS (Regular Expression Denial of Service) in mithril.js

The mithril.js library contains a regular expression in its CSS selector parser that is vulnerable to ReDoS, allowing an attacker who can inject a string into a CSS selector to cause a denial of service by triggering exponential backtracking.

kevinbackhouse 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)

kevinbackhouse, 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 expression contains overlapping or ambiguous clauses that allow exponential backtracking on certain inputs.

Impact

This issue may lead to a denial of service.

What the attacker needed

Attacker can inject a string into a CSS selector

The fix

The fix was implemented by Pierre-Yves Gérardy and a draft security advisory was created, but the text does not specify the exact code change.

How it was found

  1. Install mithril via npm.
  2. Run a Node.js script that requires the hyperscript module and passes a crafted string to it.

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 match text. Some patterns can become extremely slow when given a specially crafted input, causing the program to freeze. This is called a regular expression denial of service (ReDoS). Here, an attacker who can control part of a CSS selector could make the browser or server 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.

More by kevinbackhouse

View all

47 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.