Description Preview
The gatsby-transformer-remark plugin for Gatsby framework, versions prior to 5.25.1 and 6.3.2, contains a cross-site scripting (XSS) vulnerability (CWE-79). The plugin passes unsanitized input to the 'gray-matter' npm package, which is vulnerable to JavaScript injection in its default configuration. When querying MarkdownRemark nodes via GraphQL in data mode, injected JavaScript can execute in the context of the build server. This vulnerability requires untrusted or unsanitized input to be sourced by or added into files processed by gatsby-transformer-remark.
Overview
Gatsby is a popular open-source framework based on React for building websites and applications. The vulnerability affects the gatsby-transformer-remark plugin, which is used to parse Markdown files. The issue stems from the plugin's use of the gray-matter npm package without proper input sanitization. When processing Markdown files with untrusted content, an attacker could inject malicious JavaScript code that would execute during the build process. This could potentially lead to server-side code execution within the build environment, allowing attackers to access sensitive information or perform unauthorized actions.
Remediation
To address this vulnerability, users should:
- Update to gatsby-transformer-remark version 5.25.1 or 6.3.2 or later, which mitigates the issue by disabling the gray-matter JavaScript Frontmatter engine.
- If upgrading is not immediately possible, implement input sanitization for all content processed by the gatsby-transformer-remark plugin.
- Consider upgrading to the latest major release branch for all Gatsby plugins to ensure timely receipt of security updates and bug fixes.
- Review any content sources that feed into Markdown files processed by the plugin to ensure they are trusted or properly sanitized.
- Implement proper content validation and sanitization practices throughout the application, especially when handling user-generated content.
References
- GitHub Security Advisory: https://github.com/gatsbyjs/gatsby/security/advisories/GHSA-7ch4-rr99-cqcw
- CVE Details: CVE-2023-22491
- CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Industry ExposureMost to leastThis section illustrates the prevalence of a specific Common Vulnerabilities and Exposures (CVE) across various industries based on customer reports. The ranking displays industries from the most to least affected by this particular vulnerability, offering valuable insight into where this CVE has been most frequently observed. This information can help organizations within these sectors prioritize their security efforts, understand their relative risk exposure compared to their peers, and focus remediation strategies where they are most needed. By understanding the industry-specific impact, organizations can make more informed decisions regarding patching, resource allocation, and overall risk management related to this CVE.
This section illustrates the prevalence of a specific Common Vulnerabilities and Exposures (CVE) across various industries based on customer reports. The ranking displays industries from the most to least affected by this particular vulnerability, offering valuable insight into where this CVE has been most frequently observed. This information can help organizations within these sectors prioritize their security efforts, understand their relative risk exposure compared to their peers, and focus remediation strategies where they are most needed. By understanding the industry-specific impact, organizations can make more informed decisions regarding patching, resource allocation, and overall risk management related to this CVE.
- ManufacturingManufacturing
- Management of Companies & EnterprisesManagement of Companies & Enterprises
- Professional, Scientific, & Technical ServicesProfessional, Scientific, & Technical Services
- Retail TradeRetail Trade
- Arts, Entertainment & RecreationArts, Entertainment & Recreation
- Public AdministrationPublic Administration
- Transportation & WarehousingTransportation & Warehousing
- Accommodation & Food ServicesAccommodation & Food Services
- Administrative, Support, Waste Management & Remediation ServicesAdministrative, Support, Waste Management & Remediation Services
- Agriculture, Forestry Fishing & HuntingAgriculture, Forestry Fishing & Hunting
- ConstructionConstruction
- Educational ServicesEducational Services
- Finance and InsuranceFinance and Insurance
- Health Care & Social AssistanceHealth Care & Social Assistance
- InformationInformation
- MiningMining
- Other Services (except Public Administration)Other Services (except Public Administration)
- Real Estate Rental & LeasingReal Estate Rental & Leasing
- UtilitiesUtilities
- Wholesale TradeWholesale Trade