<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>@Vitest/Browser — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/@vitest/browser/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Mon, 01 Jun 2026 14:14:49 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/@vitest/browser/feed.xml" rel="self" type="application/rss+xml"/><item><title>Vitest Browser Mode XSS via otelCarrier Parameter Leads to RCE</title><link>https://feed.craftedsignal.io/briefs/2026-06-vitest-xss/</link><pubDate>Mon, 01 Jun 2026 14:14:49 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-06-vitest-xss/</guid><description>Vitest browser mode is vulnerable to reflected cross-site scripting (XSS) due to the `otelCarrier` query parameter being inserted directly into an inline module script without sanitization, enabling an attacker to craft a browser-runner URL that executes arbitrary JavaScript in the Vitest server origin, potentially leading to remote code execution (RCE).</description><content:encoded><![CDATA[<p>The Vitest browser mode is susceptible to a reflected cross-site scripting (XSS) vulnerability. Specifically, the <code>otelCarrier</code> query parameter, when passed to the <code>/__vitest_test__/</code> endpoint, is directly inserted into an inline module script without proper sanitization. This allows an attacker to inject arbitrary JavaScript code that executes within the Vitest server&rsquo;s origin. The generated page also contains <code>VITEST_API_TOKEN</code>, which is used for authenticating Vitest WebSocket APIs, leading to potential token compromise and authenticated API calls. This issue affects Vitest versions &gt;= 4.0.17 and &lt; 4.1.6, as well as &gt;= 5.0.0-beta.0 and &lt; 5.0.0-beta.3, impacting users running Vitest browser mode. A successful exploit requires a victim to open a crafted Vitest browser-runner URL while the Vitest browser server is active.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker crafts a malicious URL targeting the <code>/__vitest_test__/</code> endpoint, embedding JavaScript code within the <code>otelCarrier</code> query parameter.</li>
<li>The victim opens the attacker-crafted URL in a web browser while the Vitest browser server is running.</li>
<li>The Vitest server reflects the unsanitized <code>otelCarrier</code> parameter directly into an inline module script within the generated HTML page.</li>
<li>The injected JavaScript executes within the victim&rsquo;s browser, in the Vitest server origin.</li>
<li>The attacker&rsquo;s script accesses <code>window.VITEST_API_TOKEN</code>, compromising the Vitest WebSocket API token.</li>
<li>The attacker uses the compromised API token to authenticate with the Vitest WebSocket API endpoint at <code>/__vitest_browser_api__</code>.</li>
<li>The attacker calls the <code>triggerCommand</code> function via the WebSocket to write a malicious payload into the <code>vite.config.ts</code> file.</li>
<li>Vitest/Vite reloads the modified configuration file, resulting in the execution of the injected code within the Node.js environment, achieving remote code execution (RCE).</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows an attacker to execute arbitrary JavaScript code within the Vitest server&rsquo;s origin. In a default local browser-mode setup, this XSS can be leveraged to compromise the Vitest API token, leading to server-side code execution. A confirmed proof of concept demonstrates modifying <code>vite.config.ts</code> to execute arbitrary code in Node. This issue poses a significant risk to developers and CI/CD environments using Vitest in browser mode.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the patch or upgrade to a non-vulnerable version of <code>@vitest/browser</code> to address CVE-2026-47428.</li>
<li>Deploy the Sigma rule &ldquo;Detect Vitest otelCarrier Parameter Injection&rdquo; to identify potential exploitation attempts by detecting suspicious characters in the <code>otelCarrier</code> query parameter within web server logs.</li>
<li>Block access to the known malicious URLs (e.g., <code>http://localhost:63315/__vitest_test__/?otelCarrier=(alert(%22xss%20via%20otelCarrier%22)%2Cnull)</code>) listed in the IOC section at the network perimeter.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>xss</category><category>rce</category><category>vitest</category><category>javascript</category><category>dependency-vulnerability</category></item></channel></rss>