Skip to main content

Contentlayer CVE-2026-129947

| EUVDEUVD-2026-126424 HIGH
Code Injection (CWE-94)
2026-11-16 disclosure@vulncheck.com GHSA-gxcv-hr94-jjmj
8.6
CVSS 4.0 · Vendor: vulncheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Add content file with single-quote name
  2. Delivery
    Name breaks out of import specifier in makeDataExportFile()
  3. Exploit
    Generated index.mjs contains injected JavaScript
  4. Execution
    Developer runs contentlayer dev / Next.js dev server imports module
  5. Impact
    Arbitrary code executes on developer or build host

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Two concrete prerequisites must both hold. First, the attacker must be able to create or control the NAME of a content file in the project's content source - e.g., via an accepted pull request, a user-content submission pipeline, or write access to the content directory - placing a filename containing a single quote that breaks out of the import specifier in makeDataExportFile(). Second, a victim must build the project: specifically, someone must run contentlayer dev or start a Next.js dev server that imports the generated index.mjs module (this is the UI:P/user-interaction requirement). Limiting factors that reduce realistic risk: the PR:L requirement means projects that never ingest externally-supplied or untrusted content file names are not exposed; execution is confined to the development/build environment and toolchain rather than the deployed production site's runtime; and it requires the developer-side build action to actually occur. Affected scope is @contentlayer/core through 0.3.4.

Impact

The input CVSS 4.0 score of 8.6 (High) reflects full compromise of the vulnerable system (VC:H/VI:H/VA:H) via a network vector with low complexity, but the real-world risk is strongly conditioned by two metrics the raw number obscures: PR:L (the attacker must be able to introduce or name a content file) and UI:P (a developer or build process must run contentlayer dev or a Next.js dev server that imports the generated module). The vuln.today decision label is 'this_week' rather than act_now/emergency. No EPSS score, no CISA KEV listing, and no confirmed working exploit code are present in the input - so there is no signal of automated or widespread exploitation; the realistic threat model is targeted abuse against projects that ingest untrusted or externally-contributed content (e.g., accepting pull requests or user-submitted markdown). This is a genuine code-execution flaw worth prioritizing for teams using the affected library, but it is not a remotely-sprayable, pre-auth internet-facing issue: execution is bounded to the development/build toolchain, not the deployed production site at runtime. Note the AV:N classification is arguable - the trigger requires a malicious file to be present in the content source and a developer action to build it, which has a supply-chain/local character; verify the delivery assumption against your own content-ingestion workflow.

Exploit ScenarioDerived

An attacker who can contribute content to a project - for example by opening a pull request or submitting user content - adds a content file whose name contains a single quote crafted to break out of the import specifier generated by makeDataExportFile(). When a developer or CI runs contentlayer dev or starts the Next.js dev server, the generated index.mjs module is imported and the attacker's injected JavaScript executes on the developer or build host. The input references a VulnCheck advisory and GitHub issue #688 describing the mechanism, but no confirmed working exploit code is identified in the provided data.

Monitor Track and reassess. Why: Vendor states no customer action required.
No patch listed yet 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 16, 2026

Code injection in @contentlayer/core through 0.3.4 lets an attacker who can control the name of a content file embed a single quote that breaks out of the import specifier built by makeDataExportFile(), so injected JavaScript runs when contentlayer dev or a Next.js dev server imports the generated index.mjs. Two prerequisites must both hold: the attacker must be able to create or name a content file in the project's content source (via an accepted pull request, a user-content submission pipeline, or write access to the content directory), and a victim must then build, i.e. run contentlayer dev or start a Next.js dev server that imports the generated module (the UI:P requirement). Exploitation is confined to the development/build toolchain rather than the deployed production site's runtime, and no public exploit code is identified at time of analysis (the referenced GitHub issue is a bug report, not verified working exploit code); the CVSS 4.0 score of 8.6 reflects full compromise of the vulnerable system, but PR:L and UI:P substantially condition real-world exposure.

RemediationAI

No vendor-released fixed version is identified in the available data for @contentlayer/core through 0.3.4, so until an upstream patched release is available the primary mitigation is to prevent attacker-controlled filenames from reaching the code generator: reject or sanitize content file names containing single quotes (and other characters unsafe in import specifiers) in any submission or PR review pipeline, and restrict write access to the content directory to trusted contributors. Because the injection fires when the generated index.mjs is imported, avoid running contentlayer dev or a Next.js dev server against content branches or submissions that have not been reviewed; the trade-off is reduced developer convenience for untrusted-content workflows. Track https://github.com/contentlayerdev/contentlayer/issues/688 and https://www.vulncheck.com/advisories/contentlayer-contentlayer-core-through-0.3.4-code-injection-via-generated-index-mjs for a patched release and upgrade immediately when one is published; pinning content dependencies to reviewed sources limits exposure in the interim.

Affected VersionsENISA

@contentlayer/core 0 ≤0.3.4

Affected Packages

euvd contentlayer_core no fix

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Contentlayer is a content SDK for JavaScript/TypeScript projects (commonly paired with Next.js) that transforms Markdown/MDX content files into typed JSON data plus generated modules. The flaw is CWE-94 (improper control of generation of code), specifically an injection into generated source: makeDataExportFile() in packages/@contentlayer/core/src/generation/generate-dotpkg.ts (lines 377-379 and 511 in the v0.3.4 source referenced by NVD) constructs import specifiers from content file names without escaping single quotes. A filename containing a quote terminates the string literal in the generated index.mjs, so attacker-supplied text becomes executable module-level JavaScript. Because the injected code is part of the generated package that contentlayer dev and the Next.js dev server load, execution occurs in the developer/build environment and toolchain rather than in the deployed production runtime. The assessed vector is CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H: network reachable, low complexity, but requiring the attacker to be able to introduce or name a content file and a victim to perform the build action.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (vulncheck) PRIMARY 8.6 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
vuln.today AI 8.0 HIGH

Attacker needs the ability to add/name a content file (PR:L) and a developer must run the build to import the module (UI:R); injected JS yields full code execution on the host (C/I/A:H), scope unchanged.

3.1 AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (vulncheck).

CVSS VectorVendor: vulncheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
Low
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

Contentlayer @contentlayer/core through 0.3.4 contains a code injection vulnerability that allows attackers to inject JavaScript by embedding single quotes in content file names. Attackers can add a content file whose name breaks out of the import specifier in makeDataExportFile(), executing injected code when contentlayer dev or a Next.js dev server imports the generated module.

Executive ViewAI

Why It Matters

CVE-2026-129947 is a high-severity code injection vulnerability in @contentlayer/core, a development dependency used to generate content imports for Next.js sites. If an attacker can influence the name of a content file, they can execute arbitrary JavaScript on a developer's machine when the dev server runs. This puts development environments and CI/CD pipelines at risk, potentially leading to source code theft or supply chain compromise, but does not directly affect production website visitors.

Business Impact: Medium
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: restrict write access to content directories, validate and sanitize content file names (reject single quotes and special characters), enforce pull request reviews for content changes, run development servers in isolated environments with least privilege, and consider replacing @contentlayer/core with a maintained alternative.

Threat Intelligence Overview

EPSS Score
0.3%
Top 81% exploitable
Prevalence
Low
niche, now-unmaintained Next.js content SDK used as a build-time dev dependency
Social Media
1
Sightings
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.3%
Patch available No
Active threat No
Deciding rule
Vendor states no customer action required
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
Medium

Priority Score

43
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +43
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy