{"id":"CVE-2025-65108","aliases":["CVE-2025-65108","GHSA-547r-qmjm-8hvw"],"related":[],"kind":"vulnerability","state":"published","title":"md-to-pdf is vulnerable to arbitrary JavaScript code execution when parsing front matter","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Summary\nA 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.\n\n### Details\n**md-to-pdf** uses the gray-matter library to parse front-matter. Gray-matter exposes a JavaScript engine that, when enabled or triggered by certain front-matter delimiters (e.g. ---js or ---javascript), will evaluate the front-matter contents as JavaScript. If user-supplied Markdown is fed to md-to-pdf and the front-matter contains malicious JS, the converter process will execute that code.\n\n\n### PoC\n```\nconst { mdToPdf } = require('md-to-pdf');\n\nvar payload = '---javascript\\n((require(\"child_process\")).execSync(\"calc.exe\"))\\n---RCE';\n\n(async () => {\n\tawait mdToPdf({ content: payload }, { dest: './output.pdf'});\n})();\n```\nRunning the PoC on Windows launches the calculator application, demonstrating arbitrary code execution.\n\n### Impact\n\n- Remote code execution in the process that performs Markdown->PDF conversion.\n- If the converter is run in a web app or cloud service, an attacker uploading malicious Markdown can execute arbitrary commands on the","format":"markdown","source":"ghsa"},{"lang":"es","text":"md-to-pdf es una herramienta CLI para convertir archivos Markdown a PDF usando Node.js y Chrome sin interfaz gráfica. Versiones anteriores a la versión 5.2.5, un bloque de metadatos (front-matter) de Markdown que contiene un delimitador de JavaScript provoca que el motor JS en la biblioteca gray-matter ejecute código arbitrario en el proceso del conversor de Markdown a PDF de la biblioteca md-to-pdf, resultando en ejecución remota de código. Este problema ha sido parcheado en la versión 5.2.5.","source":"nvd"}],"published":"2025-11-20T17:48:11.000Z","modified":"2026-10-18T20:10:00.110Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"version":"< 5.2.5","status":"affected"}],"vendor":"simonhaenisch","product":"md-to-pdf","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.2.5"}],"ecosystem":"npm","package":"md-to-pdf","purl":"pkg:npm/md-to-pdf","source":"ghsa"}],"references":[{"url":"https://github.com/simonhaenisch/md-to-pdf/security/advisories/GHSA-547r-qmjm-8hvw","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/simonhaenisch/md-to-pdf/commit/46bdcf2051c8d1758b391c1353185a179a47a4d9","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-65108","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/simonhaenisch/md-to-pdf","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2025-11-24T17:17:00.852Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-65108","url":"https://www.cve.org/CVERecord?id=CVE-2025-65108","licence":"CVE Terms of Use","modified":"2025-11-24T17:17:08.879Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-547r-qmjm-8hvw","url":"https://github.com/advisories/GHSA-547r-qmjm-8hvw","licence":"CC-BY-4.0","modified":"2025-11-25T19:48:40.000Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-65108","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-65108","licence":"Public domain","modified":"2026-10-18T20:10:00.110Z"}],"updatedAt":"2026-11-25T22:59:07.931Z","epss":{"score":0.0096,"percentile":0.62536,"date":"2026-12-01T12:00:22.000Z"}}