Redirecting Users Without Their Consent

One of the simplest attack vectors that may impact a user is an automatic redirection without her consent. The main issue here is that any frame can redirect any other named frame to another location automatically, meaning that the user may not be fully certain that the page that she is redirected to is the page she intended to view.

Let’s look at a practical example of this issue. Say an application that we are running is intended to load third-party code in an iframe from http://www.mybank.com, allowing users to log in to their bank accounts, see their balances, and make transfers. Since the intended content of the iframe is known, the application could automatically redirect the user to another site—say, http://www.attacker.com/stealbank—without her knowledge or input, mimicking the view and functionality of http://www.mybank.com with the intention of stealing her bank account information:

window.top.location = "http://www.attacker.com/stealbank";

This is a major phishing concern for users, as that automatic redirection can happen without the user even being aware of it.

Get Programming Social Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.