Skip to main content

CVE-2022-39239: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in netlify netlify-ipx

Medium
Published: Fri Sep 23 2022 (09/23/2022, 07:55:08 UTC)
Source: CVE
Vendor/Project: netlify
Product: netlify-ipx

Description

netlify-ipx is an on-Demand image optimization for Netlify using ipx. In versions prior to 1.2.3, an attacker can bypass the source image domain allowlist by sending specially crafted headers, causing the handler to load and return arbitrary images. Because the response is cached globally, this image will then be served to visitors without requiring those headers to be set. XSS can be achieved by requesting a malicious SVG with embedded scripts, which would then be served from the site domain. Note that this does not apply to images loaded in `<img>` tags, as scripts do not execute in this context. The image URL can be set in the header independently of the request URL, meaning any site images that have not previously been cached can have their cache poisoned. This problem has been fixed in version 1.2.3. As a workaround, cached content can be cleared by re-deploying the site.

AI-Powered Analysis

AILast updated: 06/22/2025, 17:05:21 UTC

Technical Analysis

CVE-2022-39239 is a vulnerability affecting netlify-ipx, a component used for on-demand image optimization in the Netlify platform. Versions prior to 1.2.3 of netlify-ipx contain a security flaw that allows an attacker to bypass the source image domain allowlist by sending specially crafted HTTP headers. This bypass causes the image handler to load and return arbitrary images from external sources. Because the response is cached globally by Netlify's CDN, the malicious image is then served to all visitors of the site without requiring the attacker to resend the crafted headers. This cache poisoning can be exploited by requesting a malicious SVG image containing embedded scripts. When served from the site domain, this SVG can execute cross-site scripting (XSS) attacks. However, it is important to note that this XSS vector does not apply to images loaded via the standard <img> HTML tag, as scripts embedded in SVGs do not execute in that context. The vulnerability also involves a server-side request forgery (SSRF) aspect, as the image URL can be set independently in the header, allowing the attacker to force the server to fetch arbitrary images. The vulnerability was fixed in version 1.2.3 of netlify-ipx. As a mitigation, clearing the CDN cache by redeploying the site can remove poisoned cached content. This vulnerability is categorized under CWE-79 (Improper Neutralization of Input During Web Page Generation, i.e., XSS) and CWE-918 (Server-Side Request Forgery). No known exploits in the wild have been reported to date. The flaw impacts the confidentiality and integrity of users interacting with affected sites by enabling script execution in the context of the trusted domain, potentially leading to session hijacking, credential theft, or other malicious actions. The vulnerability requires no authentication but does require the attacker to send crafted headers and host a malicious SVG payload. The scope is limited to sites using vulnerable versions of netlify-ipx and serving images through this mechanism.

Potential Impact

For European organizations using Netlify with netlify-ipx versions prior to 1.2.3, this vulnerability poses a risk of cross-site scripting attacks via poisoned image caches. The global CDN caching means that once an attacker poisons the cache, all visitors to the affected site can be served malicious SVG images capable of executing scripts in the site's domain context. This can lead to theft of user credentials, session tokens, or other sensitive information, undermining user trust and potentially violating data protection regulations such as GDPR. The SSRF component could also be leveraged to make unauthorized requests from the server, potentially exposing internal resources or enabling further attacks. Organizations in sectors with high web traffic or handling sensitive user data (e.g., e-commerce, finance, healthcare) are particularly at risk. The impact on availability is low, but the confidentiality and integrity risks are significant. Since the vulnerability does not require user interaction beyond visiting the site, the attack surface is broad. The lack of known exploits in the wild reduces immediate risk but does not eliminate the threat, especially if attackers develop automated cache poisoning techniques. Failure to patch or mitigate could result in reputational damage and regulatory penalties for European organizations.

Mitigation Recommendations

1. Upgrade netlify-ipx to version 1.2.3 or later immediately to apply the official fix. 2. Redeploy affected Netlify sites to clear the global CDN cache and remove any poisoned cached images. 3. Implement strict Content Security Policy (CSP) headers restricting script execution and limiting allowed image sources to trusted domains. 4. Monitor HTTP headers and image requests for unusual or unexpected patterns that could indicate attempts to exploit header-based cache poisoning. 5. Regularly audit third-party dependencies and their versions to ensure timely patching of known vulnerabilities. 6. For critical sites, consider disabling on-demand image optimization temporarily if upgrading is not immediately feasible, to reduce attack surface. 7. Educate development and DevOps teams about the risks of SSRF and XSS in image processing components and the importance of input validation and output encoding. 8. Use security scanners capable of detecting SSRF and XSS vulnerabilities in CI/CD pipelines to catch regressions or new issues early.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-09-02T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9845c4522896dcbf4473

Added to database: 5/21/2025, 9:09:25 AM

Last enriched: 6/22/2025, 5:05:21 PM

Last updated: 8/11/2025, 12:41:10 AM

Views: 12

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats