O'Reilly logo

Programming Social Applications by Jonathan LeBlanc

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required