Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2025-65108: CWE-94: Improper Control of Generation of Code ('Code Injection') in simonhaenisch md-to-pdf

0
Critical
VulnerabilityCVE-2025-65108cvecve-2025-65108cwe-94
Published: Fri Nov 21 2025 (11/21/2025, 21:52:02 UTC)
Source: CVE Database V5
Vendor/Project: simonhaenisch
Product: md-to-pdf

Description

md-to-pdf is a CLI tool for converting Markdown files to PDF using Node.js and headless Chrome. Prior to version 5.2.5, a Markdown front-matter block that contains JavaScript delimiter causes the JS engine in gray-matter library to execute arbitrary code in the Markdown to PDF converter process of md-to-pdf library, resulting in remote code execution. This issue has been patched in version 5.2.5.

AI-Powered Analysis

AILast updated: 11/21/2025, 22:08:54 UTC

Technical Analysis

The vulnerability identified as CVE-2025-65108 affects the md-to-pdf CLI tool, which converts Markdown files to PDF using Node.js and headless Chrome. The root cause is an improper control of code generation (CWE-94) within the gray-matter library that md-to-pdf relies on to parse Markdown front-matter. Specifically, if a Markdown front-matter block contains JavaScript delimiters, the gray-matter library's JavaScript engine executes this code during the conversion process. This leads to remote code execution (RCE) within the context of the md-to-pdf process. The vulnerability is exploitable remotely without any authentication or user interaction, making it highly dangerous. The CVSS v3.1 score is 10.0, indicating critical severity with network attack vector, low attack complexity, no privileges required, no user interaction, and complete impact on confidentiality, integrity, and availability. The issue was patched in md-to-pdf version 5.2.5, which disables or properly sanitizes the execution of JavaScript code in front-matter. No public exploits or active exploitation have been reported yet, but the severity and ease of exploitation make this a high-priority vulnerability for remediation.

Potential Impact

For European organizations, this vulnerability poses a severe risk, especially for those that utilize md-to-pdf in automated document processing pipelines or web services that convert user-submitted Markdown files to PDF. An attacker could craft malicious Markdown files containing JavaScript code in the front-matter, leading to arbitrary code execution on the server or endpoint running md-to-pdf. This can result in full system compromise, data theft, service disruption, or lateral movement within the network. Organizations in sectors such as publishing, software development, education, and any industry relying on automated document generation are particularly vulnerable. The critical nature of the flaw means that even a single vulnerable instance exposed to untrusted input could lead to significant breaches. Additionally, the vulnerability's exploitation could undermine trust in document integrity and confidentiality, impacting compliance with European data protection regulations like GDPR.

Mitigation Recommendations

The primary and most effective mitigation is to upgrade md-to-pdf to version 5.2.5 or later, where the vulnerability has been patched. Organizations should audit their environments to identify all instances of md-to-pdf and verify the version in use. For environments where immediate upgrade is not feasible, implement strict input validation and sanitization on all Markdown files before processing, specifically filtering out or escaping JavaScript delimiters in front-matter blocks. Employ network segmentation and least privilege principles to limit the impact of potential exploitation. Additionally, monitor logs for unusual activity related to md-to-pdf processes and consider deploying runtime application self-protection (RASP) or endpoint detection and response (EDR) tools to detect anomalous behavior. Finally, educate developers and system administrators about the risks of processing untrusted Markdown content and enforce secure coding and deployment practices.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2025-11-17T20:55:34.694Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 6920e16727835fd566e0595a

Added to database: 11/21/2025, 10:02:15 PM

Last enriched: 11/21/2025, 10:08:54 PM

Last updated: 11/22/2025, 1:32:50 AM

Views: 14

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats