CVE-2026-129947
8.0HighPublished 16 Nov 2026 · NVD status: Received · AI triage by gemini-3.1-flash-lite
High
0CVSS v3.110
- Attack vector
- Network
- Complexity
- Low
- Privileges
- Low
- User action
- Required
- Impact
- Full C/I/A compromise
- Weakness
- CWE-94
What an attacker gets
Authenticated attackers can execute arbitrary JavaScript by crafting malicious content file names. This requires a user or build process to trigger the contentlayer dev or Next.js development server.
Root cause
The makeDataExportFile function fails to sanitize single quotes in file names, allowing them to break out of the generated import specifier.
Affected versions
@contentlayer/core through 0.3.4
CVSS v3.1 · CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
Fix & remediation
Upgrade to a version beyond 0.3.4 if available or sanitize all content file names to exclude single quotes. If no patch is available, restrict access to the file system where content files are managed.
$ npm list @contentlayer/coreAI-suggested. Run it in staging first and check it against the vendor advisory. Why?
NVD description
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.
References
- https://github.com/contentlayerdev/contentlayer/blob/v0.3.4/packages/@contentlayer/core/src/generation/generate-dotpkg.ts#L377-L379
- https://github.com/contentlayerdev/contentlayer/blob/v0.3.4/packages/@contentlayer/core/src/generation/generate-dotpkg.ts#L511
- https://github.com/contentlayerdev/contentlayer/issues/688
- https://www.vulncheck.com/advisories/contentlayer-contentlayer-core-through-0.3.4-code-injection-via-generated-index-mjs