<?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>Banks (&lt;= 2.4.1) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/banks--2.4.1/</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>Wed, 03 Jul 2024 17:21:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/banks--2.4.1/feed.xml" rel="self" type="application/rss+xml"/><item><title>banks Library Vulnerable to Server-Side Template Injection Leading to Remote Code Execution</title><link>https://feed.craftedsignal.io/briefs/2024-07-banks-ssti-rce/</link><pubDate>Wed, 03 Jul 2024 17:21:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-07-banks-ssti-rce/</guid><description>banks version 2.4.1 and earlier is vulnerable to Server-Side Template Injection (SSTI) due to the use of an unsandboxed Jinja2 environment, allowing attackers to achieve Remote Code Execution (RCE) by injecting malicious code through user-supplied prompt templates.</description><content:encoded><![CDATA[<p>The <code>banks</code> library, versions 2.4.1 and earlier, is susceptible to a critical Server-Side Template Injection (SSTI) vulnerability (CVE-2026-44209) due to its utilization of an unsandboxed Jinja2 environment. This flaw enables attackers to inject and execute arbitrary code on the host system by exploiting applications that pass user-supplied strings as the template argument to the <code>Prompt()</code> function. The vulnerability arises because the <code>jinja2.Environment()</code> is initialized without proper sandboxing, allowing access to dangerous Python built-ins. This vulnerability impacts any application that relies on <code>banks</code> and allows users to supply prompt templates, potentially leading to full system compromise.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker identifies an application using <code>banks &lt;= 2.4.1</code> that accepts user-controlled input for prompt templates.</li>
<li>The attacker crafts a malicious payload containing Jinja2 template code that leverages Python built-in functions for OS command execution (e.g., using <code>self.__init__.__globals__.__builtins__.__import__('os').popen('id').read()</code>).</li>
<li>The attacker submits the malicious payload through a user-supplied input field, API endpoint, or configuration file that is then passed to the <code>Prompt()</code> function.</li>
<li>The <code>Prompt()</code> function processes the user-supplied string through the unsandboxed Jinja2 environment.</li>
<li>The Jinja2 template engine executes the embedded Python code within the malicious payload.</li>
<li>The <code>os.popen()</code> function executes the attacker-specified command on the host operating system.</li>
<li>The output of the command is captured and potentially returned as part of the rendered template.</li>
<li>The attacker gains arbitrary code execution on the server, enabling data exfiltration, system compromise, or further malicious activities.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows attackers to execute arbitrary commands on the host system, potentially leading to full system compromise. Applications that allow users to supply or customize prompt templates are at significant risk. The impact includes data exfiltration, unauthorized access to sensitive information, and the potential for deploying ransomware or other malware. Similar vulnerabilities (CVE-2024-41950, CVE-2025-25362) in other libraries highlight the severity of this issue.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the <code>banks</code> library to version 2.4.2 or later, which implements a sandboxed Jinja2 environment to mitigate SSTI risks.</li>
<li>Implement input validation and sanitization on all user-supplied prompt templates to prevent the injection of malicious code.</li>
<li>Deploy the Sigma rule &ldquo;Detect banks SSTI via Jinja2 Template Injection&rdquo; to identify potential exploitation attempts in web server logs by monitoring for requests containing suspicious Jinja2 syntax.</li>
<li>Review applications using the <code>banks</code> library to identify and remediate any instances where user-controlled input is directly passed to the <code>Prompt()</code> function without proper sanitization.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>ssti</category><category>rce</category><category>jinja2</category></item></channel></rss>