Reverse Tabnabbing

Thank you for visiting We have migrated our community to a new web platform and regretably the content for this page needed to be programmatically ported from its previous wiki page. There’s still some work to be done.

Update 2023 - this is fixed in modern, evergreen, browsers

Links that use target="_blank" now have implicit rel="noopener" in modern browsers, so this vulnerability isn’t as widespread and critical as before. This implicit rule is also a part of the HTML standard. According to evergreen browsers support implicit rel="noopener" from about 2018, but there are still some browsers out there that doesn’t support it, so please consider your userbase when/if deciding to drop rel="noopener".

Using rel="noreferrer" implies also rel="noopener", so if you have chosen to use rel="noreferrer", the use of rel="noopener" isn’t required.


Reverse tabnabbing is an attack where a page linked from the target page is able to rewrite that page, for example to replace it with a phishing site. As the user was originally on the correct page they are less likely to notice that it has been changed to a phishing site, especially if the site looks the same as the target. If the user authenticates to this new page then their credentials (or other sensitive data) are sent to the phishing site rather than the legitimate one.

As well as the target site being able to overwrite the target page, any http link can be spoofed to overwrite the target page if the user is on an unsecured network, for example a public wifi hotspot. The attack is possible even if the target site is only available via https as the attacker only needs to spoof the http site that is being linked to.

The attack is typically possible when the source site uses a target instruction in a html link to specify a target loading location that do not replace the current location and then let the current window/tab available and does not include any of the preventative measures detailed below.

The attack is also possible for link opened via the javascript function.


Link between parent and child pages when prevention attribute is not used:

Tabnabbing with back link

Link between parent and child pages when prevention attribute is used:

Tabnabbing without back link


Vulnerable page:

  <li><a href="" target="_blank">Vulnerable target using html link to open the new page</a></li>
  <button onclick="'')">Vulnerable target using javascript to open the new page</button>

Malicious Site that is linked to:

   if (window.opener) {
      window.opener.location = "";

When a user clicks on the Vulnerable Target link/button then the Malicious Site is opened in a new tab (as expected) but the target site in the original tab is replaced by the phishing site.

Accessible properties

The malicious site can only access to the following properties from the opener javascript object reference (that is in fact a reference to a window javascript class instance) in case of cross origin (cross domains) access:

  • opener.closed: Returns a boolean value indicating whether a window has been closed or not.
  • opener.frames: Returns all iframe elements in the current window.
  • opener.length: Returns the number of iframe elements in the current window.
  • opener.opener: Returns a reference to the window that created the window.
  • opener.parent: Returns the parent window of the current window.
  • opener.self: Returns the current window.
  • Returns the topmost browser window.

If the domains are the same then the malicious site can access all the properties exposed by the window javascript object reference.


Please check the first heading on this page, Update 2023, as this is now automatically prevented in all modern, evergreen, browsers. Check prevention information documented in the HTML5 Cheat Sheet.