<?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>Mako (&lt;= 1.3.11) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/mako--1.3.11/</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, 24 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/mako--1.3.11/feed.xml" rel="self" type="application/rss+xml"/><item><title>Mako Template Engine Path Traversal Vulnerability on Windows</title><link>https://feed.craftedsignal.io/briefs/2024-01-24-mako-path-traversal/</link><pubDate>Wed, 24 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-24-mako-path-traversal/</guid><description>A path traversal vulnerability exists in Mako versions 1.3.11 and earlier on Windows, allowing attackers to read arbitrary files outside the configured template directory by using backslashes in URIs to bypass directory traversal checks.</description><content:encoded><![CDATA[<p>Mako is a template library written in Python. A path traversal vulnerability, identified as CVE-2026-44307, affects Mako versions 1.3.11 and earlier when running on Windows. The vulnerability stems from inconsistencies in how Mako handles path normalization. Specifically, the <code>TemplateLookup.get_template()</code> function, which uses <code>posixpath</code> for URI normalization, differs from the <code>Template.__init__()</code> function, which uses <code>os.path</code> for file access and validation. This discrepancy allows attackers to bypass directory traversal checks by crafting URIs that contain backslashes. Backslashes are treated as path separators by <code>os.path</code> on Windows but as literal characters by <code>posixpath</code>, leading to incorrect validation. This vulnerability allows an attacker to load and disclose readable files outside the configured template directory if an application passes user-controlled template names or include paths to <code>TemplateLookup.get_template()</code>.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker crafts a malicious URI containing backslash-based path traversal sequences (e.g., <code>\..\..\secret.txt</code>).</li>
<li>The application passes the crafted URI to <code>TemplateLookup.get_template()</code>.</li>
<li><code>get_template()</code> strips leading forward slashes and normalizes the URI using <code>posixpath.normpath()</code>. Backslashes are treated as literal characters, bypassing directory traversal checks.</li>
<li>The URI is passed to <code>Template.__init__()</code> for template initialization and validation.</li>
<li><code>Template.__init__()</code> uses <code>os.path.normpath()</code> to normalize the URI. On Windows, this resolves backslash traversal, converting <code>\..\..\secret.txt</code> to <code>\secret.txt</code>.</li>
<li>The <code>startswith(&quot;..&quot;)</code> check in <code>Template.__init__()</code> incorrectly passes because the normalized path <code>\secret.txt</code> does not begin with <code>..</code>.</li>
<li><code>os.path.isfile()</code> is used to check for the existence of the file. On Windows, <code>os.path.isfile()</code> interprets backslashes as path separators, successfully resolving the path and locating the file outside the intended template directory.</li>
<li>The attacker successfully reads the contents of the file, leading to information disclosure.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows an attacker to read arbitrary files on the system that the application has access to. The vulnerability affects Mako versions 1.3.11 and earlier on Windows. If the targeted file contains Mako/Python template syntax, it may also be parsed and executed as a template, potentially leading to further code execution. The primary impact is local file disclosure.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the patch or upgrade to a version of Mako greater than 1.3.11 to remediate CVE-2026-44307.</li>
<li>Sanitize user-supplied template names and include paths before passing them to <code>TemplateLookup.get_template()</code> to prevent path traversal attacks.</li>
<li>Deploy the Sigma rules in this brief to your SIEM to detect exploitation attempts targeting this vulnerability.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>path-traversal</category><category>vulnerability</category><category>windows</category></item></channel></rss>