Packages / electron / Security
Electron context isolation bypass via nested unserializable return value
Affected releases · electron
- 24.x24.0.0Fixed in 24.1.0
- 23.x23.0.0 – 23.2.2Fixed in 23.2.3
- 22.x22.0.0 – 22.3.5Fixed in 22.3.6
- 21.x and older0.1.0 – 21.4.4No fix, no longer updated
On 24.x, the newest line:
npm install electron@24.1.0Not affected
45.0.0
1 release, latest
Affected
24.0.0
1 release
Fixed
24.1.0 – 24.8.8
28 releases
Affected
23.0.0 – 23.2.2
9 releases
Fixed
23.2.3 – 23.3.13
16 releases
Affected
22.0.0 – 22.3.5
13 releases
Fixed
22.3.6 – 22.3.27
20 releases
Affected
21.0.0 – 21.4.4
18 releases
Affected
20.0.0 – 20.3.12
23 releases
Affected
19.0.0 – 19.1.9
28 releases
Affected
18.0.0 – 18.3.15
25 releases
Affected
17.0.0 – 17.4.11
20 releases
Affected
16.0.0 – 16.2.8
22 releases
Affected
15.0.0 – 15.5.7
24 releases
Affected
14.0.0 – 14.2.9
15 releases
Affected
13.0.0 – 13.6.9
29 releases
Affected
12.0.0 – 12.2.3
26 releases
Affected
11.0.0 – 11.5.0
27 releases
Affected
10.0.0 – 10.4.7
22 releases
Affected
9.0.0 – 9.4.4
22 releases
Affected
8.0.0 – 8.5.5
25 releases
Affected
7.0.0 – 7.3.3
26 releases
Affected
6.0.0 – 6.1.12
26 releases
Affected
5.0.0 – 5.0.13
14 releases
Affected
4.0.0 – 4.2.12
28 releases
Affected
3.0.0 – 3.1.13
31 releases
Affected
2.0.0 – 2.0.18
19 releases
Affected
1.3.1 – 1.8.8
79 releases
Affected
0.1.0 – 0.4.1
8 releases
Is your project affected?
Paste your package.json, or type the range you declare for electron. It is read in your browser and sent nowhere.
What happens
Impact
Apps using contextIsolation and contextBridge are affected.
This is a context isolation bypass, meaning that code running in the main world context in the renderer can reach into the isolated Electron context and perform privileged actions.
Workarounds
This issue is exploitable under either of two conditions:
If an API exposed to the main world via
contextBridgecan return an object or array that contains a JS object which cannot be serialized, for instance, a canvas rendering context. This would normally result in an exception being thrownError: object could not be cloned.If an API exposed to the main world via
contextBridgehas a return value that throws a user-generated exception while being sent over the bridge, for instance a dynamic getter property on an object that throws an error when being computed.
The app side workaround is to ensure that such a case is not possible. Ensure all values returned from a function exposed over the context bridge are supported and that any objects returned from functions do not have dynamic getters that can throw exceptions.
Auditing your exposed API is likely to be quite difficult so we strongly recommend you update to a patched version of Electron.
Fixed Versions
25.0.0-alpha.224.0.123.2.322.3.6
For more information
If you have any questions or comments about this advisory, email us at security@electronjs.org