Skip to main content

Facebook vulnerability #1.5

Update (to follow all the story see the comments below)

@Tom point taken on board (see the new post title :))... I got a lot of hypothesis about the xxxxxx part but no real solution just yet.. i hope to restore the title to 2.0 though

Apologies for all the people that thought chunck 2 was already being "discovered" if discoverable, my mistake not being enough clear. Still working on it though! :) So, stay tuned!!

Orignal article


Here we go again...
I have been playing, at this point, for a while with Facebook's security as you can see here and here. Not too seriously though, also because, as who knows me well knows, that I am far away to be a security expert. I tend to observe though, and do a bunch of questions to myself . Sometimes I am able to find an answer as in the case of this post.
I have tried to go further. Can anyone guess the email address in order to pretend to be the real account holder? The answer surprisely is YES!!! :-S
As long you have any kind of access to the wall though (this happens either if you are friends of the account holder or the account holder has the wall public). Here how to reckon it :

All you need is:

  • know how to convert a number from base 10 to base 36 (if you don't know how use this)
  • the profile_id of the account holder (available on the URL of the account holder facebook page)
  • story_id and story_type (again easily accessible from the URL on the wall)
  • the current date (yes you undestood well the current day :D, e.g. today 27/02/2010)
That all you need!! Now follow this steps:

let try to do a reverse engineer approach. This is our final goal:

c+2xxxxxx000000afwdwo0m00003c6efyz2000000afwdwo
0000000000001eu1i@reply.facebook.com

N.B. note the 6 "avoid spam" xxxxx :D

Any way lets split the email address as follow:
  1. c+2
  2. xxxxxx
  3. 000000afwdwo
  4. 0m
  5. 00003c6efyz2
  6. 000000afwdwo
  7. 000000000000
  8. 1eu
  9. 1i
  10. @reply.facebook.com
So here the magic reckon trick:

  • chunck 3 and chunck 6 come directly from my profile_id: (631367016) base10 = afwdwo base36 (adding 000000 6 zeros to arrive to 11 digits)
  • chunck 4 comes from story_type : story_type= 22 base10= 0m base36
  • chunck 5 is the story_id (again in base 36): 261600937166 in base 10= 3c6efyz2 in base36 (adding 0000 4 zeros to arrive to 12 digits)
  • chunk 8 is a counter incrementing every day (still in base 36):




  • e.g. Jan 20 (day of the post on the wall)==> 1830 base 10 = 1eu





  • Jan 21 will be iev etc
    • chunck 1,9,10 are always the same
    • chunk 7 will be the topic for my next post but for this purpose consider as a constant as above (always 000000000000, is 12 digits it is any hint ? :D)
    And chunk 2? Well I leave to you the fun to find out :D

    Well that's it. I hope I you find this interesting and I leave you with a question :

    Is base 36 enough cryptic :D? And is Facebook using this great alghoritm anywhere else?

    Cheers and stay tuned


    Comments

    TomW said…
    Without the xxxxxx part, this analysis fails to provide any exploit and would not work. The use of base-36 encoding in generating this email address is not a security feature, it's just a compression feature.
    TomW said…
    This comment has been removed by the author.
    Antonio Sanso said…
    Hi Tom, I get your point and it is fair enough. But what about if I say to you the xxxxxx is also not so random?
    TomW said…
    Then that would be a vulnerability, but that's like saying you can crack a system as long as you knew the password. Are you saying that for any email address, you can accurately generate those 6 characters? I don't see any signs in this post that that is possible, and the rest of the analysis, while interesting, doesn't impact the security of the feature without those 6 characters.
    Antonio Sanso said…
    @Tom point taken on board (see the new post title :))... I got a lot of hypothesis about the xxxxxx part but no real solution just yet.. i hope to restore the title to 2.0 though

    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 blog post I was …

    All your Paypal OAuth tokens belong to me - localhost for the win

    tl;dr  I was able to hijack the OAuth tokens of EVERYPaypal OAuth application with a really simple trick.
    Introduction If you have been following this blog you might have got tired of how many times  I have stressed out the importance of the redirect_uri parameter in the OAuth flow.
    This simple parameter might be source of many headaches for any maintainer of OAuth installations being it a client or a server.
    Accepting the risk of repeating myself here is two simple suggestions that may help you stay away from troubles (you can always skip this part and going directly to the Paypal Vulnerability section):
    If you are building an OAuth client,   Thou shall register a redirect_uri as much as specific as you can
    i.e. if your OAuth client callback is https://yourouauthclient.com/oauth/oauthprovider/callback then

    DO register https://yourouauthclient.com/oauth/oauthprovider/callbackNOT JUST https://yourouauthclient.com/ or https://yourouauthclient.com/oauth If you are still not convinced here…

    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…