Skip to main content
Vulnerability Database/CVE-2026-107716

CVE-2026-107716: Banks Library Path Traversal Vulnerability

CVE-2026-107716 is a path traversal flaw in Banks library that allows attackers to read or write files outside the intended directory through symbolic links. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-107716 Overview

CVE-2026-107716 is a path traversal vulnerability in Banks, a Python library that generates LLM prompts using a simple template language. Versions prior to 2.5.1 fail to reject symbolic links for index.json and .jinja prompt files within the DirectoryPromptRegistry. An attacker who can influence the registry directory or its extracted contents can plant symlinks that redirect registry operations to arbitrary filesystem locations. This enables disclosure of files outside the registry root and allows overwriting external link targets through registry write operations. The flaw is tracked as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory).

Critical Impact

Attackers with influence over the Banks prompt registry directory can read sensitive files or overwrite arbitrary files on the host, affecting the confidentiality and integrity of the LLM application.

Affected Products

  • Banks (masci/banks) prompt template library prior to version 2.5.1
  • Python applications embedding DirectoryPromptRegistry for prompt storage
  • LLM pipelines that accept prompt archives or directories from untrusted sources

Discovery Timeline

  • 2026-10-08 - CVE-2026-107716 published to NVD
  • 2026-10-09 - Last updated in NVD database

Technical Details for CVE-2026-107716

Vulnerability Analysis

Banks is a prompt template engine for large language model (LLM) applications. Its DirectoryPromptRegistry component manages a filesystem-backed catalog of Jinja templates. The registry performs scanning, loading, and saving operations against files under a configured root directory.

The registry does not validate whether discovered files are regular files or symbolic links. Four methods are affected: DirectoryPromptRegistry._scan() and DirectoryPromptRegistry.get() follow symlinks during read operations, while DirectoryPromptRegistry.set(), DirectoryPromptRegistry._save(), and DirectoryPromptRegistry._load() follow symlinks during write operations. An attacker who can place a symlink inside the registry directory causes those operations to resolve outside the intended root.

Root Cause

The root cause is missing symlink validation when enumerating and opening index.json and .jinja files. The registry treats symlinks as ordinary files and relies on default filesystem semantics, which transparently follow links. There is no check that Path.resolve() of a candidate file remains under the registry root before I/O is performed.

Attack Vector

Exploitation requires local influence over the registry directory contents, for example by extracting an attacker-supplied prompt archive or by writing into a shared directory used by Banks. The attacker plants a symlink such as prompts/leak.jinja -> /etc/passwd or prompts/index.json -> /home/user/.ssh/authorized_keys. A subsequent call to get() discloses the target file, and a subsequent call to set() or _save() overwrites it with attacker-controlled prompt content.

The fix in version 2.5.1 adds symlink rejection to the registry scanning and I/O paths. The patch also stabilizes the Python typing dependency chain on older interpreters:

python
 # SPDX-License-Identifier: MIT
 from __future__ import annotations

+import sys
+
+# Python < 3.11 does not have typing.NotRequired.
+# Some third-party packages in our dependency tree import it from typing
+# unconditionally. Patch it in early to prevent ImportError.
+if sys.version_info < (3, 11):  # pylint: disable=wrong-import-position
+    import typing
+
+    import typing_extensions
+
+    typing.NotRequired = typing_extensions.NotRequired
+
 from .config import config
 from .env import env
 from .prompt import AsyncPrompt, Prompt

Source: GitHub Commit 23ed13e

Detection Methods for CVE-2026-107716

Indicators of Compromise

  • Symbolic links present inside any directory managed by DirectoryPromptRegistry, especially index.json or files with the .jinja extension
  • Prompt files whose resolved paths point outside the configured registry root
  • Unexpected modifications to sensitive files (such as SSH keys or configuration files) coinciding with Banks registry write operations

Detection Strategies

  • Audit the Banks registry root recursively with find <root> -type l to enumerate symlinks that should not exist
  • Review application logs for DirectoryPromptRegistry.set() or _save() calls that target paths outside the registry root
  • Inspect the installed Banks package version with pip show banks and flag any version earlier than 2.5.1

Monitoring Recommendations

  • Enable filesystem auditing (auditd on Linux) on the Banks registry directory to record symlink creation and file access events
  • Monitor process execution for Python workers writing to paths unrelated to the configured prompt directory
  • Track ingestion of third-party prompt archives and validate their contents before extraction into any registry location

How to Mitigate CVE-2026-107716

Immediate Actions Required

  • Upgrade Banks to version 2.5.1 or later using pip install --upgrade banks
  • Remove any existing symbolic links from directories managed by DirectoryPromptRegistry
  • Restrict write access to the registry directory to trusted service accounts only
  • Re-extract any prompt archives received from untrusted sources using tools that reject symlinks

Patch Information

The fix is published in Banks release v2.5.1. The code change landed in Pull Request #79 with commit 23ed13e. Full details are available in GitHub Security Advisory GHSA-556j-vv39-8rqv.

Workarounds

  • Store the prompt registry on a filesystem mount that disables symlink creation, or set directory permissions to prevent untrusted writes
  • Extract any user-supplied prompt archives with tar --no-same-owner and a tool that rejects symlinks, or validate archive contents before extraction
  • Run a pre-processing script that deletes any symbolic links under the registry root before invoking Banks
bash
# Upgrade to the patched release and sweep the registry for symlinks
pip install --upgrade 'banks>=2.5.1'
find /path/to/prompt/registry -type l -print -delete

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.