Summary
Stanza can extract downloaded model and resource archives without validating member paths, allowing archive entries to escape the intended destination directory. If an attacker can influence an archive processed by a Stanza installation, files writable by the Stanza process may be overwritten, potentially enabling code execution.
Affected context
The issue occurs in Stanza deployments that download or install model and resource archives through archive-extraction paths such as stanza.download or stanza.install_corenlp. Risk depends on whether an attacker can supply or influence a processed archive and whether the Stanza process has write access outside the intended model directory.
Exploit preconditions
- Attack surface: Stanza archive download and installation workflows
- Required access: Ability to influence, replace, or otherwise cause a malicious model or resource archive to be processed
- Trigger point: Extraction of archive members into a configured destination directory
- Why exploitation is possible: Archive member paths are not sufficiently constrained to the destination directory, allowing parent-directory traversal and writes to other process-writable locations
Why this happens
The vulnerability results from extracting archive members without canonicalizing and validating their paths before writing files. When archive entries contain parent-directory traversal components, the extraction routine may resolve them outside the intended directory. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal or archive traversal.
Potential impact
- Files writable by the Stanza process may be overwritten
- Shell configuration or SSH authorization data could be modified
- Python packages or executable scripts could be replaced
- An attacker may achieve code execution under the Stanza process account
- Application integrity, model integrity, or host security could be compromised
General mitigation guidance
Mitigation generally focuses on enforcing archive extraction boundaries and reducing trust in downloaded content.
Common defensive patterns include:
- Canonicalizing each archive member path before extraction
- Rejecting absolute paths and paths that resolve outside the intended destination
- Using archive APIs or wrappers that provide traversal-safe extraction
- Applying strict integrity and authenticity checks to downloaded archives
- Restricting write permissions for the Stanza process and its runtime directories
- Running model installation workflows with least privilege and suitable filesystem isolation
- Separating downloaded model data from shell, SSH, package, and executable paths
How teams detect issues like this
Organizations can identify archive traversal risks through:
- Static analysis rules for direct use of archive extraction APIs without member-path validation
- Code review checks for
ZipFile.extractalland equivalent functions handling untrusted archives - Tests containing absolute paths and parent-directory traversal entries
- Runtime monitoring for writes outside approved model and resource directories
- File-integrity monitoring for changes to shell configuration, SSH authorization data, packages, and executable paths
- Policy enforcement requiring authenticated archives and sandboxed extraction workflows
Automated code review and software composition analysis tools may help surface unsafe archive-handling patterns.

