CVE-2025-65108: CWE-94: Improper Control of Generation of Code ('Code Injection') in simonhaenisch md-to-pdf
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 Analysis
Technical Summary
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 improper control of code generation (CWE-94) within the gray-matter library, which md-to-pdf relies on to parse Markdown front-matter. Specifically, if the front-matter contains JavaScript delimiters, the JavaScript engine executes this code during the Markdown-to-PDF conversion process. This leads to remote code execution (RCE) without requiring authentication or user interaction, allowing attackers to run arbitrary code on the host system with the privileges of the md-to-pdf process. The vulnerability affects all versions prior to 5.2.5 and has been patched in that release. The CVSS 3.1 base 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. Although no known exploits are reported in the wild yet, the ease of exploitation and severity make this a high-risk vulnerability. Organizations using md-to-pdf in automated workflows or exposed environments are particularly vulnerable, especially if they process Markdown files from untrusted or external sources.
Potential Impact
For European organizations, the impact of this vulnerability is significant. Exploitation could lead to full system compromise, data theft, unauthorized modification of documents, or disruption of PDF generation services. This is especially critical for sectors relying heavily on automated documentation, publishing, or software development pipelines that incorporate md-to-pdf. Confidential information embedded in Markdown files or generated PDFs could be exposed or altered. The availability of systems could be disrupted by attackers executing destructive payloads. Given the critical severity and ease of exploitation, organizations face risks of operational downtime, reputational damage, and potential regulatory penalties under GDPR if personal data is compromised. The vulnerability's network accessibility and lack of authentication requirements increase the attack surface, making it a prime target for attackers aiming to infiltrate European IT environments.
Mitigation Recommendations
Immediate upgrade to md-to-pdf version 5.2.5 or later is essential to remediate this vulnerability. Organizations should audit their environments to identify all instances of md-to-pdf and verify version compliance. Restrict Markdown input sources to trusted users and systems to reduce exposure to maliciously crafted files. Implement input validation and sanitization for Markdown front-matter to detect and block JavaScript delimiters or suspicious content. Employ runtime application self-protection (RASP) or endpoint detection and response (EDR) solutions to monitor for anomalous process behavior during PDF generation. Consider isolating md-to-pdf execution in sandboxed or containerized environments with minimal privileges to limit potential damage from exploitation. Regularly review and update dependencies like gray-matter to their latest secure versions. Finally, maintain robust incident response plans to quickly address any exploitation attempts.
Affected Countries
Germany, United Kingdom, France, Netherlands, Sweden, Italy
CVE-2025-65108: CWE-94: Improper Control of Generation of Code ('Code Injection') in simonhaenisch 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
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 improper control of code generation (CWE-94) within the gray-matter library, which md-to-pdf relies on to parse Markdown front-matter. Specifically, if the front-matter contains JavaScript delimiters, the JavaScript engine executes this code during the Markdown-to-PDF conversion process. This leads to remote code execution (RCE) without requiring authentication or user interaction, allowing attackers to run arbitrary code on the host system with the privileges of the md-to-pdf process. The vulnerability affects all versions prior to 5.2.5 and has been patched in that release. The CVSS 3.1 base 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. Although no known exploits are reported in the wild yet, the ease of exploitation and severity make this a high-risk vulnerability. Organizations using md-to-pdf in automated workflows or exposed environments are particularly vulnerable, especially if they process Markdown files from untrusted or external sources.
Potential Impact
For European organizations, the impact of this vulnerability is significant. Exploitation could lead to full system compromise, data theft, unauthorized modification of documents, or disruption of PDF generation services. This is especially critical for sectors relying heavily on automated documentation, publishing, or software development pipelines that incorporate md-to-pdf. Confidential information embedded in Markdown files or generated PDFs could be exposed or altered. The availability of systems could be disrupted by attackers executing destructive payloads. Given the critical severity and ease of exploitation, organizations face risks of operational downtime, reputational damage, and potential regulatory penalties under GDPR if personal data is compromised. The vulnerability's network accessibility and lack of authentication requirements increase the attack surface, making it a prime target for attackers aiming to infiltrate European IT environments.
Mitigation Recommendations
Immediate upgrade to md-to-pdf version 5.2.5 or later is essential to remediate this vulnerability. Organizations should audit their environments to identify all instances of md-to-pdf and verify version compliance. Restrict Markdown input sources to trusted users and systems to reduce exposure to maliciously crafted files. Implement input validation and sanitization for Markdown front-matter to detect and block JavaScript delimiters or suspicious content. Employ runtime application self-protection (RASP) or endpoint detection and response (EDR) solutions to monitor for anomalous process behavior during PDF generation. Consider isolating md-to-pdf execution in sandboxed or containerized environments with minimal privileges to limit potential damage from exploitation. Regularly review and update dependencies like gray-matter to their latest secure versions. Finally, maintain robust incident response plans to quickly address any exploitation attempts.
Affected Countries
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/28/2025, 10:49:39 PM
Last updated: 1/7/2026, 4:20:55 AM
Views: 198
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-20893: Origin validation error in Fujitsu Client Computing Limited Fujitsu Security Solution AuthConductor Client Basic V2
HighCVE-2025-14891: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in ivole Customer Reviews for WooCommerce
MediumCVE-2025-14059: CWE-73 External Control of File Name or Path in roxnor EmailKit – Email Customizer for WooCommerce & WP
MediumCVE-2025-12648: CWE-552 Files or Directories Accessible to External Parties in cbutlerjr WP-Members Membership Plugin
MediumCVE-2025-14631: CWE-476 NULL Pointer Dereference in TP-Link Systems Inc. Archer BE400
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.