# CVE-2023-22491: gatsby-transformer-remark vulnerable to unsanitized JavaScript code injection

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.1
- **CVSS:** 8.1 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 0.64% (percentile 45, 2026-11-26)
- **CWE:** CWE-89, CWE-20
- **Aliases:** GHSA-7ch4-rr99-cqcw
- **Published:** 2023-01-11T18:27:15.000Z
- **Modified:** 2026-09-29T15:06:00.643Z

## Who should check

- Projects that depend on npm package gatsby-transformer-remark (\>= 6.0.0, \< 6.3.2)
- Anyone running gatsbyjs gatsby \>= 6.0.0, \< 6.3.2; \< 5.25.1

## Description

Gatsby is a free and open source framework based on React that helps developers build websites and apps. The gatsby-transformer-remark plugin prior to versions 5.25.1 and 6.3.2 passes input through to the \`gray-matter\` npm package, which is vulnerable to JavaScript injection in its default configuration, unless input is sanitized.  The vulnerability is present in gatsby-transformer-remark when passing input in data mode (querying MarkdownRemark nodes via GraphQL).  Injected JavaScript executes in the context of the build server. To exploit this vulnerability untrusted/unsanitized input would need to be sourced by or added into a file processed by gatsby-transformer-remark. A patch has been introduced in \`gatsby-transformer-remark@5.25.1\` and \`gatsby-transformer-remark@6.3.2\` which mitigates the issue by disabling the \`gray-matter\` JavaScript Frontmatter engine. As a workaround, if an older version of \`gatsby-transformer-remark\` must be used, input passed into the plugin should be sanitized ahead of processing. It is encouraged for  projects to upgrade to the latest major release branch for all Gatsby plugins to ensure the latest security updates and bug fixes are received in a timely manner.

## Affected and fixed versions

- npm `gatsby-transformer-remark`: affected \>= 6.0.0, \< 6.3.2; fixed 6.3.2, 5.25.1 (osv)
- gatsbyjs gatsby: \>= 6.0.0, \< 6.3.2; \< 5.25.1 (cvelist)

## Mitigation

- Upgrade gatsby-transformer-remark to one of 6.3.2, 5.25.1 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-22491. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-22491.md
Affected: gatsby-transformer-remark >= 6.0.0, < 6.3.2
Fixed in: 6.3.2, 5.25.1

Steps:
1. Search this machine and project for gatsby-transformer-remark (npm), gatsbyjs gatsby: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-22491 being exploited?

There is no confirmed exploitation: CVE-2023-22491 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.64% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-22491?

High: CVSS 8.1 (v3.1, scored by CNA). Remote, login needed.

### Which versions are affected by CVE-2023-22491?

gatsby-transformer-remark \>= 6.0.0, \< 6.3.2.

### Is there a fix for CVE-2023-22491?

Yes. Fixed in 6.3.2, 5.25.1. Upgrade gatsby-transformer-remark to one of 6.3.2, 5.25.1 (or later in the same release line).

### How do I check if I'm affected by CVE-2023-22491?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/gatsbyjs/gatsby/security/advisories/GHSA-7ch4-rr99-cqcw>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2023-22491>
- other: <https://github.com/gatsbyjs/gatsby>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-22491>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-7ch4-rr99-cqcw> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2023-22491> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-22491>
