Technical impact
Contentlayer @contentlayer/core through version 0.3.4 contains a code injection flaw that can be triggered by embedding single quotes in the names of content files. The injection alters the generated import specifier in the makeDataExportFile() routine, allowing an attacker to inject arbitrary JavaScript that is executed when contentlayer dev or a Next.js dev server imports the resulting module.
Affected Systems
Vulnerable installations are those running contentlayerdev:@contentlayer/core versions up to and including 0.3.4. Any environment that imports the generated _index.mjs file – such as a local developer workstation, a developer server, or a build pipeline executing Next.js dev server code – is potentially impacted.
Risk and Exploitability
The CVSS score of 8.6 reflects a high severity due to the potential for arbitrary code execution. EPSS is not available, so the exact current exploitation probability is unknown, and the vulnerability is not listed in the CISA KEV catalog. Attackers can exploit the flaw by adding a maliciously named content file to the repository; the exploit succeeds only when the contentlayer dev or Next.js dev server loads the generated module, so risk to production systems is limited unless the same environment is used for builds or runtime. Nonetheless, a compromised developer or build environment could lead to severe compromise.