CVE-2026-71492: Banks: Path traversal in `DirectoryPromptRegistry.set()` allows arbitrary file write outside the registry root
Banks generates meaningful LLM prompts using a simple template language. Prior to version 2.4.5, DirectoryPromptRegistry.set() in src/banks/registries/directory.py interpolates attacker-controlled Prompt.name and Prompt.version values into a Path without canonicalization or containment validation. Relative traversal such as ../victim/foo and an absolute Prompt.name can escape or discard the configured registry root, while overwrite=True permits replacement of existing target files. The poisoned name is persisted in index.json and reconstructed by load(), allowing the out-of-root path to survive later registry loads. An application that forwards request data into these fields can therefore write Prompt.raw bytes to attacker-chosen paths writable by the application process. This issue is fixed in version 2.4.5.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Banksto a version that resolves this vulnerability.Fixed in 2.4.5
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using Banks versions earlier than 2.4.5 are exposed if they pass attacker-controlled data into Prompt.name or Prompt.version when calling DirectoryPromptRegistry.set(). The attacker can write only to paths writable by the application process.
What does an attacker need to exploit it?
An attacker needs influence over Prompt.name or Prompt.version supplied to DirectoryPromptRegistry.set(). Relative traversal values or an absolute Prompt.name can cause writes outside the configured registry root; overwrite=True can replace an existing writable file.
Can the unsafe path persist after the initial write?
Yes. The supplied name is stored in index.json and reconstructed during later _load() operations, so an out-of-root path can survive registry reloads.
What should be done if upgrading cannot happen immediately?
Do not forward untrusted request data into Prompt.name or Prompt.version for DirectoryPromptRegistry.set(). Restrict those values to validated, non-absolute names without traversal components, and avoid overwrite=True for untrusted inputs.