CVE-2023-22491gatsby-transformer-remark vulnerable to unsanitized JavaScript code injection
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.
What to do
Fixed builds are available from npm: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | react | Fix pending | UBUNTU-CVE-2023-22491 | |
| Ubuntu 26.04 | react | Under investigation | UBUNTU-CVE-2023-22491 | |
| Ubuntu 25.10 | react | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2023-22491 | |
| Ubuntu 24.04 | react | Under investigation | UBUNTU-CVE-2023-22491 | |
| Ubuntu 22.04 | react | Under investigation | UBUNTU-CVE-2023-22491 | |
| Ubuntu 20.04 | react | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2023-22491 | |
| Ubuntu 18.04 | react | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2023-22491 | |
| Ubuntu 16.04 | react | Will not fix Ubuntu decided not to fix this in this release | UBUNTU-CVE-2023-22491 | |
| Ubuntu 14.04 | react | Will not fix Ubuntu decided not to fix this in this release | ||
| npm library | gatsby-transformer-remark | Fixed | 5.25.1 | GHSA-7ch4-rr99-cqcw |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- gatsbyjs gatsby: affected: >= 6.0.0, < 6.3.2, < 5.25.1
References
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.