CVE-2026-43940: electerm: Path traversal in electerm runWidget leads to arbitrary code execution
Impact The runWidget function in src/app/widgets/load-widget.js constructs a file path by directly concatenating user‑supplied widget identifiers without any sanitisation:
javascript const file = widget-${widgetId}.js const widget = require(path.join(dirname, file))
Because runWidget is exposed to the renderer process via an asynchronous IPC handler with no input validation, an attacker who achieves JavaScript execution inside the renderer (for example, through a malicious plugin or a cross‑site scripting flaw in the built‑in webview) can abuse a path traversal (../) to load and execute an arbitrary JavaScript file anywhere on the victim’s filesystem. This gives the attacker local code execution with the full privileges of the electerm process, leading to complete system compromise.
Patches
Fixed in version >= 3.7.16
Workarounds Until a patch is released: - Do not install or run untrusted plugins. - Avoid loading arbitrary web content inside electerm’s embedded webview (for example, disable any features that fetch and display remote HTML). - Run electerm in a sandboxed environment (e.g., with bubblewrap on Linux, AppArmor/SELinux profiles, or Windows sandboxed app execution) to limit the impact of any code execution.
Resources - electerm GitHub Repository - electerm Security Policy - Vulnerability details originally reported by external researcher (PoC confirmed on v3.7.9, Win10).
Other sources
electerm is an open-sourced terminal/ssh/sftp/telnet/serialport/RDP/VNC/Spice/ftp client. Prior to version 3.7.16, the runWidget function in src/app/widgets/load-widget.js constructs a file path by directly concatenating user‑supplied widget identifiers without any sanitisation. Because runWidget is exposed to the renderer process via an asynchronous IPC handler with no input validation, an attacker who achieves JavaScript execution inside the renderer (for example, through a malicious plugin or a cross‑site scripting flaw in the built‑in webview) can abuse a path traversal (../) to load and execute an arbitrary JavaScript file anywhere on the victim’s filesystem. This gives the attacker local code execution with the full privileges of the electerm process, leading to complete system compromise. This issue has been patched in version 3.7.16.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/electermto a version that resolves this vulnerability.Fixed in 3.7.16 - Upgrade
Upgrade
electermto a version that resolves this vulnerability.Fixed in 3.7.16 - Compensating control
Avoid loading arbitrary web content inside electerm’s embedded webview, including disabling features that fetch and display remote HTML.
- Compensating control
Do not install or run untrusted plugins in electerm.
- Compensating control
Run electerm in a sandboxed environment, such as bubblewrap on Linux, AppArmor/SELinux profiles, or Windows sandboxed app execution.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-43940?
The severity of CVE-2026-43940 is classified as critical due to the potential for arbitrary code execution.
How do I fix CVE-2026-43940?
To fix CVE-2026-43940, update electerm to version 3.7.16 or later.
What software is affected by CVE-2026-43940?
CVE-2026-43940 affects electerm versions prior to 3.7.16.
What is path traversal in the context of CVE-2026-43940?
Path traversal in CVE-2026-43940 refers to the vulnerability that allows an attacker to access files and directories outside the intended directory.
What components of electerm are involved in CVE-2026-43940?
The runWidget function in electerm's load-widget.js file is primarily involved in CVE-2026-43940.