Bug 2252893 (CVE-2023-49293)

Summary: CVE-2023-49293 vitejs: XSS vulnerability in `server.transformIndexHtml` via URL payload
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Product Security <prodsec-ir-bot>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: asoldano, bbaranow, bmaxwell, boliveir, brian.stansberry, caswilli, cdewolf, chazlett, darran.lofthouse, dkreling, dosoudil, drichtar, epacific, fjuma, hkataria, ivassile, iweiss, jcammara, jhardy, jneedle, jobarker, kaycoth, kshier, lgao, mabashia, mosmerov, msochure, mstefank, msvehla, mulliken, mwringe, nwallace, pdrozd, pjindal, pmackay, pskopek, rowaters, rstancel, simaishi, smaestri, smcdonal, sthorger, teagle, tom.jenkinson, yguenane, zsadeh
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: vite 4.4.12, vite 4.5.0, vite 4.5.1, vite 5.0.0, vite 5.0.5 Doc Type: ---
Doc Text:
A cross-site scripting (XSS) vulnerability was found in vitejs that can be triggered by sending a malicious payload through server.transformIndexHtml.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2252894    

Description Pedro Sampaio 2023-12-05 06:24:27 UTC
Vite is a website frontend framework. When Vite's HTML transformation is invoked manually via `server.transformIndexHtml`, the original request URL is passed in unmodified, and the `html` being transformed contains inline module scripts (`<script type="module">...</script>`), it is possible to inject arbitrary HTML into the transformed output by supplying a malicious URL query string to `server.transformIndexHtml`. Only apps using `appType: 'custom'` and using the default Vite HTML middleware are affected. The HTML entry must also contain an inline script. The attack requires a user to click on a malicious URL while running the dev server. Restricted files aren't exposed to the attacker. This issue has been addressed in vite.5, vite.1, and vite.12. There are no known workarounds for this vulnerability.

References:

https://github.com/vitejs/vite/security/advisories/GHSA-92r3-m2mg-pj97