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

OpenSSL Key Recovery Attack on DH small subgroups (CVE-2016-0701)

Usual Mandatory Disclaimer: IANAC (I am not a cryptographer) so I might likely end up writing a bunch of mistakes in this blog post... tl;dr The OpenSSL 1.0.2 releases suffer from a Key Recovery Attack on DH small subgroups . This issue got assigned CVE-2016-0701 with a severity of High and OpenSSL 1.0.2 users should upgrade to 1.0.2f. If an application is using DH configured with parameters based on primes that are not "safe" or not Lim-Lee (as the one in RFC 5114 ) and either Static DH ciphersuites are used or DHE ciphersuites with the default OpenSSL configuration (in particular SSL_OP_SINGLE_DH_USE is not set) then is vulnerable to this attack.  It is believed that many popular applications (e.g. Apache mod_ssl) do set the  SSL_OP_SINGLE_DH_USE option and would therefore not be at risk (for DHE ciphersuites), they still might be for Static DH ciphersuites. Introduction So if you are still here it means you wanna know more. And here is the thing. In my last bl...

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://s...

The Curious Case of WebCrypto Diffie-Hellman on Firefox - Small Subgroups Key Recovery Attack on DH

tl;dr Mozilla Firefox prior to version 72 suffers from Small Subgroups Key Recovery Attack on DH in the WebCrypto 's API. The Firefox's team fixed the issue r emoving completely support for DH over finite fields (that is not in the WebCrypto standard). If you find this interesting read further below. Premise In this blog post I assume you are already knowledgeable about Diffie-Hellman over finite fields and related attacks. If not I recommend to read any cryptography book that covers public key cryptography. Here is a really cool simple explanation by David Wong : I found a cooler way to explain Diffie-Hellman :D pic.twitter.com/DlPvGwZbto — David Wong (@cryptodavidw) January 4, 2020 If you want more details about Small Subgroups Key Recovery Attack on DH I covered some background in one of my previous post ( OpenSSL Key Recovery Attack on DH small subgroups (CVE-2016-0701) ). There is also an academic pape r where we examine the issue with some more rigors. ...