Build-server code execution via JavaScript frontmatter parsing
Published Jan 13, 2023 · Updated Mar 11, 2025
Code injection in Gatsby gatsby-transformer-remark before 5.25.1 and 6.0.0 through 6.3.1 allows attackers to execute JavaScript during builds. In data mode, the MarkdownRemark transformer passes JavaScript-tagged frontmatter to gray-matter with its JavaScript engine enabled, so parsing evaluates the embedded code. Exploitation requires untrusted or unsanitized content to enter a Markdown file processed during a build, and the code runs with the build server's privileges.
Summary
What happened
Code injection in Gatsby gatsby-transformer-remark before 5.25.1 and 6.0.0 through 6.3.1 allows attackers to execute JavaScript during builds. In data mode, the MarkdownRemark transformer passes JavaScript-tagged frontmatter to gray-matter with its JavaScript engine enabled, so parsing evaluates the embedded code. Exploitation requires untrusted or unsanitized content to enter a Markdown file processed during a build, and the code runs with the build server's privileges.
The record
- CVE
- CVE-2023-22491
- Published
- Jan 13, 2023
- Updated
- Mar 11, 2025
- Vendor
- Gatsby
- Product
- Gatsby
- Classifications
- CWE-89, CWE-20, T1059.007
- Attack vector
- network
- Privileges
- authenticated
Timeline
How it unfolded
- Jan 13, 2023CVE publishedPublication date reported by the CVE source.
- Mar 11, 2025Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=< 5.25.1
- Affected versionversion=>= 6.0.0, < 6.3.2
What conditions does exploitation require?
What is affected?
Published CVSS scores
CVSS describes severity. EPSS estimates exploitation probability.
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
- JavaScript frontmatter command-execution payloadproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo