Summary
A path traversal vulnerability in the wandb File.download function allows filenames received from a backend response to escape the intended download directory. If an attacker can control the backend response, they may overwrite files in accessible locations, potentially enabling code execution through shell startup files or Python import paths.
Affected context
The vulnerability occurs in wandb deployments that use the affected File.download functionality and trust filenames supplied by server responses. Risk increases when a backend or intermediary can influence those responses and the client process has write access to sensitive filesystem locations.
Exploit preconditions
- Attack surface: File download handling in the wandb client
- Required access: Ability to control, compromise, or influence the backend response supplying the filename
- Trigger point: Processing a downloaded file and constructing its local destination path
- Why exploitation is possible: The filename is not sufficiently validated or constrained to the intended download directory, allowing traversal components to redirect the write operation
Why this happens
The underlying bug is an improper limitation of a pathname used for file output. The File.download function accepts a server-provided filename without reliably canonicalizing it and verifying that the resulting path remains within the designated download directory. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly called path traversal.
Potential impact
- An attacker may overwrite files reachable by the wandb client process.
- The vulnerability could enable modification of shell startup files or Python import paths.
- Successful file modification may lead to code execution under the client process identity.
- Attackers may cause data loss, configuration tampering, or persistence.
- A compromised client could expose credentials, project data, or connected environments.
General mitigation guidance
Mitigation generally focuses on treating server-provided filenames as untrusted data and enforcing a strict destination boundary.
Common defensive patterns include:
- Canonicalizing candidate paths before writing and verifying they remain under the intended directory.
- Rejecting absolute paths, traversal components, and platform-specific alternate path forms.
- Deriving local filenames from trusted identifiers rather than accepting arbitrary remote names.
- Using dedicated, least-privileged download directories with restrictive permissions.
- Preventing downloaded content from being placed in executable, startup, or import-search locations.
- Applying filesystem isolation and avoiding write access to sensitive user or system files.
How teams detect issues like this
Organizations can look for path-handling risks through:
- Static analysis rules that flag path construction from network-controlled strings.
- Code review checks for missing canonicalization and destination-boundary validation.
- Tests covering absolute paths, traversal markers, encoded separators, and platform-specific path behavior.
- Runtime monitoring for client processes writing outside approved download directories.
- Policy enforcement requiring untrusted filenames to pass an approved path-validation utility.
Automated code review and software composition analysis tools may help identify related patterns.

