Tabnabbing via window.opener
A link opened in a new tab could access the original page through window.opener and redirect it to an attacker-controlled site. An attacker could use this to replace the original tab with a malicious page.
- Triaged in 6 days
- Fixed in 7 days
- Disclosed after 18 days
Hi Team, i would like to report tab nabbing issue on your domain.
#Details:
When you open a link in a new tab ( target="_blank" ), the page that opens in a new tab can access the initial tab and change it's location using the window.opener property.
#PoC:
1.Navigate to https://infogram.com/app/[userproject].
2. Provide any url as evil url. http://test.com/test.html test.html contains following code.
<html>
<script>
if (window.opener) window.opener.parent.location.replace('http://attacker.com');
if (window.parent != window) window.parent.location.replace('http://attacker.com');
</script>
blah
</html>
Also check Open link in new tab
The javascript code that does all the magic:
window.opener.location.replace(newURL);
my link will open in new tab and original tab will be replaced with attacker malicious link.
#Fix:
In order to mitigate this issue, developers are encouraged to use rel="nofollow noopener noreferrer" as follows:
<a target="_blank" class="btn external-url" href="https://evil.com" rel="nofollow noopener noreferrer"><i class="fa fa-external-link"></i>
</a>
Let me know if u have problems in reproducing the issue.
Regards, Mr.R3boot.
Attachments
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application used target="_blank" on links without adding rel="noopener" or rel="noreferrer", allowing the opened page to access window.opener.
Impact
An attacker could redirect the original tab to a malicious site, but this requires the victim to open a crafted link in a new tab.
What the attacker needed
Victim opens a crafted link in a new tab
The fix
Developers should add rel="noopener noreferrer" to links that use target="_blank".
How it was found
- Navigate to the application project page.
- Provide a URL to a page containing JavaScript that uses window.opener to redirect the original tab.
- Open the link in a new tab.
- The original tab is replaced with the attacker's page.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a link opens in a new tab, the new page can access the tab it came from and change its location. This is called tabnabbing.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.