GHSA-9pf5-hg6p-4pwp: Medium severity npm/electron vulnerability
Impact For serial-port and media (camera / microphone) permission checks made from an iframe, the requestingOrigin passed to session.setPermissionCheckHandler was the top-level frame's origin rather than the requesting frame's. Origin-based handler logic could therefore grant a cross-origin iframe device access intended only for the top-level origin.
Apps are only affected if they use setPermissionCheckHandler with origin-based logic and embed cross-origin iframes with delegated device permissions. Apps that base the decision on details.securityOrigin, or that do not embed such iframes, are not affected.
Workarounds Check details.securityOrigin instead of requestingOrigin for these permissions, or do not delegate device permissions to untrusted iframes.
Fixed Versions 42.0.0-beta.1 41.2.0 40.9.0 39.8.7
For more information If you have any questions or comments about this advisory, email Electron at security@electronjs.org
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/electronto a version that resolves this vulnerability.Fixed in 42.0.0-beta.1 - Upgrade
Upgrade
npm/electronto a version that resolves this vulnerability.Fixed in 41.2.0 - Upgrade
Upgrade
npm/electronto a version that resolves this vulnerability.Fixed in 40.9.0 - Upgrade
Upgrade
npm/electronto a version that resolves this vulnerability.Fixed in 39.8.7 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 39.8.7 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 40.9.0 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 41.2.0 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 42.0.0-beta.1 - Configuration
Update your origin-based permission handler logic in session.setPermissionCheckHandler to check details.securityOrigin instead of requestingOrigin, to prevent granting cross-origin iframes access intended only for the top-level origin.
Electron session.setPermissionCheckHandler Origin check logic (details.securityOrigin vs requestingOrigin) = Use details.securityOrigin instead of requestingOrigin - Configuration
Avoid embedding/delegating device permissions to untrusted cross-origin iframes that could use origin-based handler logic.
Electron device permission delegation to iframes Delegated device permissions to untrusted iframes = Do not delegate device permissions to untrusted iframes - Compensating control
As a workaround/mitigation, do not delegate device permissions to untrusted cross-origin iframes; ensure permission checks for iframe-originated serial-port and media (camera/microphone) access are based on details.securityOrigin (and not the top-level frame origin passed as requestingOrigin).