Summary
Gopeed through version 2.0.0-beta.3 contains a path traversal vulnerability in its archive extraction process. A malicious archive may cause files to be written outside the intended extraction directory when a user downloads and extracts it with AutoExtract enabled.
Affected context
The vulnerability occurs in Gopeed's archive extraction workflow when AutoExtract is enabled. It becomes risky when an attacker can provide or influence an archive that is later processed by the application and archive entry paths are not fully constrained to the designated extraction directory.
Exploit preconditions
- Attack surface: Archive download and automatic extraction functionality
- Required access: Ability to provide, host, or influence an archive that a Gopeed user downloads
- Trigger point: Extraction of archive entries while AutoExtract is enabled
- Why exploitation is possible: Malicious entry names containing traversal patterns can bypass insufficient path validation and resolve outside the intended destination
Why this happens
The underlying bug is inadequate validation of archive member paths before file creation. If extraction logic checks path names without canonicalizing them and verifying that the resolved destination remains within the extraction directory, traversal sequences may escape the intended boundary. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.
Potential impact
- Attackers may write arbitrary files outside the extraction directory
- Existing files may be overwritten or altered
- Application configuration or user data could be modified
- A successful file write could enable further compromise, depending on permissions and file locations
- Integrity of downloaded content and the host environment may be affected
General mitigation guidance
Mitigation generally focuses on treating archive member names as untrusted input and enforcing a destination boundary before writing files.
Common defensive patterns include:
- Canonicalizing and normalizing each archive entry path before use
- Rejecting absolute paths, traversal components, and paths that resolve outside the extraction root
- Using extraction libraries or APIs that enforce directory containment by default
- Keeping automatic extraction disabled unless the source and archive contents are trusted
- Extracting with a dedicated low-privilege account and restricting filesystem permissions
- Applying filesystem isolation and limiting write access to only the required destination
How teams detect issues like this
Organizations can identify related risks through:
- Static analysis rules for archive extraction followed by direct filesystem writes
- Code review checks for missing canonicalization and extraction-root containment validation
- Tests using archive entries with normalized, absolute, and traversal-containing paths
- Runtime monitoring for writes outside approved download or extraction directories
- Policy enforcement that requires trusted-source controls before automatic extraction is enabled
- Automated security review tools that flag archive path handling and unrestricted file operations

