CVE-2026-129948: Contentlayer @contentlayer/source-files through 0.3.4 Code Injection via JavaScript Frontmatter
Contentlayer @contentlayer/source-files through 0.3.4 contains a code injection vulnerability that allows attackers who control content files to execute JavaScript by abusing gray-matter's still-enabled JavaScript engine in parseMarkdown(). Attackers can start a Markdown or MDX file with a ---js or ---javascript frontmatter delimiter to run code during build, exposing CI build secrets.
Affected Software
Event History
Frequently Asked Questions
Who is realistically exposed to this issue?
Projects using npm/@contentlayer/source-files through 0.3.4 are exposed when an attacker can control Markdown or MDX content files processed by Contentlayer. The code executes during the build, so CI environments are particularly sensitive because build secrets may be exposed.
What must an attacker do to trigger code execution?
The attacker needs the ability to introduce or modify a content file that Contentlayer parses. They can place a ---js or ---javascript frontmatter delimiter at the beginning of a Markdown or MDX file, causing JavaScript to run through gray-matter's enabled JavaScript engine in parseMarkdown().
When does the malicious code run?
The supplied data indicates that execution occurs during the Contentlayer build process. This means review and protection of content-file changes is important for build pipelines that process untrusted or contributor-controlled content.