Regular Expression Denial of Service in markdown

markdown Updated 02 Oct 2025

Summary

04/09/2020
LOW
No i
Low
Not published

GHSA-wx77-rp39-c6vg: Regular Expression Denial of Service in markdown. Affects markdown versions >= 0.0.0. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The markdown package is an npm package used for converting Markdown syntax to HTML. It provides a convenient way to parse and render Markdown content. However, all versions of markdown are vulnerable to Regular Expression Denial of Service (ReDoS). The vulnerability specifically affects the markdown.toHTML() function, which exhibits degraded performance when parsing long strings containing underscores. This can potentially lead to a Denial of Service if the parser accepts user input.

Vulnerability Detail

The Regular Expression Denial of Service (ReDoS) vulnerability in the markdown package arises from inefficient regular expressions used in the markdown.toHTML() function. When processing long strings with underscores, the regular expressions can cause the function to exhibit significantly degraded performance. This can be exploited by an attacker to craft malicious input that triggers a ReDoS attack, leading to a denial of service condition. The severity of this vulnerability is considered low.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As there is no fix available, a possible workaround is to sanitize user input before passing it to the markdown.toHTML() function. This can involve validating and limiting the length of input strings, as well as removing any potentially malicious characters or patterns. Here is an example of how to sanitize user input in JavaScript:

function sanitizeInput(input) {
  // Validate and limit input length
  if (input.length > MAX_LENGTH) {
    throw new Error('Input length exceeds maximum limit');
  }

  // Remove underscores
  const sanitizedInput = input.replace(/_/g, '');

  return sanitizedInput;
}

Conclusion

The markdown package is vulnerable to a Regular Expression Denial of Service (ReDoS) issue, which can lead to a denial of service if user input is accepted by the markdown.toHTML() function. Currently, there is no fix available, and it is recommended to use an alternative package until a fix is released. Sanitizing user input can help mitigate the risk of this vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for markdown →

Share this vulnerability

FAQ

The vulnerability is a Regular Expression Denial of Service (ReDoS) issue in the markdown package. It occurs when parsing long strings containing underscores, leading to significantly degraded performance and potential denial of service.

The impact of this vulnerability is a potential denial of service if the markdown.toHTML() function accepts user input. An attacker can craft malicious input to trigger a ReDoS attack, causing the function to consume excessive resources and slow down or crash the application.

No, there is currently no fix available for this vulnerability in the markdown package. It is recommended to use an alternative package until a fix is released.

To mitigate the risk, you can sanitize user input before passing it to the markdown.toHTML() function. This involves validating and limiting the length of input strings, as well as removing any potentially malicious characters or patterns.

Related vulnerabilities

Recent vulnerabilities recorded for markdown.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback