{"id":"GHSA-547r-qmjm-8hvw","revision":"dc39f722d8b54c2686557e8e3de14663","records":[{"revision":"dc39f722d8b54c2686557e8e3de14663","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-547r-qmjm-8hvw","aliases":["CVE-2025-65108"],"title":"md-to-pdf vulnerable to arbitrary JavaScript code execution when parsing front matter","description":"### 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","state":0,"publishedAt":"2025-11-20T17:48:11+00:00","modifiedAt":"2025-11-25T19:48:40+00:00","affected":[{"ecosystem":"npm","name":"md-to-pdf","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"5.2.5"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"CRITICAL"}],"references":["https://github.com/simonhaenisch/md-to-pdf/security/advisories/GHSA-547r-qmjm-8hvw","https://nvd.nist.gov/vuln/detail/CVE-2025-65108","https://github.com/simonhaenisch/md-to-pdf/commit/46bdcf2051c8d1758b391c1353185a179a47a4d9","https://github.com/simonhaenisch/md-to-pdf"],"sourceUrl":"https://github.com/advisories/GHSA-547r-qmjm-8hvw","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-547r-qmjm-8hvw","identifiers":["GHSA-547r-qmjm-8hvw","CVE-2025-65108"]},"retained":false,"historicalAffected":[]}],"coverage":[]}