CVE-2020-4075: Arbitrary file read via window-open IPC in Electron
Summary
CVE-2020-4075: Arbitrary file read via window-open IPC in Electron. Affects electron across 2 version ranges.
< 7.2.4
>= 8.0.0, < 8.2.4
Fixed in 7.2.4 or 8.2.4, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Electron is an open-source framework that allows developers to build cross-platform desktop applications using web technologies such as HTML, CSS, and JavaScript. It provides a runtime environment for creating native-like applications for Windows, macOS, and Linux. However, Electron is vulnerable to an arbitrary file read vulnerability when defining unsafe window options on a child window opened via window.open.
Vulnerability Detail
The vulnerability in Electron allows an attacker to read arbitrary local files by exploiting the unsafe window options on a child window opened via window.open. By manipulating the options of the window, an attacker can bypass security measures and gain unauthorized access to sensitive files on the user's system. This can lead to the exposure of confidential information and potential further attacks.
How To Fix
Latest published version: 45.0.0 as of 22 Oct 2026
npm install electron@45.0.0
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 7.2.47.2.4npm install electron@7.2.4 -
>= 8.0.0, < 8.2.48.2.4npm install electron@8.2.4
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
A workaround for this vulnerability is to call event.preventDefault() on all new-window events where the url or options is not expected. This will prevent the child window from opening and executing the potentially malicious code. Here is an example of how to implement this workaround in Electron:
const { app, BrowserWindow } = require('electron');
app.on('ready', () => {
const mainWindow = new BrowserWindow();
mainWindow.webContents.on('new-window', (event, url, frameName, disposition, options) => {
// Check if the URL or options are expected
if (/* URL or options are not expected */) {
event.preventDefault();
}
});
});
Conclusion
In conclusion, the arbitrary file read vulnerability in Electron can lead to unauthorized access to sensitive files on the user's system. It is crucial to update Electron to the fixed versions and implement the recommended workaround to mitigate the risk. Regularly updating dependencies and following security best practices is essential to ensure the security of Electron-based applications.
See every vulnerability recorded for electron →
FAQ
Electron is an open-source framework that allows developers to build cross-platform desktop applications using web technologies such as HTML, CSS, and JavaScript.
The vulnerability allows arbitrary local file read by defining unsafe window options on a child window opened via window.open. This can lead to unauthorized access to sensitive files on the user's system.
To fix this vulnerability, update Electron to one of the fixed versions: 9.0.0-beta.21, 8.2.4, or 7.2.4. Regularly updating dependencies and following security best practices is also recommended.
Yes, a workaround for this vulnerability is to call event.preventDefault() on all new-window events where the url or options is not expected. This prevents the child window from opening and executing potentially malicious code.
For more information, you can email security@electronjs.org or refer to the advisory at https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/07/GHSA-f9mq-jph6-9mhm/GHSA-f9mq-jph6-9mhm.json
Related vulnerabilities
Recent vulnerabilities recorded for electron.