Automated Threat Modeling

Electron CVE-2026-34769: Brief Summary of Renderer Command Line Switch Injection via Hidden webPreference

A brief summary of CVE-2026-34769, a high-severity argument injection vulnerability in Electron caused by an undocumented commandLineSwitches webPreference, with patch details for four release lines and a technical analysis of the fix.

CVE Analysis

8 min read

ZeroPath CVE Analysis
ZeroPath CVE Analysis

2026-04-03

Electron CVE-2026-34769: Brief Summary of Renderer Command Line Switch Injection via Hidden webPreference
Experimental AI-Generated Content

This CVE analysis is an experimental publication that is completely AI-generated. The content may contain errors or inaccuracies and is subject to change as more information becomes available. We are continuously refining our process.

If you have feedback, questions, or notice any errors, please reach out to us.

[email protected]

Introduction

An undocumented webPreference in Electron gave attackers a way to inject arbitrary Chromium command-line switches into renderer processes, which could disable sandboxing and web security controls entirely. Thousands of desktop applications are built on Electron, including Visual Studio Code, WhatsApp, and 1Password. Hidden functionality like this is a subtle but serious class of vulnerability, and it rewards careful code review.

CVE-2026-34769 carries a CVSS 3.1 base score of 7.7 (High) and affects all Electron versions prior to 38.8.6, 39.8.0, 40.7.0, and 41.0.0-beta.8. Exploitation depends on a specific insecure coding pattern, so not every Electron application is vulnerable. That pattern, spreading external configuration objects into webPreferences, is a common JavaScript idiom that many developers reach for without a second thought.

Technical Information

Root Cause: Hidden Functionality Meets Argument Injection

CVE-2026-34769 falls under two weakness classes: CWE-88 (Improper Neutralization of Argument Delimiters in a Command) and CWE-912 (Hidden Functionality). The root cause is an undocumented commandLineSwitches key within Electron's webPreferences object. When present, this key caused arbitrary Chromium command-line switches to be appended to the renderer process's command line.

Because this feature was never publicly documented, developers had no reason to suspect that a key named commandLineSwitches carried any special meaning. The Electron documentation lists the recognized webPreferences properties, and commandLineSwitches was not among them.

The Vulnerable Pattern

The vulnerability is conditional. Applications are only affected if they construct webPreferences by spreading untrusted or external configuration objects, as in this pattern:

new BrowserWindow({ webPreferences: { ...externalConfig } })

If externalConfig comes from a file, a remote API, user input, or any other source an attacker can influence, the attacker can add a commandLineSwitches key to that object. Electron then passes the injected switches directly to the Chromium renderer process.

Applications that use a fixed, hardcoded webPreferences object are not affected.

Attack Flow

  1. Identify a target application that reads window configuration from an external source (a JSON config file, a plugin manifest, a remote settings endpoint) and spreads that data into webPreferences.

  2. Inject a commandLineSwitches key into the external configuration. Its value would hold Chromium switches that disable security controls, such as the ones that turn off the renderer sandbox or web security enforcement.

  3. Trigger the configuration load. The user opens the application, loads the malicious configuration file, or activates the plugin, and the application constructs a BrowserWindow with the tainted webPreferences.

  4. The renderer process launches with the attacker's switches appended to its command line, effectively running outside the sandbox or with web security disabled.

  5. Exploit the weakened renderer. With sandboxing disabled, the attacker's code in the renderer can access system resources, read local files, or escalate further, depending on the application's architecture and the specific switches injected.

CVSS Vector Analysis

The CVSS 3.1 vector is AV:L/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H. A few metrics stand out.

Attack Vector: Local. The attacker needs to supply a local configuration file or influence the configuration source. This is not a remote, zero-click exploit.

Attack Complexity: High. Exploitation depends on how the target application is implemented. The attacker must understand how it loads and applies its configuration.

Scope: Changed. This is the critical metric. The attack escapes the renderer sandbox, so the impact extends beyond the vulnerable component (the renderer) into the broader system context.

Confidentiality, Integrity, Availability: All High. A full sandbox bypass leads to total compromise of the application context.

