Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted ChatMessage JSON in user input
-
ExploitBanks template renders untrusted line
-
ExecutionLine parsed into ChatMessage with arbitrary role
-
ImpactInjected system/tool message overrides prompt instructions
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V2 - Validation and Business Logic Input validation, allowlisting
|
| Exploitation Conditions | Exploitation requires that the consuming application (1) renders attacker-controlled/untrusted data through a Banks template, (2) calls Prompt.chat_messages() on that rendered output, and (3) forwards the returned ChatMessage objects to an LLM provider. The decisive weakness is that chat_messages() parses every rendered line as ChatMessage JSON and ChatMessage.role accepts arbitrary string values, so an injected line can become a system, assistant, or tool message. LIMITING FACTORS: this is not exploitable against a default Banks install in isolation - it only manifests when untrusted input is deliberately templated into the chat-message pipeline; applications that template only trusted data, or that do not use chat_messages()/the chat extension, are not affected. Fixed in 2.5.0 via an environment sentinel so only intended chat blocks produce parseable messages. |
| Impact | This is a medium-severity (CVSS 6.5) input-validation flaw (CWE-20) in the Banks LLM prompt-templating library, and the signals point to a genuine-but-not-urgent issue rather than a fire. The CVSS vector (AV:N/AC:L/PR:N/UI:N) describes low-complexity, unauthenticated, remote reachability, but the impact is deliberately limited to C:L/I:L/A:N - reflecting prompt-structure manipulation (injecting system/assistant/tool messages), not code execution or data destruction. No EPSS score was provided in the input, so exploitation probability cannot be quantified here; this should be verified against the FIRST EPSS feed. There is no CISA KEV listing and no public exploit referenced, so exploitation status is: no public exploit identified at time of analysis. No SSVC decision record was supplied. The key tension is between the 'easy remote' CVSS metrics and the real precondition: the flaw only matters when an application deliberately renders attacker-controlled data through a Banks template and forwards the resulting ChatMessage objects to an LLM - this is an application-design-dependent path, not a default-on remote service, which materially lowers real-world risk below what the raw 6.5 implies for most deployments. Prioritize patching for applications that template untrusted user input into LLM prompts; deprioritize where templates only consume trusted data. |
| Exploit ScenarioDerived | An application uses Banks to build LLM prompts and interpolates untrusted user input (e.g., a chat message or document) into a template. The attacker submits input containing a crafted line of ChatMessage JSON with role 'system' or 'tool'; because Prompt.chat_messages() parses every rendered line as ChatMessage JSON and ChatMessage.role accepts arbitrary strings, the injected object crosses the prompt boundary and is delivered to the LLM as a privileged message, overriding the application's instructions. No public proof-of-concept is referenced in the provided data. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 08, 2026
Prompt-structure injection in the Banks LLM prompt-templating library (masci/banks) before 2.5.0 allows attacker-controlled template data to cross the prompt boundary and be reinterpreted as system, assistant, or tool chat messages. Because Prompt.chat_messages() parses every rendered line of template output as ChatMessage JSON and ChatMessage.role accepts arbitrary strings, an unauthenticated remote attacker who can induce a consuming application to render untrusted data through a Banks template and forward the resulting messages to an LLM provider can override system instructions, alter the intended prompt structure, or confuse downstream tool and message handling. This is a genuine but conditional, medium-severity input-validation flaw (CVSS 6.5, CWE-20): it does not affect a default Banks install in isolation, and no public exploit code was identified at time of analysis. Vendor-released patch: 2.5.0.
RemediationAI
Primary fix: upgrade Banks to 2.5.0 or later, which is the vendor-released patch that adds an environment sentinel so only intended chat blocks yield parseable ChatMessage objects (see https://github.com/masci/banks/releases/tag/v2.5.0 and the advisory https://github.com/masci/banks/security/advisories/GHSA-hmq2-7hp6-7crh). For applications that cannot upgrade immediately, the effective compensating control is to stop feeding untrusted input into the chat-message pipeline: do not interpolate user-supplied or external data into templates whose rendered output is passed to Prompt.chat_messages() (or to the chat extension), and instead pass such data through non-chat variables or pre-validate/sanitize values so that no rendered line can be valid ChatMessage JSON. Alternatively, avoid calling chat_messages() on templates that mix trusted and untrusted content, and enforce an allowlist of expected roles (system/user/assistant/tool) on the consuming side before forwarding messages to the LLM provider; the trade-off is that this shifts validation into every consuming application and will break legitimate dynamic-role use cases unless mappings are maintained. Note that fixing the underlying issues only partially helps if the application itself still legitimizes attacker-influenced role values, so pairing the upgrade with an application-level check of ChatMessage.role is recommended.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Banks is a Python library that generates LLM prompts using a Jinja-based template language, and its chat extension converts rendered template blocks into structured ChatMessage objects (with ContentBlock content plus role, name, and tool_call_id fields) that are handed directly to LLM providers. The root cause is improper input validation (CWE-20): prior to 2.5.0, chat_messages() attempted to JSON-parse every line of rendered output as a ChatMessage, and ChatMessage.role was not constrained to a fixed allowlist of roles, so any attacker-supplied line that happened to be valid ChatMessage JSON was accepted as a genuine message with an attacker-chosen role. The upstream fix (PR #78, commit 02172b816fb84f6a824cc09a8aca7416f53c12cb) introduces an environment sentinel via ensure_environment_sentinel() and sentinel_from_context(): the chat extension now receives the render context (nodes.ContextReference()) when storing chat messages, and only messages produced by intended chat blocks carrying that sentinel are parsed, while lines rendered straight off the environment inherit a fallback sentinel. The CPE cpe:2.3:a:masci:banks:*:*:*:*:*:*:*:* covers all released versions before 2.5.0. The CVSS vector AV:N/AC:L/PR:N/UI:N confirms the injection is reachable remotely without authentication or user interaction at the library level, with limited confidentiality and integrity impact (C:L/I:L) and no availability impact - consistent with prompt-boundary tampering rather than direct code execution.
Know when Banks gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
Untrusted data crosses the prompt boundary remotely without authentication or interaction; primary impact is integrity of prompt structure (I:L) with limited confidentiality leakage potential (C:L) and no availability impact.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
1DescriptionCVE.org
Banks generates meaningful LLM prompts using a simple template language. Prior to 2.5.0, Banks Prompt.chat_messages() attempts to parse every line of rendered template output as ChatMessage JSON. When an application renders untrusted data and passes the returned ChatMessage objects to an LLM provider, attacker-controlled JSON can cross the prompt boundary and become a system, assistant, or tool message because ChatMessage.role accepts arbitrary strings. This can override application instructions, alter the intended prompt structure, or confuse downstream tool and message handling. This issue is fixed in version 2.5.0.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
Path traversal in the Banks Python prompt-template library (all versions prior to 2.4.5) allows a low-privileged attacke
Arbitrary code execution in the Banks Python LLM-templating library (versions prior to 2.4.3) allows an attacker who can
Arbitrary file disclosure in the Banks Python prompt-templating library (masci/banks) before 2.4.4 lets attackers who co
Banks, a Python library for generating LLM prompts from a simple template language, ships a DirectoryPromptRegistry that
EUVD-2026-95341
GHSA-hmq2-7hp6-7crh
NVD
CVE.org
EPSS
Exploit-DB