/

CVE-2026-34522

Severity:

HIGH RISK

(8.1)

Path Traversal / File System Access Control in SillyTavern

CVE-2026-34522

Analyzed

Vulnerability type

Category:

Path Traversal / File System Access Control

CWE:

CWE-22, CWE-73

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SillyTavern versions prior to 1.17.0 contain a path traversal flaw in the /api/chats/import endpoint that allows authenticated users to write files outside the intended chats directory.

By injecting directory traversal sequences into the character_name parameter, an attacker can cause the application to create or overwrite arbitrary files within the server's file system scope.

Affected context

The vulnerability occurs in deployments of SillyTavern where the /api/chats/import functionality is exposed and used by authenticated users to import chat data.

The issue is specifically tied to how the character_name field is incorporated into file paths for storing imported chats, without fully constraining or normalizing the path.

Risk is higher when SillyTavern runs on a multi-user system, shares a host with other sensitive services, or has access to sensitive configuration files and scripts.

Exploit preconditions

  • Attack surface: HTTP API endpoint /api/chats/import
  • Required access: Valid authenticated user account within SillyTavern
  • Trigger point: Submission of an import request where character_name contains path traversal sequences (e.g., use of ../-style segments)
  • Why exploitation is possible: The server-side logic uses user-supplied character_name directly when constructing filesystem paths, without canonicalization, strict whitelisting, or enforcement of a fixed root directory, enabling traversal outside the intended chats directory.

Why this happens

The root cause is improper restriction of a pathname to a limited directory (CWE-22), compounded by inadequate control over resource names used for file creation or modification (CWE-73).

The application treats character_name as a benign label but directly interpolates it into filesystem paths for chat storage, failing to:

  • Normalize and canonicalize the resulting path
  • Reject traversal tokens and absolute paths
  • Enforce that the final resolved path remains under the designated chats directory

This insecure pattern allows attackers to influence where files are written, turning a routine import operation into a primitive for arbitrary file placement or overwrite.

Potential impact

  • Creation of attacker-controlled files in arbitrary writable locations on the host filesystem
  • Overwriting of existing application or configuration files that are writable by the SillyTavern process
  • Planting of scripts, configuration fragments, or other artifacts that could later be executed or loaded by other processes
  • Interference with SillyTavern data integrity, including corruption or manipulation of other users' chat histories
  • In some environments, potential escalation into remote code execution if written files are later interpreted as code or loaded by privileged components

General mitigation guidance

Effective mitigation focuses on constraining filesystem operations to a well-defined, trusted directory and treating all path-related input as untrusted:

  • Resolve all user-influenced paths against a fixed base directory and verify, after canonicalization, that the final path still resides within that directory.
  • Reject any input containing path separators, traversal tokens, or characters not explicitly allowed by a strict whitelist for character_name.
  • Use dedicated APIs or helper utilities for safe path joining that are designed to prevent directory traversal.
  • Store files using server-generated identifiers (e.g., UUIDs) and maintain a mapping from logical names to internal paths, rather than embedding user input directly into filenames.
  • Run the SillyTavern process under a low-privilege account with restricted write permissions, limiting the blast radius of any unexpected file writes.

How teams detect issues like this

Detection can combine code-centric and operational techniques:

  • Static analysis: Search for file and directory operations where user-controlled values (such as character_name) are concatenated or joined into paths without validation or canonicalization; enforce rules around use of safe path-joining utilities and checks that enforce a fixed root.
  • Code review: Pay special attention to endpoints that perform import/export, backup, logging, or file upload, verifying that any user-supplied path segments are sanitized and constrained to specific directories.
  • Runtime monitoring: Instrument the application or host to log file writes that occur outside expected directories, and alert on unusual write patterns originating from the SillyTavern process.
  • Policy enforcement: Incorporate secure coding guidelines for filesystem access into CI/CD, including automated checks for directory traversal patterns and discouraged direct string concatenation for paths.

Sources

SourceLink
github.comgithub.com/SillyTavern/SillyTavern/releases/tag/1.17.0
github.comgithub.com/SillyTavern/SillyTavern/security/advisories/GHSA-xvww-xhx6-22pf

Frequently asked

questions

Yes. Any user who can access the /api/chats/import endpoint over the network and is authenticated to SillyTavern can attempt to exploit this issue, subject to the deployment's access controls and network exposure.

No system-level privileges are required beyond a normal authenticated SillyTavern account. However, the ultimate impact is bounded by the filesystem permissions of the SillyTavern process; the attacker can only affect locations that process can write to.

The most robust fix is to decouple user input from raw filesystem paths: generate internal-safe filenames (e.g., random IDs), enforce canonicalization and root-directory checks for any path derived from input, and reject or normalize disallowed characters and traversal tokens in user-supplied fields.

Adopt a standard pattern for file access that always:

  • Resolves paths against a fixed base directory,
  • Validates the canonical path is within that directory,
  • Avoids direct string concatenation for paths,
  • And is covered by automated tests and static checks focused on directory traversal.

Embedding these rules into coding standards and automated tooling makes it less likely for similar issues to reappear.

Find out what's already
exploitable in your codebase.