{"id":"CVE-2026-129948","kind":"vulnerability","aliases":["CVE-2026-129948"],"related":[],"title":"Contentlayer: crafted content files run JavaScript during builds","description":"Contentlayer @contentlayer/source-files through 0.3.4 contains a code injection vulnerability that allows attackers who control content files to execute JavaScript by abusing gray-matter's still-enabled JavaScript engine in parseMarkdown(). Attackers can start a Markdown or MDX file with a ---js or ---javascript frontmatter delimiter to run code during build, exposing CI build secrets.","summary":"The @contentlayer/source-files npm package passes Markdown and MDX frontmatter to gray-matter, whose JavaScript engine is still enabled, so a ---js or ---javascript block in a content file runs as code. An attacker who can place or edit content files can run code during the build and read CI build secrets.","severity":"high","cvss":8.8,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"@contentlayer/source-files","fixed":[],"affected":"<= 0.3.4","ecosystem":"npm"}],"ecosystems":[],"tags":["build-time-rce","ci","contentlayer","gray-matter","mdx","next.js","npm","package"],"not_affected_if":["content-written-by-trusted-team-only","no-ci-secrets-on-build"],"how_to_check":"- Run `npm ls @contentlayer/source-files gray-matter` (or check the lockfile). Affected: @contentlayer/source-files <= 0.3.4.\n- Confirm whether content files (.md/.mdx) can come from outside contributors, PRs from forks, or external sources and whether the build has CI secrets.\n- Search content for files starting with `---js` or `---javascript`.","fix":"No patched version of @contentlayer/source-files as of 2026-11-16; last affected is 0.3.4 and the maintainers have not responded on issue #688. gray-matter 4.0.3 also has no upstream fix. Workaround: build only trusted content, keep secrets out of the build environment, or patch gray-matter so engines.javascript throws (as other projects do).","status":"open","published_at":"2026-11-16T15:17:29+00:00","first_seen_at":"2026-11-16T15:37:57+00:00","triaged_at":"2026-11-16T15:39:58+00:00","updated_at":"2026-11-16T15:42:30+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-11-16T15:39:58Z","model":"claude-haiku-5-5","output":{"fix":"unknown","reach":"unknown","title":"Contentlayer: crafted content files run JavaScript during builds","impact":"high","summary":"The @contentlayer/source-files npm package passes Markdown and MDX frontmatter to gray-matter, whose JavaScript engine is still enabled, so a ---js or ---javascript block in a content file runs as code. An attacker who can place or edit content files can run code during the build and read CI build secrets.","audience":"developers","category":"package","nicknames":[],"who_cares":["contentlayer","next.js","ci","mdx"],"confidence":0.6,"fix_status":"unknown","needs_auth":"no","worst_case":"Code runs during build and CI build secrets are exposed","analyst_note":"Find the fixed version or patch for @contentlayer/source-files and whether gray-matter's JS engine was disabled upstream; check the VulnCheck advisory linked from NVD.","how_to_check":"- Check the installed version with `npm ls @contentlayer/source-files`.\n- Look for the package in `package.json` and the lockfile of any project that builds Contentlayer content.\n- Confirm whether content files can come from untrusted contributors or external sources.","plain_action":"","product_name":"","needs_analyst":true,"not_affected_if":["content-written-by-trusted-team-only","no-ci-secrets-on-build"],"who_is_affected":"Projects that use @contentlayer/source-files to build content from Markdown or MDX files are exposed, most so when those files can come from outside contributors or untrusted sources. The build machine must hold CI secrets to matter much. Sites that only build from content their own team writes and that hold no secrets on the build machine have less at stake. The sources do not give a patched version.","user_interaction":"no","product_ecosystem":"","needs_special_setup":"no","severity_if_unknown":"high"},"cost_usd":0.000772,"input_tokens":4615,"output_tokens":622,"severity_before":"high"},"analyst_status":"done","analyst_note":"Find the fixed version or patch for @contentlayer/source-files and whether gray-matter's JS engine was disabled upstream; check the VulnCheck advisory linked from NVD.","search":"'-129948':11A,14A '-2026':10A,13A '0.3.4':84C 'abus':101C 'allow':91C 'attack':62B,92C,113C 'block':53B 'build':8A,17B,75B,79B,132C,135C 'build-time-rc':16B 'ci':20B,78B,134C 'code':60B,72B,87C,130C 'contain':85C 'content':3A,56B,68B,95C 'contentlay':1A,21B,81C 'contentlayer/source-files':15A,30B,82C 'control':94C 'craft':2A 'cve':9A,12A 'delimit':127C 'edit':67B 'enabl':47B,108C 'engin':44B,110C 'execut':98C 'expos':133C 'file':4A,57B,69B,96C,120C 'frontmatt':37B,126C 'gray':23B,40B,103C 'gray-matt':22B,39B,102C 'inject':88C 'javascript':6A,43B,52B,99C,109C,125C 'js':50B,123C 'markdown':34B,117C 'matter':24B,41B,104C 'mdx':25B,36B,119C 'next.js':26B 'npm':27B,31B 'packag':28B,32B 'parsemarkdown':112C 'pass':33B 'place':65B 'rce':19B 'read':77B 'run':5A,58B,71B,129C 'secret':80B,136C 'start':115C 'still':46B,107C 'still-en':106C 'time':18B 'vulner':89C 'whose':42B","nicknames":[],"mitigations":[],"who_affected":"Projects that build Markdown or MDX with @contentlayer/source-files 0.3.4 or earlier (commonly Next.js sites) are exposed when content files can come from people you do not trust, such as fork PRs or external content sources. The code runs on the build machine, so CI secrets are what is at stake. Sites whose content is written only by the team, or builds with no secrets, can mostly skip it. No fix exists yet.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"none","audience":"developers","plain_action":null,"pkeys":["sourcefiles"],"ptokens":["contentlayer","files","source"],"labels":["buildtimerce","ci","contentlayer","graymatter","high","mdx","nextjs","npm","package"],"campaign_type":null,"search_a":"'-129948':11A,14A '-2026':10A,13A 'build':8A 'content':3A 'contentlay':1A 'contentlayer/source-files':15A 'craft':2A 'cve':9A,12A 'file':4A 'javascript':6A 'run':5A","search_b":"'attack':62B 'block':53B 'build':17B,75B,79B 'build-time-rc':16B 'ci':20B,78B 'code':60B,72B 'content':56B,68B 'contentlay':21B 'contentlayer/source-files':30B 'edit':67B 'enabl':47B 'engin':44B 'file':57B,69B 'frontmatt':37B 'gray':23B,40B 'gray-matt':22B,39B 'javascript':43B,52B 'js':50B 'markdown':34B 'matter':24B,41B 'mdx':25B,36B 'next.js':26B 'npm':27B,31B 'packag':28B,32B 'pass':33B 'place':65B 'rce':19B 'read':77B 'run':58B,71B 'secret':80B 'still':46B 'time':18B 'whose':42B","search_c":"'0.3.4':84C 'abus':101C 'allow':91C 'attack':92C,113C 'build':132C,135C 'ci':134C 'code':87C,130C 'contain':85C 'content':95C 'contentlay':81C 'contentlayer/source-files':82C 'control':94C 'delimit':127C 'enabl':108C 'engin':110C 'execut':98C 'expos':133C 'file':96C,120C 'frontmatt':126C 'gray':103C 'gray-matt':102C 'inject':88C 'javascript':99C,109C,125C 'js':123C 'markdown':117C 'matter':104C 'mdx':119C 'parsemarkdown':112C 'run':129C 'secret':136C 'start':115C 'still':107C 'still-en':106C 'vulner':89C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-11-16T15:17:29+00:00","kev":null,"cvss_vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","cvss_by":"disclosure@vulncheck.com","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-129948","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-129948","severity":null,"published_at":"2026-11-16T15:17:29+00:00","modified_at":"2026-11-16T15:17:29+00:00","first_seen_at":"2026-11-16T15:37:57+00:00","fetched_at":"2026-11-16T15:37:57+00:00","note":null},{"source":"analyst","external_id":"CVE-2026-129948:4133","url":"https://github.com/contentlayerdev/contentlayer/issues/688","severity":null,"published_at":"2026-11-16T15:42:30+00:00","modified_at":"2026-11-16T15:42:30+00:00","first_seen_at":"2026-11-16T15:42:30+00:00","fetched_at":"2026-11-16T15:42:30+00:00","note":"VulnCheck advisory + reporter's issue contentlayer#688 (open, no maintainer reply, no fix as of 2026-11-16). gray-matter 4.0.3 JS engine still enabled upstream (CVE-2026-78847, gray-matter#182 open). No PoC link, no exploitation seen. Nothing marked verified: no vendor/maintainer page.","cites":["https://github.com/contentlayerdev/contentlayer/issues/688","https://github.com/advisories/GHSA-j9gx-vjm3-jpmm","https://github.com/jonschlinkert/gray-matter/issues/182"]}],"documents":[{"id":170631,"url":"https://www.vulncheck.com/advisories/contentlayer-contentlayer-source-files-through-0.3.4-code-injection-via-javascript-frontmatter","title":"Third-party advisory: www.vulncheck.com","kind":"advisory","source":"nvd","publisher":"research","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Third-party advisory: www.vulncheck.com"},{"id":170698,"url":"https://github.com/contentlayerdev/contentlayer/issues/688","title":"Contentlayer #688 Security review: frontmatter evaluation","kind":"issue","source":"analyst","publisher":null,"text":null,"published_at":null,"relation":"describes","confidence":null,"note":null},{"id":170699,"url":"https://github.com/advisories/GHSA-j9gx-vjm3-jpmm","title":"gray-matter eval of js frontmatter (CVE-2026-78847)","kind":"advisory","source":"analyst","publisher":null,"text":null,"published_at":null,"relation":"mentions","confidence":null,"note":null},{"id":170700,"url":"https://github.com/jonschlinkert/gray-matter/issues/182","title":"gray-matter #182 Remove RCE-vulnerable JavaScript engine (open)","kind":"issue","source":"analyst","publisher":null,"text":null,"published_at":null,"relation":"mentions","confidence":null,"note":null}],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}