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 :)
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
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