CVE-2020-15174 Overview
A security bypass vulnerability exists in Electron that allows the will-navigate event to be circumvented when a sub-frame performs a top-frame navigation across sites. The will-navigate event is a critical security mechanism that applications use to prevent navigations to unexpected destinations. By exploiting this flaw, attackers can bypass navigation restrictions implemented by Electron applications, potentially leading to unauthorized redirects or content manipulation.
Critical Impact
Attackers can bypass application-level navigation security controls by leveraging cross-site top-frame navigations from embedded sub-frames, potentially redirecting users to malicious destinations or compromising application integrity.
Affected Products
- Electron versions prior to 11.0.0-beta.1
- Electron versions prior to 10.0.1
- Electron versions prior to 9.3.0
- Electron versions prior to 8.5.1
Discovery Timeline
- 2020-10-06 - CVE-2020-15174 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2020-15174
Vulnerability Analysis
This vulnerability represents an Improper Input Validation issue (CWE-20) in Electron's navigation event handling system. Electron applications commonly rely on the will-navigate event handler to enforce navigation policies and prevent users or embedded content from navigating to unauthorized destinations. This is a fundamental security control recommended in Electron's security guidelines.
The flaw occurs when a sub-frame (such as an embedded iframe) initiates a top-frame navigation that crosses site boundaries. Under normal circumstances, the will-navigate event should intercept and allow the application to block such navigation attempts. However, due to improper handling of cross-site sub-frame initiated navigations, these events fail to trigger the security callback, allowing the navigation to proceed unchecked.
The network-based attack vector with changed scope indicates that exploitation can originate from remote content loaded within sub-frames, and the impact extends beyond the vulnerable component to affect the parent application context. The high complexity reflects the specific conditions required—the attacker must successfully load malicious content in a sub-frame and trigger a top-frame navigation.
Root Cause
The root cause lies in Electron's event propagation mechanism for navigation events. When a sub-frame attempts to navigate the top-level frame across different origins, the navigation event bypasses the normal will-navigate callback chain. This occurs because the cross-site navigation handling code path did not properly invoke the event handlers that application developers rely upon for security enforcement.
Attack Vector
An attacker can exploit this vulnerability by embedding malicious content within a sub-frame of an Electron application. When the attacker-controlled sub-frame initiates a top-level navigation to a cross-site destination, the application's will-navigate event handler is not triggered.
The attack sequence involves loading attacker-controlled content into an iframe within the Electron application. This content then executes JavaScript that triggers a top-frame navigation using methods such as setting top.location or using anchor tags with target="_top". Because the navigation crosses site boundaries and originates from a sub-frame, Electron fails to fire the will-navigate event, allowing the navigation to succeed despite any security policies the application has implemented.
Detection Methods for CVE-2020-15174
Indicators of Compromise
- Unexpected top-level navigation events in Electron applications that were not initiated by user interaction
- Sub-frames attempting to modify top.location or triggering top-frame navigations
- Navigation to unexpected external domains from within the application context
Detection Strategies
- Monitor for sub-frame content attempting top-level DOM access or navigation operations
- Implement Content Security Policy (CSP) frame-ancestors directives to control embedding behavior
- Log and audit all navigation events at the application level, comparing against expected navigation patterns
- Review application logs for navigation events that bypass expected will-navigate handler invocations
Monitoring Recommendations
- Enable verbose logging for navigation events in Electron applications to identify bypass attempts
- Deploy network monitoring to detect unexpected outbound connections from Electron applications
- Implement runtime integrity checks to verify navigation policy enforcement is functioning correctly
How to Mitigate CVE-2020-15174
Immediate Actions Required
- Upgrade Electron to version 11.0.0-beta.1, 10.0.1, 9.3.0, or 8.5.1 or later immediately
- Apply the sandbox attribute to all iframes to prevent top-frame navigation capabilities
- Review all embedded content sources and restrict to trusted origins only
- Audit application navigation policies and implement defense-in-depth controls
Patch Information
The vulnerability has been patched in Electron versions 11.0.0-beta.1, 10.0.1, 9.3.0, and 8.5.1. The fix ensures that will-navigate events are properly triggered for all navigation scenarios, including cross-site top-frame navigations initiated by sub-frames. The patch can be reviewed at the GitHub Commit. Additional technical details are available in the GitHub Security Advisory GHSA-2q4g-w47c-4674.
Workarounds
- Apply the sandbox attribute to all iframes in the application, which prevents sub-frames from performing top-frame navigations
- Implement additional navigation validation at the main process level independent of the will-navigate event
- Use webContents.on('will-frame-navigate') as a supplementary security control where available
- Restrict or disable iframe embedding entirely for sensitive application contexts
<!-- Workaround: Sandbox all iframes to prevent top-frame navigation -->
<iframe sandbox="allow-scripts allow-same-origin" src="content.html"></iframe>
<!-- For stricter security, omit allow-top-navigation -->
<iframe sandbox="allow-scripts" src="untrusted-content.html"></iframe>
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


