CVE-2020-7682: Path Traversal in marked-tree

marked-tree Updated 02 Oct 2025

Summary

07/05/2021
No i
High
7.5

CVE-2020-7682: Path Traversal in marked-tree. Affects marked-tree versions < 0.8.1. 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

marked-tree is an npm package used for parsing and manipulating Markdown files. It provides a convenient way to read and process Markdown files in Node.js applications. However, versions up to and including 0.8.1 of marked-tree are vulnerable to a path traversal vulnerability. This vulnerability arises due to the lack of path sanitization in the fs.readFile function in index.js.

Vulnerability Detail

The path traversal vulnerability in marked-tree allows an attacker to access files outside of the intended directory. By providing a specially crafted path, an attacker can navigate to sensitive files on the host system. This could lead to unauthorized access, information disclosure, or even remote code execution depending on the context in which the vulnerable code is used. The vulnerability has a CVSS score of 7.5, indicating a high severity.

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 a temporary workaround, you can implement your own path sanitization logic before passing the path to the fs.readFile function. Ensure that the path only contains the necessary characters and restrict access to files outside of the intended directory. Here's an example of how you can sanitize the path:

const path = require('path');

function sanitizePath(filePath) {
  const basePath = '/path/to/markdown/files'; // Set the base path to the directory containing your Markdown files
  const resolvedPath = path.resolve(basePath, filePath);

  if (!resolvedPath.startsWith(basePath)) {
    throw new Error('Invalid file path');
  }

  return resolvedPath;
}

Before calling fs.readFile, pass the file path through the sanitizePath function to ensure it is safe.

Conclusion

The path traversal vulnerability in marked-tree can be mitigated by upgrading to a fixed version of the package or by implementing path sanitization logic. It is crucial to address this vulnerability promptly to prevent potential unauthorized access or information disclosure. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for marked-tree →

Share this vulnerability

FAQ

marked-tree is an npm package used for parsing and manipulating Markdown files in Node.js applications. It provides a convenient way to read and process Markdown files.

All versions up to and including 0.8.1 of marked-tree are affected by this vulnerability.

The path traversal vulnerability in marked-tree allows an attacker to access files outside of the intended directory. This could lead to unauthorized access, information disclosure, or remote code execution depending on the context.

To fix this vulnerability, upgrade to a version of marked-tree that is equal to or greater than 0.8.2.

Yes, you can implement your own path sanitization logic before passing the path to the fs.readFile function. Ensure that the path only contains the necessary characters and restrict access to files outside of the intended directory.

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