Electron Desktop App Penetration Testing: IPC & RCE Risks
How penetration testers audit Electron desktop applications: nodeIntegration, contextIsolation, preload IPC bridges, and XSS-to-RCE escalation.
Thick Client · By Thimmagurudu Bathini, CTO · Published · 5 min read
How XSS Inside Electron Escalates to OS Execution
Electron powers cross-platform SaaS desktop clients, POS terminals, and developer tools using Chromium and Node.js. When security flags like contextIsolation are misconfigured, a single Cross-Site Scripting (XSS) bug or untrusted link inside the desktop app escalates directly into full operating-system Remote Code Execution.
new BrowserWindow({
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
sandbox: true,
preload: path.join(__dirname, 'preload.js')
}
});BrowserWindow Flags That Decide Exploitability
| Setting / Surface | Unsafe Configuration | Required Hardening |
|---|---|---|
| nodeIntegration | true (exposes require('child_process') to renderer) | Set nodeIntegration: false on all BrowserWindows |
| contextIsolation | false (preload shares global window with untrusted JS) | Set contextIsolation: true and use contextBridge.exposeInMainWorld |
| sandbox | false (renderer runs unsandboxed) | Enable sandbox: true and restrict IPC handlers strictly |
| Navigation & Popups | App opens arbitrary external links inside Electron window | Intercept will-navigate / setWindowOpenHandler and validate URLs |
Auditing Preload Scripts & ipcMain Handlers
- Unpack app.asar and audit BrowserWindow webPreferences across main and child windows.
- Review every ipcMain.handle / ipcMain.on handler for path traversal, command injection, or arbitrary file reads.
- Test markdown renderers, chat inputs, and deep links for XSS inside the renderer process.
- Verify auto-updater packages use code signing and HTTPS signature verification.
Hardening WebPreferences & Auto-Updaters
Enforce contextIsolation: true, nodeIntegration: false, and sandbox: true everywhere, and expose only narrow, validated IPC methods through contextBridge.
Audit your Electron desktop client and backend APIs starting from ₹36,000 + 18% GST. Request a scoped proposal →
Electron Security Testing Questions
Why is XSS more dangerous in Electron than in Chrome?
If nodeIntegration is enabled or contextIsolation is off, XSS inside Electron can execute local OS commands instead of staying confined to a browser tab.
Does BERRY9 test Electron apps?
Yes—Electron desktop apps are tested under our thick-client and application security practice.