CVE-2026-129948

Contentlayer @contentlayer/source-files through 0.3.4 Code Injection via JavaScript Frontmatter

Published Nov 16, 2026 CVSS 4.0 · 8.7 High EPSS n/a KEV · Not listed
Description
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.

Analysis

AI-generated

Technical impact

Contentlayer. The @contentlayer/source-files package parses Markdown files using gray‑matter’s parseMarkdown() function, which still executes JavaScript code embedded in frontmatter. When an attacker can place a file in the content source, they can prefix the file with a ---js or ---javascript delimiter to cause arbitrary JavaScript to run at build time. This code injection can read and exfiltrate build‑time secrets, leading to credential compromise. The weakness is a code injection flaw, identified by CWE‑95, which allows unsanitized frontmatter content to be executed.

Affected Systems

The vulnerability affects the contentlayerdev @contentlayer/source-files package version 0.3.4. All installations that use this package version in any project, including web applications and static site generators that rely on Contentlayer for content sourcing, are impacted.

Risk and Exploitability

The CVSS score of 8.7 indicates high severity. EPSS data is not available, so the current probability of exploitation cannot be quantified, but the flaw is critical for environments where the build process is trusted and internal developers can influence content. The vulnerability is not listed in the CISA KEV catalog. Based on the description, the likely attack vector is a controlled repository or CI pipeline where an attacker can add or modify content files; the attacker then triggers a build to execute the malicious code. No patching or mitigation measure is provided by the vendor in the advisory, so the security risk persists until a fix is applied.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the @contentlayer/source-files package to the latest available version that removes JavaScript engine execution in parseMarkdown()
  • If an upgrade is not immediately possible, configure Gray‑Matter to disable JavaScript parsing by setting the appropriate option before calling parseMarkdown()
  • Remove or sanitize any files that start with a ---js or ---javascript frontmatter delimiter from the content repository before the build process

Generated by OpenCVE AI on November 16, 2026 at 16:24 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Description 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.
Title Contentlayer @contentlayer/source-files through 0.3.4 Code Injection via JavaScript Frontmatter
Weaknesses CWE-95
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 8.7, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}

Subscriptions

No data.

Weaknesses
  • CWE-95

    Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Nov 16, 2026, 3:06 PM
Reserved
Nov 16, 2026, 2:43 PM
Status
Received
Published
Nov 16, 2026, 3:17 PM
Modified
Nov 16, 2026, 3:17 PM