CVE-2025-65108
Published: 21 November 2025
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…
more
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.
Mitigating Controls (NIST 800-53 r5)AI
Remediating the code injection flaw in md-to-pdf by patching to version 5.2.5 or later directly prevents arbitrary JavaScript execution from malicious Markdown front-matter.
Validating Markdown inputs to reject or sanitize JavaScript delimiters in front-matter blocks addresses the CWE-94 code injection vulnerability in the gray-matter library.
Enforcing policies to prohibit or approve user installation of vulnerable md-to-pdf versions prevents deployment and use of the affected CLI tool.
Security SummaryAI
CVE-2025-65108 is a remote code execution vulnerability in the md-to-pdf CLI tool, which converts Markdown files to PDF using Node.js and headless Chrome. The issue affects versions prior to 5.2.5 and stems from the gray-matter library's JavaScript engine executing arbitrary code when processing a Markdown front-matter block containing a JavaScript delimiter. This flaw, classified under CWE-94 (code injection), carries a maximum CVSS v3.1 score of 10.0 (AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H), indicating critical severity with network accessibility, low attack complexity, no privileges or user interaction required, and high impact across confidentiality, integrity, and availability with scope change.
Attackers can exploit this vulnerability by supplying a malicious Markdown file to a victim using the affected md-to-pdf versions. No authentication or privileges are needed, and exploitation requires only that the tool process the file, leading to arbitrary code execution within the converter process. This enables full system compromise on the host running md-to-pdf, such as data theft, persistence, or further lateral movement.
The vulnerability has been patched in md-to-pdf version 5.2.5. The GitHub security advisory (GHSA-547r-qmjm-8hvw) and the patching commit (46bdcf2051c8d1758b391c1353185a179a47a4d9) detail the fix, recommending immediate upgrades for all users of the tool.
Details
- CWE(s)
MITRE ATT&CK Enterprise TechniquesAI
Why these techniques?
The vulnerability allows remote code execution (T1203) in the md-to-pdf client tool via crafted Markdown front-matter that triggers arbitrary JavaScript execution in the gray-matter library (T1059.007).