Electron: Use-after-free in offscreen child window paint callback
Published 3 Apr 2026 · Updated 6 Apr 2026
Affected packages
- Affected
- <39.8.1
- Fixed in
- 39.8.1
npm install electron@39.8.1- Affected
- >=40.0.0-alpha.1 <40.7.0
- Fixed in
- 40.7.0
npm install electron@40.7.0- Affected
- >=41.0.0-alpha.1 <41.0.0
- Fixed in
- 41.0.0
npm install electron@41.0.0Details
Impact
Apps that use offscreen rendering and allow child windows via window.open() may be vulnerable to a use-after-free. If the parent offscreen WebContents is destroyed while a child window remains open, subsequent paint frames on the child dereference freed memory, which may lead to a crash or memory corruption.
Apps are only affected if they use offscreen rendering (webPreferences.offscreen: true) and their setWindowOpenHandler permits child windows. Apps that do not use offscreen rendering, or that deny child windows, are not affected.
Workarounds
Deny child window creation from offscreen renderers in your setWindowOpenHandler, or ensure child windows are closed before the parent is destroyed.
Fixed Versions
41.0.040.7.039.8.1
For more information
If there are any questions or comments about this advisory, please email [security@electronjs.org](mailto:security@electronjs.org)
Is GHSA-532v-xpq5-8h95 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected electron, and gives you the command that fixes it.
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.