---
id: "CVE-2026-129947"
page: "https://infrastack.ai/live/CVE-2026-129947"
kind: "vulnerability"
aliases: ["CVE-2026-129947"]
title: "Contentlayer core: file names inject JavaScript into generated modules"
severity: "high"
cvss: 8.6
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["contentlayer", "next.js", "node", "package"]
not_affected_if: ["production-only", "trusted-content-authors"]
published_at: "2026-11-16T15:17:29+00:00"
first_seen_at: "2026-11-16T15:37:56+00:00"
updated_at: "2026-11-16T15:40:10+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129947", "first_seen_at": "2026-11-16T15:37:56+00:00"}]
exploit_sources: []
---

# Contentlayer core: file names inject JavaScript into generated modules

Link for people: https://infrastack.ai/live/CVE-2026-129947 (this .md is for agents)

Contentlayer's core package builds an import line from content file names without escaping single quotes. An attacker who can add a content file can break out of that import and run JavaScript when the dev server imports the generated module.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Find the installed version with `npm ls @contentlayer/core`
- Check whether the project runs `contentlayer dev` or a Next.js dev server that uses Contentlayer
- Check whether untrusted users can add files to the content directory

## Fix

- Move `@contentlayer/core` past `0.3.4`; the sources do not name the fixed version

## Timeline

- 2026-11-16T15:37:56+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-129947

## Documents

- [advisory] Third-party advisory: www.vulncheck.com https://www.vulncheck.com/advisories/contentlayer-contentlayer-core-through-0.3.4-code-injection-via-generated-index-mjs

## From the sources

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.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
