Summary
electerm contains an OS command injection vulnerability in the SFTP file-properties workflow. A malicious FTP or SFTP server may control a folder name that is incorporated into a shell command, allowing arbitrary commands to execute when a user downloads the folder and calculates its size.
Affected context
The issue occurs in electerm's SFTP file-information workflow when the application calculates the size of a downloaded folder. It is relevant when a user connects to a malicious or compromised FTP/SFTP server, downloads a crafted folder, and invokes the Properties and Calculate Size actions. The vulnerable behavior is associated with releases before the fix in 3.15.120.
Exploit preconditions
- Attack surface: Local command execution through the electerm desktop client
- Required access: The victim must connect to, or interact with, a malicious or compromised FTP/SFTP server
- Trigger point: The victim downloads a crafted folder and invokes Properties followed by Calculate Size
- Why exploitation is possible: A server-controlled folder name is inserted into a shell command without safely escaping shell metacharacters and single quotes
Why this happens
The vulnerability results from constructing a shell command by concatenating attacker-influenced filesystem data into a command string. The folder name is not treated as untrusted data when passed to the shell, allowing shell syntax embedded in that value to alter command interpretation. This is an instance of CWE-78: Improper Neutralization of Special Elements used in an OS Command.
Potential impact
- An attacker may execute arbitrary commands with the privileges of the electerm process
- Local files and credentials could be accessed or modified
- The user's workstation may be compromised
- Malware or persistence mechanisms could be installed
- Connected systems and stored session data may be exposed
General mitigation guidance
Mitigation generally focuses on removing shell interpretation from filesystem operations and reducing trust in remote names.
Common defensive patterns include:
- Use native filesystem APIs to calculate directory sizes instead of invoking a shell
- If a subprocess is unavoidable, pass arguments as an array with shell interpretation disabled
- Apply strict handling and validation to remote filenames and directory names
- Avoid string concatenation when constructing commands from external data
- Run the client with least privilege and limit access to sensitive local resources
- Restrict interaction with untrusted FTP and SFTP servers where practical
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis rules for shell execution APIs receiving concatenated or interpolated values
- Code review checks for subprocess calls involving remote filenames or archive paths
- Tests using adversarial filenames containing shell metacharacters and quote characters
- Policies requiring argument-array process execution with shell mode disabled
- Automated code review tools that flag command construction from external input

