diff --git a/Reverse Tab Nabbing.md b/Reverse Tab Nabbing.md new file mode 100644 index 0000000..9f1da88 --- /dev/null +++ b/Reverse Tab Nabbing.md @@ -0,0 +1,84 @@ +# Reverse Tab Nabbing +In a situation where an attacker can control the `href` argument of an ` + + +### Without back link + +Link between parent and child pages when prevention attribute is used: + + + +## How to exploit +Create the following pages in a folder and run a web server with `python3 -m http.server` + +Then, access `http://127.0.0.1:8000/vulnerable.html`, click on the link and note how the original website URL changes. + +```html +vulnerable.html + + + +

Victim Site

+Controlled by the attacker + + +``` + + +```html +malicious.html + + + + + + +``` + + +```html +malicious_redir.html + + + +

New Malicious 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. +* `opener.top`: Returns the topmost browser window. + +If the domains are the same then the malicious site can access all the properties exposed by the [window](https://developer.mozilla.org/en-US/docs/Web/API/Window) javascript object reference. + +## Prevention +Prevention information are documented into the [HTML5 Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/HTML5_Security_Cheat_Sheet.html#tabnabbing). + + + + + + +