Summary
A path traversal issue in SillyTavern's /api/extensions/delete endpoint allows a crafted extensionName of "." to bypass filename sanitization and trigger recursive deletion of the entire user extensions directory.
In default configurations where the API is exposed without authentication, a remote attacker can send an unauthenticated POST request and remove all installed extensions, leading to data loss and service disruption.
Affected context
The vulnerability manifests in SillyTavern instances that:
- Expose the
/api/extensions/deleteHTTP endpoint - Rely on
extensionNameto select which extension to delete - Use filename sanitization but fail to treat
"."(current directory) as a special case - Run in the default or otherwise unauthenticated configuration
In this context, requests can cause deletion of the full extensions directory tree when "." is accepted and resolved as the directory path itself.
Exploit preconditions
- Attack surface: HTTP POST endpoint
/api/extensions/delete - Required access: Network reachability to the SillyTavern instance; no authentication required by default
- User interaction: None, beyond the attacker's own crafted HTTP request
- Trigger point: Supplying
extensionName: "."(or equivalent input) in the POST body so that server-side logic interprets it as the extensions root directory - Why exploitation is possible: The input validation only checks for malformed filenames but does not forbid
"."or normalize and constrain the path to a specific subdirectory, allowing deletion logic to operate on the directory rather than a single file
Why this happens
This vulnerability stems from improper restriction of user-controlled path input within file-system operations.
Although SillyTavern employs a sanitize-filename mechanism, it fails to treat "." as a potentially dangerous value in the context of directory operations.
When "." is resolved by the underlying filesystem API, it refers to the current working directory, leading the deletion routine to recursively delete the entire extensions directory instead of a single named extension.
This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where user-supplied data is not correctly constrained to the intended directory scope.
Potential impact
- Deletion of all user-installed extensions within the extensions directory
- Loss of custom configuration and extension-specific data
- Service disruption until extensions are reinstalled or restored from backup
- Potential loss of user trust due to unexpected data loss
General mitigation guidance
Mitigation focuses on strictly constraining file and directory operations to a well-defined path scope and hardening the API surface:
- Treat
".","..", empty strings, and path-like constructs as invalid values for identifiers such asextensionName - Resolve and normalize all paths, then enforce that the target lies strictly within the designated extensions directory before performing deletions
- Use a whitelist-based model for deletable targets, where
extensionNameis matched against known extension identifiers rather than raw filesystem names - Apply least-privilege permissions to the runtime so that the process can only modify the minimal set of directories required
- Require authentication and, where appropriate, authorization for administrative operations like extension deletion
These patterns reduce the risk of unintended directory-wide deletions even if input validation is later modified or bypassed.
How teams detect issues like this
Effective detection strategies generally combine code-centric and operational views:
- Static analysis and code review:
- Flag any endpoint that maps user input directly or indirectly into file deletion or recursive directory operations
- Look for calls to
rm -rf,fs.rmdir,fs.rm, or equivalent directory-removal APIs where the path includes user-controlled components - Verify that any path normalization is followed by a strict check enforcing the target directory boundary
- Policy-based controls:
- Enforce internal coding guidelines that require explicit checks against
".","..", and path separators for identifier-like parameters - Integrate secure file-handling patterns into shared utilities and require their use instead of ad-hoc filesystem logic
- Runtime and logging:
- Log all extension deletion operations, including caller origin, parameters, and resolved target paths
- Monitor logs or telemetry for anomalous bulk deletions or repeated deletion of the root extensions directory
Automated code review tools and CI-integrated linters can be configured to highlight high-risk filesystem patterns, helping maintainers catch similar vulnerabilities before release.

