{"answers":{"affected":"4 open source packages ship an affected version, including gatsby-transformer-remark. It affects 1 product.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-22491 exists.","fix":"Upgrade gatsby-transformer-remark to a fixed version for your release line: 5.25.1 or 6.3.2.","what":"CVE-2023-22491 is a high-severity code injection vulnerability in gatsbyjs gatsby, published on 13 Jan 2023. Any signed-in user can exploit it over the network, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2023-22491 and fix it if it is affected.\n\nWhat it is: CVE-2023-22491 is a high-severity code injection vulnerability in gatsbyjs gatsby, published on 13 Jan 2023. Any signed-in user can exploit it over the network, with no action from the victim.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-22491 exists.\n\nAffected packages and fixed versions:\n- gatsby-transformer-remark (npm): affected all versions; fixed in 5.25.1\n- gatsby-transformer-remark (npm): affected all versions; fixed in 5.25.1\n- gatsby-transformer-remark (npm): affected from 6.0.0; fixed in 6.3.2\n- gatsby-transformer-remark (npm): affected from 6.0.0; fixed in 6.3.2\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2023-22491/ (Markdown: https://insights.sbomify.com/CVE-2023-22491/index.md)","id":"CVE-2023-22491","markdown":"https://insights.sbomify.com/CVE-2023-22491/index.md","name":"CVE-2023-22491","record":{"aliases":["GHSA-7ch4-rr99-cqcw","UBUNTU-CVE-2023-22491"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"Gatsby remark plugin","requires_auth":"low_privilege","summary":"Attackers can execute arbitrary JavaScript on the build server by injecting code into Markdown files processed by the Gatsby remark plugin.","user_interaction":"not_required","vuln_class":"code_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"gatsby-transformer-remark","vendor":"gatsbyjs"}],"cvss":{"score":8.1,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","version":"3.1"},"cwes":[{"id":"CWE-79","name":"Improper Neutralization of Input During Web Page Generation"},{"id":"CWE-89","name":"Improper Neutralization of Special Elements used in an SQL Command"},{"id":"CWE-20","name":"Improper Input Validation"}],"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.","ecosystems":["npm"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"gatsby-transformer-remark vulnerable to unsanitized JavaScript code injection","id":"CVE-2023-22491","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"npm","product":null,"products":[],"type":"code_injection","year":"2023"},"n_packages":4,"n_references":1,"next":{"headline":"RefreshToken invalidation vulnerability","id":"CVE-2023-22492"},"packages":[{"ecosystem":"npm","fixed":["5.25.1"],"introduced":["0"],"last_affected":[],"package":"gatsby-transformer-remark","purl":null,"source":"GHSA-7ch4-rr99-cqcw"},{"ecosystem":"npm","fixed":["5.25.1"],"introduced":["0"],"last_affected":[],"package":"gatsby-transformer-remark","purl":"pkg:npm/gatsby-transformer-remark","source":"GHSA-7ch4-rr99-cqcw"},{"ecosystem":"npm","fixed":["6.3.2"],"introduced":["6.0.0"],"last_affected":[],"package":"gatsby-transformer-remark","purl":null,"source":"GHSA-7ch4-rr99-cqcw"},{"ecosystem":"npm","fixed":["6.3.2"],"introduced":["6.0.0"],"last_affected":[],"package":"gatsby-transformer-remark","purl":"pkg:npm/gatsby-transformer-remark","source":"GHSA-7ch4-rr99-cqcw"}],"prev":{"headline":"Git vulnerable to local clone-based data exfiltration with non-local transports","id":"CVE-2023-22490"},"products":["gatsby"],"published":"2023-01-13","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"total"},"state":"PUBLISHED","updated":"2025-03-11","vendors":["gatsbyjs"]},"summary":"Attackers can execute arbitrary JavaScript on the build server by injecting code into Markdown files processed by the Gatsby remark plugin.","url":"https://insights.sbomify.com/CVE-2023-22491/"}