CVE-2023-0835: markdown-pdf - Local File Read via Server Side XSS

markdown-pdf Updated 02 Oct 2025

Summary

05/04/2023
No i
High
7.5

CVE-2023-0835: markdown-pdf vulnerable to local file read via server side cross-site scripting (XSS). Affects markdown-pdf versions < 11.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

markdown-pdf is an npm package that allows users to convert Markdown files to PDF format. It provides a convenient way to generate PDF documents from Markdown content. However, version 11.0.0 of markdown-pdf is vulnerable to a local file read attack through server-side cross-site scripting (XSS). This vulnerability arises due to the lack of input validation on user-entered Markdown content.

Vulnerability Detail

The vulnerability in markdown-pdf version 11.0.0 enables an external attacker to remotely access arbitrary local files. By exploiting the server-side XSS vulnerability, an attacker can inject malicious Markdown content that triggers the file read operation. This can lead to unauthorized access to sensitive files on the server, potentially exposing confidential information or facilitating further attacks.

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 sanitize the user-entered Markdown content to prevent any malicious scripts or file read operations. Implement a content validation mechanism that checks for potentially harmful input and rejects or sanitizes it before processing. Here's an example using the 'markdown-pdf' package in Node.js:

const markdownPdf = require('markdown-pdf');
const sanitizeHtml = require('sanitize-html');

const markdownContent = '...'; // User-entered Markdown content

const sanitizedContent = sanitizeHtml(markdownContent);

markdownPdf().from.string(sanitizedContent).to('output.pdf', () => {
  console.log('PDF generated successfully.');
});

In this example, the 'sanitize-html' package is used to sanitize the Markdown content before passing it to the 'markdown-pdf' package for conversion.

Conclusion

markdown-pdf version 11.0.0 is vulnerable to a local file read attack through server-side XSS. It is crucial to upgrade to a patched version (e.g., 11.0.1) or any higher version that addresses this vulnerability. Implementing input validation and content sanitization can serve as a temporary workaround. For further assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for markdown-pdf →

Share this vulnerability

FAQ

markdown-pdf is an npm package that converts Markdown files to PDF format. It simplifies the process of generating PDF documents from Markdown content.

The vulnerability arises due to the lack of input validation on user-entered Markdown content. This allows an attacker to inject malicious content that triggers a server-side XSS attack, leading to unauthorized file read operations.

The vulnerability can result in unauthorized access to sensitive files on the server. This can lead to exposure of confidential information or facilitate further attacks on the system.

To fix this vulnerability, update the 'markdown-pdf' package to a version that is not affected by this issue. The maintainers have released patched versions (e.g., 11.0.1) that address this vulnerability.

As a temporary workaround, you can sanitize the user-entered Markdown content to prevent any malicious scripts or file read operations. Implement a content validation mechanism that checks for potentially harmful input and rejects or sanitizes it before processing.

Related vulnerabilities

Recent vulnerabilities recorded for markdown-pdf.

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