Thursday 14 November 2013

Facebook Open URL Redirection Vulnerability

About a week ago, I discovered an open url redirection vulnerability in Facebook that allowed me to have a link redirect to any website without restrictions.

The flaw exists in the way facebook handled the url parameter. Visiting the link below would always redirect to the facebook homepage:

But I noticed that changing the url to a random string, for example:

The link above generated a unique "h" variable and passed the url parameter to Facebook's Linkshim:

So how do you bypass the restrictions and load arbitrary links? You simply remove the http:// part of the target destination and it will redirect successfully:

Facebook's Linkshim (l.php) interprets the same as thus allowing for a working redirection. As you may have read in the past, url redirection flaws in facebook and third party applications puts a user's access token at risk if that link is entered as the final destination in an Oauth dialog. But the most common use of a redirection flaw in general is the ability to convince a user to click on a trusted link which is specially crafted to take them to an arbitrary website.

However, facebook informed me that because the redirection occurs through the l.php method, they have the ability to filter and ban particular websites from redirecting using their automatic spam and malware analysis. But not all malware/spam can be caught by facebook, and by the time a link is banned, an attacker would have already moved on to another link.

Video Proof of Concept:

(Best Viewed in HD)

Facebook responded the day after my report, and they were quick to patch the flaw in about a week and a half. The payout for this bug is $1,000.

~Dan Melamed


  1. There is a type mistake in the title, please change Vulnerabiity with Vulnerability

    1. I didn't even notice. Thanks for letting me know, I must have written it too fast.


About Me

I'm a security researcher. You can follow me on twitter @danmelamed


Media Inquiries:

Questions or Comments