Summary
A path traversal vulnerability in electerm's RDP clipboard file-transfer handling allows a malicious RDP server to influence where downloaded content is written. When the server-controlled filename is used without sufficient sanitization, files may be saved outside the user's selected destination directory.
Affected context
The issue occurs in electerm's RDP file-transfer functionality when an RDP server provides a clipboard download filename that is later resolved into a local filesystem path. Deployments are at risk when the client connects to an untrusted or compromised RDP server and the filename is not constrained to the intended save directory.
Exploit preconditions
- Attack surface: RDP clipboard file-transfer handling
- Required access: The attacker must control or compromise an RDP server to which electerm connects
- Trigger point: Processing and saving a clipboard-download file supplied by the RDP server
- Why exploitation is possible: The server-controlled filename is passed into path resolution without adequate traversal and destination-boundary checks
Why this happens
The underlying bug is an insufficiently constrained construction of a local filesystem path from attacker-influenced input. By using the RDP-provided filename without normalizing, validating, and verifying that the resulting path remains within the selected directory, directory traversal sequences can escape the intended destination. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Potential impact
- Attacker-controlled content may be written outside the selected save directory
- Existing files in writable locations may be overwritten
- Sensitive application or user data could be damaged
- Written files could contribute to further compromise if later trusted or executed
General mitigation guidance
Mitigation typically focuses on treating remote filenames as untrusted metadata and enforcing a destination-directory boundary before writing files.
Common defensive patterns include:
- Normalize and validate filenames before constructing local paths
- Reject absolute paths, traversal components, and platform-specific path escapes
- Resolve the final path and verify that it remains beneath the intended directory
- Generate application-controlled destination names where practical
- Use a dedicated, minimally privileged download directory
- Apply overwrite protections and explicit user confirmation for unexpected files
- Keep RDP sessions and downloaded content isolated from sensitive user locations
How teams detect issues like this
Organizations commonly detect path traversal risks through:
- Static analysis rules for filesystem APIs receiving remote or user-controlled path components
- Code review checks for filename concatenation, path resolution, and missing destination-boundary validation
- Tests using absolute paths, parent-directory components, encoded separators, and platform-specific path forms
- Runtime policies that restrict file writes to approved directories
- Monitoring for unexpected file creation or modification outside configured download locations
Automated code review and software composition analysis tools may help identify related patterns.

