<?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 — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/vitest/</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:15:03 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/vendors/vitest/feed.xml" rel="self" type="application/rss+xml"/><item><title>Vitest Arbitrary File Read Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2026-06-vitest-file-read/</link><pubDate>Mon, 01 Jun 2026 14:15:03 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-06-vitest-file-read/</guid><description>An arbitrary file read vulnerability exists in Vitest when the UI server is listening, especially when exposed to the network, allowing an attacker to read arbitrary files outside the project directory and potentially execute arbitrary scripts.</description><content:encoded><![CDATA[<p>A critical vulnerability exists in Vitest versions prior to 4.1.0 that allows arbitrary file reads on Windows systems when the Vitest UI server is active, particularly if exposed to the network. The flaw stems from the incorrect usage of the deprecated <code>isFileServingAllowed</code> function within the <code>/__vitest_attachment__</code> API handler. By using the <code>\\?\\..\\</code> path traversal technique, attackers can bypass intended security checks and access files outside the project directory. This vulnerability, identified as CVE-2026-47429, could also lead to arbitrary script execution due to the API&rsquo;s rerun and file write capabilities. To mitigate this, Vitest now includes <code>allowWrite</code> and <code>allowExec</code> configuration flags, which are disabled by default when the API server is bound to a non-localhost host.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker identifies a vulnerable Vitest instance with its UI server exposed to the network, running on a Windows system.</li>
<li>Attacker obtains the API token by sending a request to <code>http://localhost:51204/__vitest__/</code>.</li>
<li>Attacker crafts a malicious request to the <code>/__vitest_attachment__</code> endpoint with a path traversal payload: <code>http://localhost:51204/__vitest_attachment__?path=C:\\path\\to\\project\\?\\..\\..\\secret.txt&amp;contentType=text/plain&amp;token=$TOKEN</code>.</li>
<li>The <code>isFileServingAllowed</code> check is bypassed due to the use of the <code>\\?\\..\\</code> sequence.</li>
<li>The Vitest server reads the content of the specified file (<code>secret.txt</code>) outside the intended project directory.</li>
<li>The attacker receives the content of the file in the response.</li>
<li>Attacker leverages the API&rsquo;s rerun feature and file write feature (<code>saveTestFile</code>) to write a malicious test file containing arbitrary code.</li>
<li>Attacker uses the rerun feature to execute the newly created test file, achieving arbitrary script execution.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows an attacker to read arbitrary files on the affected system. If the attacker is able to read sensitive files containing credentials or configuration data, it could lead to further compromise of the system or network. The ability to execute arbitrary scripts allows for full system compromise, data exfiltration, or denial-of-service attacks. This vulnerability affects any Vitest instances with UI server exposed to network and running on Windows prior to version 4.1.0</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade Vitest to version 4.1.0 or later to patch CVE-2026-47429.</li>
<li>Ensure that the <code>allowWrite</code> and <code>allowExec</code> configuration flags are disabled when the Vitest API server is bound to a non-localhost host as per the vendor mitigations.</li>
<li>Monitor network traffic for suspicious requests to the <code>/__vitest_attachment__</code> endpoint with path traversal sequences using the Sigma rule provided below.</li>
<li>Monitor process creation for unexpected script execution originating from the Vitest process using the provided Sigma rule.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">threat</category><category>arbitrary-file-read</category><category>code-execution</category><category>vitest</category><category>cve-2026-47429</category></item><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>