CVE-2026-78847

Arbitrary code execution via eval() in front matter parsing

Published Sep 21, 2026 CVSS 3.1 · 9.8 Critical EPSS < 1% KEV · Not listed
Description
An issue in gray-matter All versions (verified on 4.0.3) allows the JavaScript engine in lib/engines.js using eval() to parse front matter when language is js/javascript.This allows arbitrary code execution.

Analysis

AI-generated

Technical impact

The vulnerability originates in the gray‑matter library, where the JavaScript engine in lib/engines.js calls eval() on front matter marked with the language js or javascript. An attacker can embed arbitrary JavaScript code into the front matter block, and when the file is parsed that code is executed with the same privileges as the application. This flaw permits full compromise of confidentiality, integrity and availability by allowing arbitrary code execution.

Affected Systems

The gray‑matter npm package, maintained by Jonas Schlinkert, is widely used in static site generators and markdown processors. All released versions of the package, including 4.0.3, are affected. Any system that imports or processes content with gray‑matter without prior validation is at risk.

Risk and Exploitability

The CVSS score of 9.8 marks this vulnerability as critical. The EPSS score of <1% indicates a low but non‑zero probability of exploitation. The vulnerability does not require authentication; the attacker can simply provide a crafted file. It is inferred that uploading or ingesting a file containing malicious front matter would trigger the flaw. The vulnerability is not listed in the CISA KEV catalog.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade gray‑matter to the latest version that removes the vulnerable eval() call.
  • If upgrading is not immediately feasible, configure the application to reject or ignore front matter blocks whose language is js or javascript, or replace the parser with a safer alternative.
  • Sanitize or validate all input content before it reaches gray‑matter, ensuring only trusted data is processed.

Generated by OpenCVE AI on September 22, 2026 at 20:26 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Title Arbitrary code execution via eval() in front matter parsing
Type Values Removed Values Added
Title gray-matter JavaScript Front Matter Evaluates User Input, Enabling Arbitrary Code Execution
Weaknesses CWE-94
Type Values Removed Values Added
Weaknesses CWE-95
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

Type Values Removed Values Added
Title gray-matter JavaScript Front Matter Evaluates User Input, Enabling Arbitrary Code Execution
Weaknesses CWE-94
Type Values Removed Values Added
Description An issue in gray-matter All versions (verified on 4.0.3) allows the JavaScript engine in lib/engines.js using eval() to parse front matter when language is js/javascript.This allows arbitrary code execution.
References

Subscriptions

No data.

Weaknesses
  • CWE-95

    Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')

Sources

Status
PUBLISHED
Assigner
mitre
Published
Updated
Sep 22, 2026, 3:12 PM
Reserved
Aug 25, 2026, 12:00 AM
Status
Deferred
Published
Sep 21, 2026, 10:16 PM
Modified
Sep 22, 2026, 8:00 PM