Summary
electerm uses filenames supplied by remote systems when saving Zmodem and Trzsz transfers, allowing path traversal components to escape the directory selected by the user. A malicious SSH server or remote shell could cause files accessible to the desktop user to be overwritten when the victim accepts a transfer.
Affected context
The vulnerability occurs in electerm file-transfer workflows that receive filenames from remote systems and combine them with a user-selected download directory. It is relevant when a victim connects to an untrusted or compromised remote endpoint, accepts a Zmodem or Trzsz transfer, and the client does not constrain the resulting destination to the selected directory.
Exploit preconditions
- Attack surface: Zmodem or Trzsz file-transfer handling in the desktop client
- Required access: A remote SSH server or shell capable of supplying transfer filenames
- Victim interaction: The victim must accept the transfer and select a local save directory
- Trigger point: Destination-path construction during receipt of the transferred file
- Why exploitation is possible: Remote-supplied filenames are joined with the selected path without sufficient traversal sanitization or containment checks
Why this happens
The underlying bug is a failure to treat remote-supplied filenames as untrusted path components. Passing such names directly to path-joining logic allows traversal elements to influence the final destination instead of restricting it to the intended save directory. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.
Potential impact
- Files outside the selected download directory may be overwritten
- Sensitive user configuration or application data could be modified
- Desktop-user files may be corrupted or deleted depending on transfer behavior
- Application availability could be impaired
- Modified configuration files could enable follow-on compromise
General mitigation guidance
Mitigation typically focuses on enforcing a trusted destination boundary for every received filename.
Common defensive patterns include:
- Treating all remote-provided filenames as untrusted input
- Normalizing candidate paths and verifying they remain within the selected base directory
- Rejecting absolute paths, traversal components, and unsafe platform-specific path forms
- Generating safe local filenames rather than preserving unrestricted remote names
- Applying overwrite confirmation and limiting the client's file-system permissions
- Using a dedicated, least-privileged download location where practical
These controls reduce the impact of malicious transfer metadata even when users accept files from untrusted endpoints.
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis rules for path joins involving network- or user-controlled filenames
- Code review checks for missing canonicalization and destination-containment validation
- Tests covering relative traversal, absolute paths, alternate separators, and encoded path forms
- Policy enforcement requiring file writes to remain within approved directories
- Runtime telemetry for transfer operations that attempt writes outside configured download roots
Automated security review tools may help identify suspicious path-construction patterns, but behavioral tests are useful for validating platform-specific path handling.

