CWE-1022

Use of Web Link to Untrusted Target with window.opener Access

Medium

Description

The web application produces links to untrusted external sites outside of its sphere of control, but it does not properly prevent the external site from modifying security-critical properties of the window.opener object, such as the location property.

Potential Impact

How to Fix

Architecture and Design

Specify in the design that any linked external document must not be granted access to the location object of the calling page.

Implementation

When creating a link to an external document using the <a> tag with a defined target, for example "_blank" or a named frame, provide the rel attribute with a value "noopener noreferrer". If opening the external document in a new window via javascript, then reset the opener by setting it equal to null.

Implementation

Do not use "_blank" targets. However, this can affect the usability of the application.

Detection Methods

Related Weaknesses

References

View on MITRE CWE Database →

Need Help Fixing This Vulnerability?

Our security experts can help you identify and remediate CWE-1022 vulnerabilities in your codebase.

Get Security Assessment