Skip to main content

Bounty leftover Part #1

One of the most important thing of anyone keen about security is to keep up to date with what is going on...
Hence I have a good collection of rss feed security's related.
One post that caught my attention a couple of months ago was this one from Stephen Sclafani. In a nutshell he was able to get a more than decent bounty of 20000$ exploiting some old Facebook API that is the precursor of Facebook's OAuth implementation.
Since I am a curious person I decided to give a look at these old APIs just to see the evolution of security over time. I was not hoping to find anything interesting under the bounty point of view since Stephen had found them all (he even did a second blog post collecting another 20000$!!).
Well, indeed I was right until some extent. I haven't found anything interesting under the security point of view (strictly speaking) nevertheless I was able to find a minor security issue (Information disclosure) that got rewarded by Facebook with a bounty... :)
Indeed http://api.facebook.com/restserver.php leaked some information about if a specific user has some application (https://developers.facebook.com/apps) installed or not.
Let's assume for example I would like to know if Mark Zuckerberg has some application installed or not. All I needed to know is the user id of Mark Zuckerberg and the app id.
Both those information are easily to get and kind of public.
The user id of Mark Zuckerberg is 4.
Now let's try to test if he has on of my application installed (Of course I would not have :)). The app id of my application is 213814055461514.
This information was easily reachable using the endpoint http://api.facebook.com/restserver.php.
To make a call an application makes a GET or POST request to the REST API endpoint:

POST https://api.facebook.com/restserver.php

method={METHOD}&api_key={API_KEY}&session_key={SESSION_KEY}&...&sig={SIGNATURE}

Now for our scenario we can ignore the parameter sig and focus on the session_key.
This is indeed (also, probably for backward compatibility) on the form -USER_ID

So If I tried to do

https://api.facebook.com/restserver.php?api_key=213814055461514&session_key=RANDOMDATA-4&method=bookmarks.get

I got back

<error_response xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd"><error_code>102</error_code><error_msg>The user has not authorized application 213814055461514.</error_msg><request_args list="true"><arg><key>api_key</key><value>213814055461514</value></arg><arg><key>session_key</key><value>RANDOMDATA-4</value></arg><arg><key>method</key><value>bookmarks.get</value></arg></request_args></error_response>


This of course proof the fact Mark Zuckenberg doesn't have this installed.
Let's see if I do have this installed (of course I do :)). My user id is 631367016.

So https://api.facebook.com/restserver.php?api_key=213814055461514&session_key=RANDOMDATA-631367016&method=bookmarks.get

result was

<error_response xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd"><error_code>102</error_code><error_msg>The session has been invalidated because the user has changed the password.</error_msg><request_args list="true"><arg><key>api_key</key><value>213814055461514</value></arg><arg><key>session_key</key><value>RANDOMDATA-631367016</value></arg><arg><key>method</key><value>bookmarks.get</value></arg></request_args></error_response>

So this tells me I have this application installed.
This worked for any user_Id / app_id combination.
Now as Egor Homakov showed sometime ago (using a different technique based on using Content-Security-Policy for evil) using 100-500 most popular Facebook clients we can build sort of user's fingerprint: what apps you authorize and what websites you frequently visit.As mentioned Facebook rewarded me for this and I am once more in the Facebook white hat page
Given the success of this I have decided to give a look to the way Google used to authorize applications on a pre-OAuth world and guess what ? :) I found an issue also there and Google also rewarded me. But I am afraid (since Google did not completely fix the issue) you have to wait for my next post Bounty leftover Part #2 :)

Comments

Popular posts from this blog

Critical vulnerability in JSON Web Encryption (JWE) - RFC 7516

tl;dr if you are using go-jose, node-jose, jose2go, Nimbus JOSE+JWT or jose4j with ECDH-ES please update to the latest version. RFC 7516 aka JSON Web Encryption (JWE) hence many software libraries implementing this specification used to suffer from a classic Invalid Curve Attack. This would allow an attacker to completely recover the secret key of a party using JWE with Key Agreement with Elliptic Curve Diffie-Hellman Ephemeral Static (ECDH-ES), where the sender could extract receiver’s private key.

Premise
In this blog post I assume you are already knowledgeable about elliptic curves and their use in cryptography. If not Nick Sullivan's A (Relatively Easy To Understand) Primer on Elliptic Curve Cryptography or Andrea Corbellini's series Elliptic Curve Cryptography: finite fields and discrete logarithms are great starting points. Then if you further want to climb the elliptic learning curve including the related attacks you might also want to visit https://safecurves.cr.yp.to…

Slack SAML authentication bypass

tl;dr  I found a severe issue in the Slack's SAML implementation that allowed me to bypass the authentication. This has now been solved by Slack.
Introduction IMHO the rule #1 of any bug hunter (note I do not consider myself one of them since I do this really sporadically) is to have a good RSS feed list.  In the course of the last years I built a pretty decent one and I try to follow other security experts trying to "steal" some useful tricks. There are many experts in different fields of the security panorama and too many to quote them here (maybe another post). But one of the leading expert (that I follow) on SAML is by far Ioannis Kakavas. Indeed he was able in the last years to find serious vulnerability in the SAML implementation of Microsoft and Github. Usually I am more an "OAuth guy" but since both, SAML and OAuth, are nothing else that grandchildren of Kerberos learning SAML has been in my todo list for long time. The Github incident gave me the final…

CSRF in Facebook/Dropbox - "Mallory added a file using Dropbox"

tl;dr  Facebook Groups offers the option to upload files directly from the Dropbox account. This integration is done using the OAuth 2.0 protocol and suffered from a variant of the classic OAuth CSRF (defined by Egor Homakov as the the Most Common OAuth2 Vulnerability),  see video below:



Introduction  Facebook Groups offers the option to upload files directly from the Dropbox account:


This will allow to surf via browser the Dropbox account 


and post a specific file to the group.  This integration is done using a variant of the OAuth 2.0 protocol seen in this blog many many times. But once more, OAuth is an access delegation protocol standardized under the IETF umbrella. A typical OAuth flow would look like:
Usually the client initiates the OAuth flow in the following way:

then after that the resource owner has authorized the client the authorization server redirects the resource owner back to the client with an authorization code:
Then the OAuth dance continues....
Facebook/Dropbox i…