CVE-2021-43308: Regular expression denial of service in markdown-link-extractor

markdown-link-extractor Updated 02 Oct 2025

Summary

03/06/2022
Yes i
Low
Not published

CVE-2021-43308: Regular expression denial of service in markdown-link-extractor. Affects markdown-link-extractor across 2 version ranges.

< 3.0.2 >= 4.0.0, < 4.0.1

Fixed in 3.0.2 or 4.0.1, depending on the release line you run. 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The markdown-link-extractor is an npm package used for extracting links from Markdown files. It provides a function that takes a Markdown string as input and returns an array of links found in the input. The package is commonly used in applications that need to parse Markdown files and extract links for further processing.

Vulnerability Detail

The markdown-link-extractor package is vulnerable to an exponential ReDoS (Regular Expression Denial of Service) attack. This vulnerability can be exploited when an attacker is able to supply arbitrary input to the module's exported function. By crafting a malicious input string that triggers a slow-running regular expression, an attacker can cause the function to consume excessive amounts of CPU time and potentially lead to a denial of service condition. The impact of this vulnerability is mainly on the availability of the application using the markdown-link-extractor package.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 3.0.2 3.0.2
    npm install markdown-link-extractor@3.0.2
  • >= 4.0.0, < 4.0.1 4.0.1
    npm install markdown-link-extractor@4.0.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If updating the package is not immediately feasible, a possible workaround is to implement input validation and sanitization before passing the input to the markdown-link-extractor function. By carefully validating and limiting the input, the risk of triggering the vulnerable regular expression can be reduced. Here is an example of how input validation can be implemented in JavaScript:

const markdownLinkExtractor = require('markdown-link-extractor');

function extractLinksSafely(markdown) {
  if (typeof markdown !== 'string' || markdown.length > 10000) {
    throw new Error('Invalid input');
  }

  return markdownLinkExtractor(markdown);
}

Conclusion

The markdown-link-extractor package is vulnerable to a ReDoS attack, which can lead to a denial of service condition. It is recommended to update the package to the latest patched version (3.0.2 or later) to mitigate the vulnerability. If immediate update is not possible, implementing input validation and sanitization can provide a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for markdown-link-extractor →

Share this vulnerability

FAQ

markdown-link-extractor is an npm package used for extracting links from Markdown files. It provides a function that takes a Markdown string as input and returns an array of links found in the input.

A ReDoS (Regular Expression Denial of Service) vulnerability occurs when a regular expression takes a long time to process certain inputs, leading to a denial of service condition. In this case, the markdown-link-extractor package is vulnerable to such an attack.

The impact of this vulnerability is mainly on the availability of the application using the markdown-link-extractor package. An attacker can exploit the vulnerability to cause the function to consume excessive amounts of CPU time, potentially leading to a denial of service condition.

To fix this vulnerability, update the markdown-link-extractor package to version 3.0.2 or later. Make sure to update your application's dependencies to use the patched version of the package.

If updating the package is not immediately feasible, you can implement input validation and sanitization before passing the input to the markdown-link-extractor function. By carefully validating and limiting the input, the risk of triggering the vulnerable regular expression can be reduced.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 3.0.2 3.0.2
    npm install markdown-link-extractor@3.0.2
  • >= 4.0.0, < 4.0.1 4.0.1
    npm install markdown-link-extractor@4.0.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. 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