Summary
Perry versions before 0.5.1159 contain a path traversal flaw in how artifact names and download paths from a build server are handled.
A malicious or compromised build server can supply crafted path components that cause the client to overwrite sensitive files or expose local files to attacker-controlled locations.
Affected context
This vulnerability appears in environments where Perry connects to a build server and processes ArtifactReady WebSocket messages.
It is relevant when the client trusts server-supplied artifact_name or download_path values and writes files to locations derived from these fields.
The issue is most impactful when the running process has write access to sensitive directories or when local files can be exposed through locations reachable by an attacker.
Exploit preconditions
- Attack surface: WebSocket communication channel between Perry and the configured build server
- Required access: Ability to control or spoof the build server endpoint or the ArtifactReady messages it emits
- Trigger point: Handling of artifact_name or download_path fields when saving or exposing build artifacts on the client
- Why exploitation is possible: Server-supplied path components are accepted without sufficient normalization, validation, or restriction to an intended base directory, enabling directory traversal sequences to influence the final file path
Why this happens
The underlying bug stems from insufficient validation of file system paths derived from untrusted input.
Perry uses the artifact_name and download_path fields from ArtifactReady WebSocket messages to construct file paths without robust normalization and enforcement of a confined directory.
This corresponds to CWE-22: Improper Limitation of a Pathname to a Restricted Directory (Path Traversal), where user- or server-controlled path segments are allowed to escape the expected directory and target arbitrary locations.
Potential impact
- Overwriting configuration files or application binaries the process can write
- Planting or modifying scripts and data files used by other components
- Exposing arbitrary local files by copying them into directories accessible to the attacker
- Degrading system integrity or enabling follow-on attacks through tampered artifacts
General mitigation guidance
Effective mitigation focuses on constraining and sanitizing file system interactions derived from external inputs.
Helpful patterns include:
- Resolving and normalizing paths, then enforcing that final paths remain under a designated base directory
- Rejecting path components containing traversal sequences or absolute paths
- Using whitelists of allowed filenames or directory structures for artifacts
- Running the client with least-privilege file system permissions, limiting the impact of any file writes
- Separating untrusted artifact storage from sensitive configuration or executable paths
How teams detect issues like this
Detection typically combines code-centric and operational approaches:
- Static analysis rules that flag use of unsanitized external inputs in file path construction
- Code review checklists that require explicit path normalization and base-directory enforcement for all artifact handling logic
- Logging and monitoring for unexpected write operations outside intended artifact directories
- Policy enforcement in CI/CD to prevent merging changes that introduce direct concatenation of untrusted path segments into file operations

