Contentlayer @contentlayer/core through 0.3.4 Code Injection via Generated _index.mjs
- State
- Published
- Severity
- 8.6 High
- Published
- Nov 16, 2026
- Updated
- Nov 18, 2026
- Reserved
- Nov 16, 2026
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.
| Product | Versions |
|---|---|
| @contentlayer/core contentlayerdev | 0.3.4 and earlier Affected |
| CVSS | Score | How It's Reached | Source |
|---|---|---|---|
| 4.0 | 8.6 High | VulnCheck | |
| 3.1 | 8.0 High | VulnCheck |
Weaknesses
- CWE-94 Improper Control of Generation of Code ('Code Injection')
References
- https://github.com/contentlayerdev/contentlayer/issues/688Issue Tracker
- https://github.com/contentlayerdev/contentlayer/blob/v0.3.4/packages/@contentlayer/core/src/generation/generate-dotpkg.ts#L377-L379Technical Details
- https://github.com/contentlayerdev/contentlayer/blob/v0.3.4/packages/@contentlayer/core/src/generation/generate-dotpkg.ts#L511Technical Details
- VulnCheck Advisory: Contentlayer @contentlayer/core through 0.3.4 Code Injection via Generated _index.mjsThird-Party Advisory
Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.