The Underlying Architectural Problem

The vulnerability also exposed a deeper architectural issue. Electron was conveying per-window webPreferences values to the renderer as process-wide command-line switches, so all WebContents sharing a renderer process inherited the same values, regardless of their individual webPreferences settings. The commandLineSwitches injection was the most dangerous result of this design, but the pattern was fragile on its own.

Patch Information

The Electron team addressed CVE-2026-34769 with coordinated fixes across four supported branches, documented under GitHub Security Advisory GHSA-9wfr-w7mm-pc7f.

Release LinePatched VersionNotes
38.x38.8.6Released March 10, 2026. This branch has reached end of support.
39.x39.8.0Released April 1, 2026
40.x40.7.0
41.x41.0.0-beta.8

Two-Pronged Fix

First, Electron removed the undocumented commandLineSwitches webPreference entirely, which eliminated the hidden attack surface. Second, the team refactored away the broader pattern of translating webPreferences into process-wide command-line switches.

A key related commit is in PR #50122 (by MarshallOfSound, merged March 9, 2026 to main), which was backported to the 38.x branch via PR #50163 (commit e17eef4d). This change targets the nodeIntegrationInWorker preference, which Electron previously conveyed as a --node-integration-in-worker command-line switch. The fix removed that switch and instead plumbed the value through Blink's WorkerSettings on a per-frame basis.

In shell/browser/web_contents_preferences.cc, the code that appended the flag to the renderer's command line was deleted:

- if (node_integration_in_worker_) - command_line->AppendSwitch(switches::kNodeIntegrationInWorker);

In shell/common/options_switches.h, the switch constant itself was removed:

- // Command switch passed to renderer process to control nodeIntegration. - inline constexpr base::cstring_view kNodeIntegrationInWorker = - "node-integration-in-worker";

In shell/renderer/electron_renderer_client.cc, the renderer no longer checks a global command-line flag. It reads the nodeIntegrationInWorker value from the worker's own WorkerSettings, which are copied from the initiating frame's per-frame WebPreferences when the worker is created. A new Chromium patch (feat_plumb_node_integration_in_worker_through_workersettings.patch) implements this by adding SetNodeIntegrationInWorker / NodeIntegrationInWorker accessors to Blink's WorkerSettings class and propagating the value via WorkerSettings::Copy for nested workers.

Why This Refactoring Matters

Under the old process-wide command-line switch, every WebContents sharing a renderer process inherited the same value, whatever its own webPreferences said. With the new approach, each frame and its workers follow their own configuration, and the pathway that let commandLineSwitches inject arbitrary arguments is gone.

Workaround for Teams Unable to Upgrade Immediately

If an immediate framework upgrade is not feasible, the official recommendation is to use an explicit allowlist of permitted preference keys when constructing BrowserWindow or webContents options from external configuration. When developers strictly define which keys external sources can populate, the undocumented commandLineSwitches key never reaches the renderer process.

Affected Systems and Versions

The following Electron versions are affected:

Release LineAffected VersionsFixed Version
38.xAll versions prior to 38.8.638.8.6
39.x39.0.0-alpha.1 through versions prior to 39.8.039.8.0
40.x40.0.0-alpha.1 through versions prior to 40.7.040.7.0
41.x41.0.0-alpha.1 through versions prior to 41.0.0-beta.841.0.0-beta.8

All versions prior to 38.8.6 across any Electron major release are affected. Applications are only vulnerable if they construct webPreferences from external or untrusted input without an allowlist. Applications that use a fixed, hardcoded webPreferences object are not affected.

Vendor Security History

Electron follows a strict release cadence. It targets even-numbered Chromium versions and releases every 8 weeks, in step with Chromium's 4-week release schedule. Under the project's version support policy, the Electron team supports only the latest three stable major versions, and the oldest supported release line receives only security fixes.

The v38.8.6 release included a warning that the 38.x.y line has reached end of support. Developers still on the 38.x line must upgrade to a newer major version to keep receiving critical security patches. Organizations with long-lived Electron applications, which may lag behind the framework's rapid release cadence, should take note.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization