Oct 9, 2026·7 min read·24 visits
Vulnerability in banks < 2.5.1 allows arbitrary file read and write operations via symbolic links placed inside the prompt registry directory.
Improper pathname limitation and link resolution (CWE-22 and CWE-59) in the banks library prior to version 2.5.1 allow local attackers to read or write arbitrary files via crafted symbolic links in the prompt directory registry.
The library banks provides prompt management and templating capability, serving as a layer on top of the Jinja rendering engine. Within this library, the class banks.registries.DirectoryPromptRegistry manages on-disk storage, parsing, and indexing of prompt template files. Applications utilizing this registry component face exposure if they process template directories modified by untrusted entities.
This vulnerability, classified under CVE-2026-107716, belongs to the Improper Limitation of a Pathname (CWE-22) and Link Following (CWE-59) bug classes. Prior to the patch in version 2.5.1, the component failed to validate filesystem node characteristics before resolving paths and executing read or write operations. Consequently, symbolic links placed inside the registry root are traversed, leading to unauthorized access outside the intended directory boundary.
The attack surface becomes active in architectures where users can upload template packages or control the files loaded by the application. Because the engine resolves these inputs automatically, an attacker can read sensitive system credentials or corrupt existing configuration files. This document details the exact mechanics of the vulnerability, the structural root causes, and the corresponding mitigation path.
The primary root cause of this vulnerability lies in the lack of filesystem verification during the index-building and prompt-retrieval phases. When DirectoryPromptRegistry processes the directory tree, it iterates over all files matching the target suffix without checking if they are symbolic links. Standard Python library functions like path.open() or path.read_text() resolve symbolic links transparently at the operating system level, which allows the retrieval of files outside the designated registry path.
A secondary structural weakness exists in the write operations conducted during index updates and template modification. The registry uses direct filesystem writing methods that do not specify protection flags against symbolic link traversal. When a template is saved or the index is updated, the engine follows any pre-existing symbolic link mapped to the index or template filename, causing the application to write data to unintended external locations.
To exploit this behavior, an attacker must successfully plant symbolic links inside the folder configured as the prompt registry. This condition is commonly met in multi-tenant environments, content management systems, or platforms that extract compressed archive uploads without validating entry types. Once the links are in place, any subsequent read or write action performed by the application triggers the vulnerability, operating with the full permissions of the parent process.
In vulnerable versions of the library, the registry resolves prompt paths using standard concatenation without checking for directory escape or symlink patterns. The _resolve_prompt_file function merely appended names to the root path, which is illustrated in the following diagram representing the data flow:
The patched version introduces explicit validations to verify path alignment and reject symbolic link structures. First, the library scans and verifies that files inside the registry root do not match symbolic links. In the _resolve_prompt_file function, the code now checks candidate.is_symlink() and raises an InvalidPromptError if a symlink is encountered.
# Patched implementation in directory.py
root = registry_root.resolve()
candidate = registry_root / f"{name}.{version}.jinja"
if candidate.is_symlink():
msg = f"Prompt path is a symbolic link: {candidate}"
raise InvalidPromptError(msg)
resolved = candidate.resolve()
if not resolved.is_relative_to(root):
msg = f"Prompt path escapes registry root: {resolved}"
raise InvalidPromptError(msg)Additionally, write operations are secured against concurrent link manipulation using low-level file descriptors. The library utilizes os.O_NOFOLLOW on supported platforms to instruct the kernel to abort the write operation if the target path resolves to a link. This technique effectively closes the window of opportunity for symbolic link modification during file creation.
Exploitation of this vulnerability is achieved in two distinct modes depending on whether the target operation is a read or write action. In both scenarios, the primary prerequisite is the ability of the attacker to introduce symbolic links into the registry path. This prerequisite is met when the application processes uploaded zip files, untrusted git repositories, or shared filesystem directories.
For an arbitrary file read, the attacker creates a symbolic link that points to a target system file, such as /etc/passwd. The symbolic link is named to match the template naming convention, for example leak.0.jinja. When the application initializes the registry or updates the index, it scans the directory, follows the link, reads the contents of /etc/passwd, and stores the content in memory as the template body, making it retrievable by the attacker.
For an arbitrary file write, the attacker leverages the index update mechanism or the template storage routines. The attacker plants a symbolic link named index.json pointing to a target system configuration file or script. When the registry updates its internal index or saves a new prompt, the _save() routine writes the serialized data to index.json. The operating system follows the link, overwriting the target system file with the serialized index data, which can disrupt services or alter behavior.
The impact of CVE-2026-107716 is classified as high, as it permits both unauthorized read and write access to files on the host system. Through arbitrary file disclosure, an attacker can extract sensitive configuration profiles, private keys, database credentials, and environment files. The severity is determined by the privileges of the system user executing the application process.
Through arbitrary file write operations, the risk extends to application state corruption and potential control flow hijacking. By overwriting key configuration files, an attacker can disable security controls or redirect traffic. In environments where the application runs with elevated privileges, overwriting critical files like system crontabs or startup scripts can lead to code execution.
The CVSS v4.0 score is assessed at 7.3, reflecting high confidentiality and integrity impacts under local access conditions. Although direct local access is typically required to place the symlinks, remote exploitation remains possible if the application exposes file upload or archive extraction endpoints. The vulnerability is currently not listed on the CISA Known Exploited Vulnerabilities catalog, indicating no widespread active campaign.
The primary remediation is upgrading the banks package to version 2.5.1 or later, which incorporates the path containment and symbolic link checks. This update modifies the scanning and writing processes to actively reject symbolic links and verify that resolved paths lie strictly within the registry directory. This blocks both read and write traversal techniques.
If upgrading immediately is not feasible, operational mitigations must be implemented to secure the directory contents. The prompt registry directory should be set to read-only for the application process during runtime, preventing the injection or modification of files. Any file upload, archive extraction, or remote repository synchronization feature must be strictly isolated and scanned to reject symlink files before they reach the registry path.
Developers should also audit application architectures to ensure that user-supplied templates are never directly stored in the filesystem registry. Implementing strict validation on template names and version strings prevents directory traversal sequences from bypassing basic check logic. These layers of defense ensure the application remains secure even if underlying library methods face unforeseen bypasses.
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
banks masci | < 2.5.1 | 2.5.1 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22, CWE-59 |
| Attack Vector | Local |
| CVSS v4.0 | 7.3 |
| EPSS Score | N/A |
| Impact | Arbitrary File Read / Arbitrary File Write |
| Exploit Status | None/PoC |
| KEV Status | Not Listed |
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') and Improper Link Resolution Before File Access ('Link Following')
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.