Summary
A path traversal vulnerability in electerm's recursive FTP and SFTP download handling allows a malicious server to influence where downloaded files are written. When server-supplied file or folder names are resolved without sufficient sanitization, content may be written outside the user's selected download directory.
Affected context
The issue occurs in electerm's file-transfer functionality when recursive downloads are performed over FTP or SFTP. It requires the client to connect to a server that can provide crafted file or directory names and for those names to be used in local path resolution without effective containment checks.
Exploit preconditions
- Attack surface: FTP or SFTP recursive download functionality
- Required access: The victim must connect to or download from a malicious or compromised server
- Trigger point: Processing server-supplied
file.nameorfolder.namevalues during recursive transfer - Why exploitation is possible: Untrusted names are incorporated into local paths without reliably preventing traversal outside the selected download directory
Why this happens
The underlying bug is insufficient validation and canonicalization of filesystem path components received from a remote server. Treating server-supplied file and folder names as safe input allows traversal sequences or other path manipulation to influence the destination path, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Potential impact
- Files may be written outside the intended download directory
- Existing files may be overwritten or corrupted
- User data or application configuration may be modified
- Malicious content may be placed in locations that influence later application behavior
- The incident may contribute to broader workstation compromise depending on permissions and file types
General mitigation guidance
Mitigation generally focuses on treating all remote file and directory names as untrusted and enforcing destination containment after path resolution.
Common defensive patterns include:
- Normalize and canonicalize candidate paths before writing
- Confirm that the resolved destination remains within the user-selected directory
- Reject absolute paths, traversal components, and platform-specific path escapes
- Avoid overwriting existing files by default or require explicit, protected confirmation
- Apply least-privilege filesystem permissions to the client process
- Keep downloaded content in a dedicated directory with restricted execution and access policies
- Use platform-aware path handling rather than string concatenation
How teams detect issues like this
Organizations can identify related weaknesses through:
- Static analysis rules for path joins involving network-controlled strings
- Code review checks for missing canonicalization and directory-containment validation
- Tests covering traversal sequences, absolute paths, alternate separators, and symbolic-link scenarios
- Policy enforcement requiring remote filenames to pass an approved destination-boundary check
- Runtime monitoring for downloads that create or modify files outside designated transfer directories
Automated security review tools may help flag filesystem operations that combine untrusted input with local paths.

