-
Notifications
You must be signed in to change notification settings - Fork 0
Real‐world Example of a Tab Nabbing Attack
Share a real-world example or case study of a tab nabbing attack to illustrate the importance of rel="noopener noreferrer"
. Explain how the attack was carried out, its impact, and how it could have been prevented with the correct use of this attribute.
Imagine Sarah, a user, is browsing her favorite social media platform. She opens a link to an interesting article in a new tab. While reading the article, she gets distracted and switches to another tab. Meanwhile, the malicious website she opened earlier quietly changes its content to mimic a login page for the social media platform. Sarah, thinking it’s a legitimate login page, enters her credentials. [Unfortunately,](https://www.freecodecamp.org/news/what-is-tabnabbing/).
Tabnabbing attacks exploit a vulnerability in the same-origin policy, which isolates different websites from each other. Here are the common ways this attack can occur:
-
Malicious Page Opening a Window:
- The attacker’s website opens a new window or tab via
window.open
. - After some time, the attacker redirects the opened window to their malicious page.
- For example:
- The attacker’s website opens a new window or tab via
-
Good Site Opening a Window:
- Your website opens a new window or tab via
window.open
. - The malicious website can then get a handle to your website’s window using
window.opener
. - For example:
- Your website opens a new window or tab via
-
Links with
target="_blank"
:- If you link to a malicious website with
target="_blank"
, it opens in a new tab/window. - The linked website can refer to the previous window via
window.opener
. - For example:
- If you link to a malicious website with
-
Frames (e.g., Advertisements):
- If your website loads another website in an iframe (e.g., advertisements), the malicious website in the frame can get a handle to the parent window using
window.parent
. - For example:
- If your website loads another website in an iframe (e.g., advertisements), the malicious website in the frame can get a handle to the parent window using
To prevent tabnabbing attacks, use the rel="noopener noreferrer"
attribute when opening links in new tabs/windows. This attribute ensures that the new window/tab cannot access the original window, protecting users from potential phishing attempts. [Always](https://www.appsecmonkey.com/blog/tabnabbing).
If you have any questions or need further assistance, please feel free to contact us.
- Email: [mailto:[email protected] [email protected]]
- Phone: +27 83 380 7950
- Website: [https://www.skunkworks.africa Skunkworks Africa]
Stay connected with us through our social media channels.
- [https://www.linkedin.com/company/skunkworksza/ LinkedIn]
- [https://twitter.com/skunkworksza Twitter]
- [https://www.facebook.com/skunkworksza/ Facebook]
We welcome contributions to enhance and improve this project. Please read our [https://github.com/Skunkworks-Lab-Services/noopener-noreferrer-demo/blob/main/CONTRIBUTING.md Contribution Guidelines] before submitting any changes.
This project is licensed under the MIT License. See the [https://github.com/Skunkworks-Lab-Services/noopener-noreferrer-demo/blob/main/LICENSE.md LICENSE] file for details.