githubEdit

Tabnabbing

Tabnabbing (reverse tabnabbing) allows an attacker-controlled page to rewrite the content of a parent page, typically replacing it with a phishing site.

How It Works

  1. Victim clicks a link that opens in a new tab (target="_blank")

  2. The new page has access to window.opener (the original page)

  3. Attacker's page executes: window.opener.location = "https://phishing-site.com"

  4. Original tab silently redirects to phishing site

  5. Victim returns to original tab, sees fake login, enters credentials

Vulnerable Code Pattern

<!-- VULNERABLE: No rel attribute -->
<a href="https://attacker.com" target="_blank">Click me</a>

<!-- VULNERABLE: Empty rel attribute -->
<a href="https://attacker.com" target="_blank" rel="">Click me</a>

<!-- VULNERABLE: Only noreferrer (still allows opener access in some browsers) -->
<a href="https://attacker.com" target="_blank" rel="noreferrer">Click me</a>

Secure Code Pattern

Detection

Manual Testing

Automated Scanning

Exploitation

Basic Attack Page

Phishing Page

Delayed Attack (More Stealthy)

Attack Scenarios

Scenario
Description

Forum posts

User-submitted links with target="_blank"

Comments

Blog/article comment sections

User profiles

Profile links to external sites

Documentation

Links to external resources

Email links

Webmail rendering links

Browser Behavior

Browser
Default Behavior (2024+)

Chrome 88+

Implicitly adds noopener

Firefox 79+

Implicitly adds noopener

Safari 12.1+

Implicitly adds noopener

Edge 88+

Implicitly adds noopener

Note: While modern browsers add implicit protection, explicit rel="noopener" is still recommended for older browser support and code clarity.

window.open() Vulnerability

  • XSS - Can be used to inject malicious links

  • Phishing - Tabnabbing enables phishing

  • CSRF - Related browser security issues

Last updated

Was this helpful?