Banks: Arbitrary import path resolution remote code execution (CVE-2026-61536)
The banks library fails to validate tool import paths parsed from template content, allowing an attacker to achieve arbitrary code execution by defining malicious Tool objects that resolve to system-level Python callables.
CVE search metadata
CVE search record: CVE-2026-61536. Severity: high. CVSS: 7.5. EPSS: 0.38%. KEV: no. Product: banks (<= 2.4.2). Brief: Banks: Arbitrary import path resolution remote code execution (CVE-2026-61536). Brief link: https://feed.craftedsignal.io/briefs/2026-11-banks-rce/
Triage facts
Revision 1- Applicability
- banks (<= 2.4.2)
- Evidence
- Unknown
- Severity
- High
- Action
- Immediate escalation
- Sources
- 2 public sources
- Freshness
- Revision 1Nov 5, 22:30 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A1Likely
The banks library contains a vulnerability in its completion extension where tool definitions are parsed directly from template bodies without validation. An attacker can inject a JSON-serialized Tool object into a template, specifying an arbitrary import_path. When the application processes the template, importlib.import_module is invoked on the attacker-controlled path, allowing the instantiation of any available Python callable. This enables remote code execution (RCE) with the privileges of the host process. This vulnerability persists in version 2.4.2 despite previous fixes for Jinja sandboxing, as the tool resolution logic operates outside the sandboxed environment.
Attack Chain
- Attacker gains write access to a prompt registry (e.g., RedisPromptRegistry or shared filesystem).
- Attacker injects a malicious
{% completion %}block containing a JSON-serializedToolobject. - The malicious
Toolobject specifies a high-riskimport_path(e.g.,os.system). - The application renders the template and calls
Tool.model_validate_json()to parse the injected JSON. - The library calls
_get_tool_callable, passing the untrustedimport_pathtoimportlib.import_module. - The LLM is invoked or prompted to call the function name defined in the malicious tool.
- The application resolves the callable via
getattr()and executes it with attacker-supplied arguments. - Arbitrary command execution occurs under the application process context.
Impact
Successful exploitation allows for arbitrary code execution on the server hosting the banks-based application. This impact is significant for environments where prompts are fetched from external or shared sources, potentially leading to full system compromise depending on the process permissions.
Recommendation
- Upgrade or migrate away from vulnerable implementations using the affected
CompletionExtensionuntil a vendor-supplied security patch is released. - Implement a hardcoded allowlist for tool callables at the application level to replace the dynamic
importlibresolution. - Audit all prompt storage mechanisms (Redis, file-based registries) to ensure only authorized users can modify template content.
- Restrict process-level permissions for inference services to limit the impact of potential RCE.
Immediate actions
Identify all applications using the banks library and assess if they utilize external or shared prompt registries
Threat Hunt
Monitor application logs for unexpected Tool object definitions or calls to unusual system modules within template-rendered outputs
Data: Application logs (process execution context)
Mitigations
Implement a strict allowlist for callable tools at the application level and avoid dynamic resolution
CVE-2026-61536