Tuesday, 21 August 2012

No XFO? It's time for Facebook Clickjacking


This post is the summary of the clickjacking bugs I reported for Facebook bug bounty program. All these bugs discussed here are now fixed. Attacker was able to add any malicious facebook app with any permissions to victims account just by one click. Vulnerable pages discussed below were lacking Anti-Clickjacking Protection such as X-Frame-Options header which renders the vulnerable page in iframe (invisible).

First bug I found was in permissions.request dialog on Facebook Mobile site. This dialog was used to add Facebook apps to authenticated user. A single click on "Allow" button would add the app to victim facebook profile.

The vulnerable link, which adds "Graph API Explorer" app, was:

http://m.facebook.com/dialog/permissions.request?app_id=145634995501895&display=wap&next=http%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer%2Fcallback&response_type=code&fbconnect=1

Here "display" parameter was used to decide the apperance of the page based on values supplied. It has 3 values: page, wap & touch. Page display was mainly used in Facebook main site and wap & touch was for Facebook mobile site.

The next bug was the variation of the previous bug where the permissions.request dialog page was able to render in iframe with "display=wap" parameter. With this parameter, the page looks like Mobile facebook page in Facebook main site which was lacking the clickjakcing protection at that time. The vulnerable page for this was:

https://www.facebook.com/dialog/permissions.request?app_id=113556445341048&redirect_uri=http%3A%2F%2Fapps.facebook.com%2Fiastrology%2F%3Finstalled%3D1&display=wap&response_type=code&canvas=1&perms=user_birthday%2Cfriends_birthday%2Cemail

Till this I learned new things about these dialogs and was able to add any permissions to the app.

The last bug was about oauth dialog. This was again from Facebook Mobile site. The vulnerable page was:

https://m.facebook.com/dialog/oauth?client_id=380424275310198&redirect_uri=http%3A%2F%2Fwlcm.info%2Fbday%2Fh%2Fmain.php&state=13629742989dab8ab4e9681582a6fb2c&scope=status_update%2Cpublish_stream%2Cuser_birthday&response_type=code

Sadly this bug didn't win any bounty as Facebook said "This can't be protected with X-Frame-Options because it needs to be servable in an arbitrary iframe.".

Well, I developed my own process to find such bugs which helps me to identify them quickly.

All of these bugs will result in adding malicious app with unwanted permissions to victim's account only with single user click. These permissions includes access to email, status message and many other things.

Here is a small demonstration:



That's all. Hope you like this post. Suggessions, comments are welcome.

1 comment:

  1. nice catch.
    despite it needs to be served in arbitary iframe it still needs some protection. I think there should be a confirmation window when clikc allow(prompt), which cannot be invisible.

    ReplyDelete