Summary
electerm contains an OS command injection vulnerability when untrusted filenames from remote SSH or SFTP servers are interpolated into file-management commands. If a victim transfers, copies, moves, renames, or removes a file with a crafted name, the filename may be interpreted as shell syntax and execute commands with the desktop user's privileges.
Affected context
The vulnerability occurs in electerm's file-management functions when remote filenames are incorporated into commands for recursive removal, moving, or copying. It can affect POSIX and Windows environments when a malicious SSH or SFTP server supplies a filename containing shell-significant characters and the victim performs an operation that processes that filename.
Exploit preconditions
- Attack surface: Remote-to-local SSH or SFTP file-transfer and file-management workflows
- Required access: A connection to, or interaction with, a malicious or compromised remote server, plus the victim's ability to initiate or accept the relevant file operation
- Trigger point: Processing a remote filename during transfer, conflict renaming, copying, moving, or removal
- Why exploitation is possible: The filename is inserted into an operating system command without reliably separating data from command syntax
Why this happens
The underlying bug is unsafe construction of operating system commands through string interpolation of untrusted file paths. When filenames are concatenated into shell commands or platform command strings, quote characters and metacharacters can change the command's interpretation rather than remain ordinary data. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because attacker-controlled input reaches a command interpreter without adequate separation or neutralization.
Potential impact
- Arbitrary commands may execute with the electerm desktop user's privileges
- Local files could be modified, copied, moved, or deleted
- Sensitive information could be exfiltrated
- Malware could be installed or additional persistence could be established
- The workstation could experience denial of service or broader compromise
General mitigation guidance
Mitigation generally focuses on preventing untrusted filenames from becoming command syntax.
Common defensive patterns include:
- Prefer direct filesystem APIs and argument-array process interfaces over shell command construction
- Avoid invoking command interpreters for routine copy, move, and removal operations
- Apply platform-appropriate path handling while treating remote filenames as untrusted data
- Enforce strict validation and canonicalization rules without relying on filtering alone
- Run the desktop application with least privilege and limit access to sensitive files
- Use sandboxing or capability restrictions where practical to reduce the effect of command execution
- Maintain clear trust boundaries between remote server metadata and local filesystem operations
How teams detect issues like this
Detection can focus on code paths that construct shell or platform commands from filenames or paths.
Useful approaches include:
- Static analysis for string interpolation, concatenation, or formatting passed to shell execution APIs
- Code review checks for file paths originating from SSH, SFTP, or other remote sources
- Searches for command templates used with removal, copy, move, or recursive filesystem operations
- Testing with filenames containing quoting and shell-significant characters in isolated environments
- Policy enforcement requiring direct filesystem APIs or safely separated process arguments
- Runtime monitoring for unexpected child processes spawned by the desktop client
Automated code review and software composition analysis tools may help identify related command-construction patterns.

