Skip to content
DoS Advisory Intermediate

GHSL-2021-030: ReDoS (Regular expression Denial of Service in CodeMirror

CodeMirror's markdown mode contains a regular expression vulnerable to ReDoS, allowing an attacker to freeze a victim's browser tab by supplying a crafted input string. The maintainer disputed the severity, stating the worst effect is a temporary hang in specific circumstances.

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 expression contains ambiguous or overlapping clauses that cause exponential backtracking on crafted input.

Impact

This issue may lead to a denial of service, though the maintainer noted it only freezes a browser tab in very specific circumstances.

What the attacker needed

Victim pastes crafted text into editor

The fix

The bug was fixed by commit 2f401f8, though the maintainer did not treat it as a vulnerability.

How it was found

  1. Open the CodeMirror markdown demo page.
  2. Paste a crafted string starting with a link reference and many backslashes into the editor.

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 be written so that certain inputs make the matching process take an extremely long time, effectively freezing the program. Here, pasting a specially crafted line into a CodeMirror editor could make the browser tab 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 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.