<?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>Origin-Validation — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/origin-validation/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 03 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/origin-validation/feed.xml" rel="self" type="application/rss+xml"/><item><title>Jupyter Server CORS Origin Validation Bypass via Regex</title><link>https://feed.craftedsignal.io/briefs/2024-01-jupyter-cors-bypass/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-jupyter-cors-bypass/</guid><description>Jupyter Server versions 2.17.0 and earlier are vulnerable to a CORS origin validation bypass due to improper use of `re.match()` in validating the Origin header against the `allow_origin_pat` configuration, allowing attackers to bypass CORS restrictions.</description><content:encoded><![CDATA[<p>Jupyter Server, a web-based interactive development environment, is susceptible to a CORS (Cross-Origin Resource Sharing) bypass vulnerability. This flaw arises from the server&rsquo;s reliance on the <code>re.match()</code> function in Python&rsquo;s regular expression library for validating the <code>Origin</code> header against the configured <code>allow_origin_pat</code>. The <code>re.match()</code> function, unlike <code>re.fullmatch()</code>, only anchors the regex at the beginning of the string, not the end. Consequently, an attacker can craft a malicious domain, such as <code>http://trusted.example.com.evil.com/</code>, which will pass the regex validation if the <code>allow_origin_pat</code> is intended to match <code>trusted.example.com</code>. This vulnerability impacts Jupyter Server versions 2.17.0 and prior. The fix was implemented in pull request #603 and patched in commits 057869a327c46730afede3eab0ca2d2e3e74acea and 49b34392feaa97735b3b777e3baf8f22f2a14ed8. Successful exploitation allows an attacker to bypass CORS restrictions, potentially leading to unauthorized data access or actions on behalf of legitimate users.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker identifies a Jupyter Server instance running version 2.17.0 or earlier.</li>
<li>The attacker crafts a malicious website with a domain name designed to bypass the <code>allow_origin_pat</code> regex. For instance, if the intended origin is <code>trusted.example.com</code>, the attacker uses <code>trusted.example.com.evil.com</code>.</li>
<li>A victim user visits the attacker&rsquo;s malicious website in their browser.</li>
<li>The malicious website sends a cross-origin HTTP request to the vulnerable Jupyter Server. The <code>Origin</code> header in the request is set to the attacker-controlled domain (<code>trusted.example.com.evil.com</code>).</li>
<li>The Jupyter Server receives the request and validates the <code>Origin</code> header against the <code>allow_origin_pat</code> configuration using <code>re.match()</code>.</li>
<li>Due to the behavior of <code>re.match()</code>, the attacker&rsquo;s origin passes the validation, as the regex only checks for a match at the beginning of the string.</li>
<li>The Jupyter Server processes the cross-origin request, effectively bypassing the intended CORS restrictions.</li>
<li>The attacker can then potentially perform unauthorized actions or access sensitive data within the Jupyter Server, as if the request originated from a trusted source.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows attackers to bypass CORS restrictions on vulnerable Jupyter Server instances. This could lead to unauthorized access to sensitive data, modification of user settings, or execution of arbitrary code within the Jupyter environment, all performed under the guise of a legitimate user. The number of affected instances depends on the prevalence of vulnerable Jupyter Server versions and the use of misconfigured <code>allow_origin_pat</code> settings.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade Jupyter Server to a version greater than 2.17.0, which includes the fix for CVE-2026-40110.</li>
<li>As a workaround, wrap your <code>allow_origin_pat</code> configuration value with <code>^</code> and <code>$</code> to ensure the regex matches the entire string, as suggested in the advisory.</li>
<li>Monitor web server logs for requests with <code>Origin</code> headers matching the pattern <code>trusted.example.com.*</code> (adjusting the <code>trusted.example.com</code> to your actual configured pattern) to detect potential exploitation attempts. Implement this detection using the provided Sigma rule targeting webserver logs.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>cors</category><category>origin-validation</category><category>regex</category><category>web-application</category></item></channel></rss>