electerm has Command Injection in File System Operations (rmrf, mv, cp)

説明

Impact

A command injection vulnerability exists in electerm's file system operations (rmrf, mv, cp) in src/app/lib/fs.js. These functions construct shell commands by interpolating file paths directly into command strings without escaping shell metacharacters.

Vulnerable functions:
- rmrf() - Uses rm -rf "${path}" (double quotes, vulnerable to " injection)
- mv() - Uses mv '${from}' '${to}' (single quotes, vulnerable to ' injection)
- cp() - Uses cp -r "${from}" "${to}" (double quotes, vulnerable to " injection)

Attack scenario:
1. Attacker controls a malicious SSH/SFTP server
2. Server lists files with shell metacharacters in names (e.g., file"$(touch /tmp/pwned)")
3. Victim connects to the server and performs file operations (remote-to-local transfer, rename on conflict, etc.)
4. The malicious filename is passed to rmrf(), mv(), or cp() without sanitization
5. Shell metacharacters break out of the quoted argument and execute arbitrary commands

Impact includes:
- Arbitrary command execution as the electerm desktop user
- Data exfiltration, malware installation, or system compromise
- Both POSIX (bash) and Windows (PowerShell) platforms are affected

Patches

  • https://github.com/electerm/electerm/commit/aa778818843b9c083bd711cd04644d102fcb5a42

Workarounds

If upgrading is not immediately possible, users can mitigate this vulnerability by:
1. Only connecting to trusted SSH/SFTP servers
2. Avoiding remote-to-local file transfers from untrusted sources
3. Not using the "rename on conflict" option when downloading folders from untrusted servers
4. Manually verifying filenames before performing file operations

基本情報

タイプ
reviewed
深刻度
high
GitHub 上のアドバイザリ
アドバイザリを開く ↗
リポジトリのアドバイザリ
リポジトリのアドバイザリを開く ↗
ソースコード
ソースを見る ↗
公開(アドバイザリ)
2026-07-02 19:22:31 UTC
更新
2026-07-02 19:22:32 UTC
GitHub レビュー済み
2026-07-02 19:22:31 UTC

EPSS Score

Score Percentile
0.07% 22.24%

CVSS Scores

Base score Version Severity Vector
8.8 3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H クリックして展開
攻撃ベクター (AV:N)
インターネットなど、ルーティングされたネットワーク越しに遠隔から悪用しうる。端末の前にいる必要はない。
攻撃の複雑さ (AC:L)
攻撃者が条件を満たせば、レース条件や珍しい構成に依存せずに再現しやすい。
必要な権限 (PR:N)
事前のログインや昇格は不要で、匿名アクセスのまま踏み台にしうる。
ユーザーの関与 (UI:R)
インストールの許可、設定変更、悪意あるファイルの実行など、人の一度の判断がトリガーになる。
スコープ (S:U)
影響は脆弱コンポーネントと同一のセキュリティ権限・信頼境界の内側に収まる。
機密性への影響 (C:H)
広範な機微データの読み取りや持ち出しが現実的。
完全性への影響 (I:H)
権限の奪取や広範なログ改竄など、システムの信頼根拠を揺るがす改ざんが現実的。
可用性への影響 (A:H)
長時間のサービス停止、データ損壊による復旧不能に近い状態など、利用者に著しい不便を与えうる。

Identifiers

CWEs

CWE id Name
CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

Credits

  • hibrian827 (finder)

Affected packages (1)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
npm electerm <= 3.11.0 3.11.11

References

cvelogic Threat Intelligence