Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

GMail Vulnerable To Contact List Hijacking

Posted by Hemos on Mon Jan 01, 2007 10:09 AM
from the in-special-circumstances dept.
Anonymous Coward writes "By simply logging in to GMail and visiting a website, a malicious website can steal your contact list, and all their details. The problem occurs because Google stores the contact list data in a Javascript file. So far the attack only works on Firefox, and doesn't appear to work in Opera or Internet explorer 7. IE6 was un-tested as of now."
+ -
story
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • by Zaphod-AVA (471116) on Monday January 01 2007, @10:12AM (#17422002)
    So is this a Firefox, Gmail, or javascript vulnerability?
    • by Stalus (646102) on Monday January 01 2007, @10:18AM (#17422044)
      Works fine in IE6. TFA states "I've tried the hack on IE7, Opera, and Firefox; it appears to be working on all three." so I'm not sure where the poster got the idea that it was Firefox only.
    • by MarkByers (770551) on Monday January 01 2007, @10:21AM (#17422072) Homepage Journal
      http://docs.google.com/data/contacts?out=js&show=A LL&psort=Affinity&callback=google&max=99999 [google.com]

      It can be exploit by writing a callback function in Javascript, that can do anything, and then passing it to the above link, which gives your function all the users contact info.
    • by Bogtha (906264) on Monday January 01 2007, @12:24PM (#17422884)

      GMail. JSON should not be used for sensitive data because any old website can reference it simply by including it as an external script. The Google developers should not have used JSON for this information, they did, and that is why this information leak exists. There are ways to protect JSON from this (e.g. nonces) but you have to actually add this security yourself, rather than relying on the browser's built-in cross-domain security like you could if you were using XML etc.

      • XML has no special cross-domain security over plain JSON.

        JSON is not the problem here. The problem was the stupid google({}) function call wrapped around the JSON in the reply. Remove that stupid function call and everything is fine. Since you cannot receive or send data via XmlHttpRequest to a domain other than the one that served up the HTML, you will not be at risk if only JSON is returned.

        The sky is falling!
        The sky is falling!
        Sheesh.
    • by buro9 (633210) <david@buroCOBOL9.com minus language> on Monday January 01 2007, @01:23PM (#17423374) Homepage
      It's a problem with web services that comes from an assumption that JavaScript cross-domain security is in place.

      When you surface data via Xml web services, you can only call the web service on the domain that the JavaScript calling it originates from. So if you write your web services with AJAX in mind exclusively, then you have made the assumption that JavaScript is securing your data.

      The problem is created at two points:
      1) When you rely on cookies to perform the implicit authentication that reveals the data.
      2) When you allow rendering of the data in JSON which bypasses JavaScript cross-domain security.

      This can be solved by doing two things:
      1) Make one of the parameters to a web service a security token that authenticates the request.
      2) Make the security token time-sensitive (a canary) so that a compromised token does not work if sniffed and used later.

      The security token should be gathered by authenticating the user according to a mechanism that the user controls. Think of the way that the Flickr API asks you to grant an application access to your data.

      Anyhow, use the noscript extension in Firefox to ensure that your data is not compromised, as you will be able to choose to block the script from running, and in doing so prevent others from gaining access to your data.

      The Internet Exporer alternative is to disable JavaScript, but few people ever do this because too few sites (especially Web2.0 sites) degrade gracefully when JavaScript is disabled.
  • by CTho9305 (264265) on Monday January 01 2007, @10:14AM (#17422014) Homepage
    RTFA:
    I've tried the hack on IE7, Opera, and Firefox; it appears to be working on all three.

    Does the submitter have some agenda against Firefox?
    • "Does the submitter have some agenda against Firefox?"

      Nah, it was just a gag to get ppl to RTFA.
      • by Tim C (15259) on Monday January 01 2007, @11:29AM (#17422504)
        It works fine in my install of FF 2.0.0.1; you have to be logged in to gmail for it to work. Despite what it says in the summary, it also works in IE7 - in fact, it'll work in any browser that

        * supports cookies
        * supports loading of resources from domains other than the one the currently-loaded page is hosted on
        * supports accessing those resources

        ie pretty much all (modern) browsers.
          • Re: (Score:3, Informative)

            Strangely enough, it's no longer working for me in Firefox (2.0.0.1, WinXP); I think google may have fixed the problem. Whether it's a real fix or an obscuration I have no idea.
  • Phew! (Score:4, Funny)

    by sorrill (968643) on Monday January 01 2007, @10:16AM (#17422028)
    We are lucky it was not Microsoft's Hotmail!
  • According to the reports on Digg this hack works in all modern browsers. The real fix is probably to stop storing the contact list in a local java-script based file. (Or to always be sure to log out of Google after visiting a google page.)


    http://www.digg.com/programming/GMail_Hacked_Visit _ANY_Website_and_Your_Whole_Contact_List_Can_be_St olen [digg.com]
    • How can one page get access to another page's data? Javascript or not? Aren't pages that don't have a parent child hierarchy supposed to have no way to communicate (aside from same site cookies)? How does this work
      • by TubeSteak (669689) on Monday January 01 2007, @11:26AM (#17422472) Journal
        Here's the super simple explanation

        1. Gmail sets a cookie saying you're logged in
        2. A [3rd party] javascript tells you to call Google's script
        3. Google checks for the Gmail cookie
        4. The cookie is valid
        5. Google hands over the requested data to you

        If [3rd party] wanted to keep your contact list, the javascript would pass it to a form and your computer would happily upload the list to [3rd party]'s server.

        At no point does [3rd party] make any request to Google.
        • by dolphinling (720774) on Monday January 01 2007, @11:16AM (#17422424) Homepage Journal
          No. Cross-domain xmlhttprequests are blocked by firefox at least, and I'd suspect by other browsers as well. The point is that you don't have to do a cross-domain xmlhttprequest here, since google conveniently stores it in a separate javascript file, and that is embeddable in other pages.
    • Re: (Score:2, Insightful)

      Hopefully, one main difference between Digg and Slashdot is that the users here won't go and deliberately click the URL to watch their own account get hacked.
      • Most users on Slashdot won't click any links, especially links for the articles on which they are about to comment. ;)
    • Re: (Score:3, Informative)

      Actually it is not stored locally in Javascript. I assume that the information is stored in some sort of filesystem / database and converted to Javascript on the fly to ease integration with other applications. You can also get the same information as XML if you prefer:

      http://docs.google.com/data/contacts [google.com]
    • Hrm, since the source requests the js file from googles servers, shouldnt it be possible to check the referrer to make sure its a google page?
      • That's trusting the client to send correct data. It's laughably easy to spoof the referrer.
        • Sure, I can hack the referrer to get into my own gmail account. Wooo, scary!

          My browser should not grant this ability to random javascript it finds on the web.
            • I spoof the referrer all the time, using the "wget" command. That does no good for attacking gmail though, because how am I to get the required cookie?

              The spoof would have to work from Javascript or Java, creating connections on behalf of the user. Merely opening a TCP/IP socket won't do, because you'd not be able to shove the cookie down the wire.
  • by Inda (580031) <slash.20.inda@spamgourmet.com> on Monday January 01 2007, @10:22AM (#17422084) Journal
    Slashdot says:

    "So far the attack only works on Firefox, and doesn't appear to work in Opera or Internet explorer 7"

    TFA says:

    "I've tried the hack on IE7, Opera, and Firefox; it appears to be working on all three."

    Got any jobs going? I could do nice armchair job at Slashdot. I'd be willing to work the full 3 hours a week.
    • by Headcase88 (828620) on Monday January 01 2007, @10:33AM (#17422154) Journal
      I could do nice armchair job at Slashdot.

      Not with that sentence structure. You only made one grammar error. You could never be a /. editor.
      • "By simply logging in to GMail and visiting a website, a malicious website can steal your contact list, and all their details. ..."

        In other words, the submitter says that when a malicious website logs into Gmail and visits a website, it can steal my contact list.

        Someone needs to learn how to use dependent clauses. The subject of the sentence above is a malicious website, and that's who is being described in the dependent clause as logging into Gmail and visiting a website.
    • Don't worry, they'll get the story straight in the dupe.
    • Well, then, why DO you bother with this site?
  • by messner_007 (1042060) on Monday January 01 2007, @10:26AM (#17422108)
    Thank goodness. I was beginning to think that no one cared about my contacts.
  • Conceptual problem (Score:5, Informative)

    by JackHoffman (1033824) on Monday January 01 2007, @10:31AM (#17422148)
    Loading script files to exchange data with the server is a very common mechanism. It even has a name: JSON. It wouldn't surprise me to find that there are many more web applications which could be exploited in this way. This isn't a browser vulnerability or a simple bug. It is a design flaw of a widely used communication protocol.
    • This isn't a browser vulnerability or a simple bug. It is a design flaw of a widely used communication protocol.
      How do you fix it?

      From what I understand, as long as the user has a valid cookie, the information is fair game... and I imagine that there are implementations that do not even bother with a cookie.

      Maybe the question is: Can it be fixed?
      • Lots of ways:

        a. Place a 128-bit random number (UUID/GUID) into the URL for the contacts info.

        b. Check the referrer. (foreign javascript should not be able to forge this)

        c. Place an encrypted copy of the cookie into the URL of the contacts info.

        d. Embed the contacts info in the page instead.
    • Re: (Score:2, Informative)

      Please don't jump to conclusions. As one of the comment above notes, cross-domain xmlHTTPRequests are anyway blocked by all the main browsers. The problem in this case is because of a particular way in which the data is stored by Gmail. Calling it a design flaw of JSON is stupid.
  • I think the keys in JSON needs to be strings
  • I'm glad that I run Firefox on Linux!

    Oh wait...
  • Fixed? (Score:4, Informative)

    by prestonmcafee (923223) on Monday January 01 2007, @11:08AM (#17422380)
    According to

    http://blogs.zdnet.com/Google/?p=434
    it is fixed.

    • Not Fixed (Score:5, Informative)

      by astrosmash (3561) on Monday January 01 2007, @12:56PM (#17423132) Journal

      Still works for me. You can run this script from a local html file to check:

      <html>
      <head>
      <script>
      function google(a) {
      document.write("<ol>");
      for (i = 0; i < a.Body.Contacts.length; i++) {
      document.write("<li>" + a.Body.Contacts[i].Email + "</li>");
      }
      document.write("</ol>");
      }
      </script>
      <script src="http://docs.google.com/data/contacts?out=js&s how=ALL&psort=Affinity&callback=google&max=99999"> </script></head>
      <body>
      Hello
      </body>
      </html>

  • just FYI, it works with Galeon (2.x) as well.
  • These problems will not go away. Software engineers will always make mistakes and malevolent people will always want your private data. The Web is "open" by design and therefore open to exploits.

    With the Web browser becoming an application portal, users need to understand that doing transactions that involve their personal data must be separate from general Web browsing.

    You can switch off cookie permission and Javascript but this limits the functionality of many sites. I think the best solution is to use tw
  • Wow (Score:4, Informative)

    by Altanar (56809) on Monday January 01 2007, @12:18PM (#17422836)
    C'mon, /. You're reporting this now? It's already been fixed [digg.com].
  • This is only a problem for people who are violating one of the primary security policies in the first place, and that's putting your contact list in Gmail in the first place. While Google may claim to not be evil now, there's no guarantee at any time in the future, all the information they collect from you and on you won't be given or sold to other entities or otherwise exploited for nefarious purposes. In fact, it's pretty much an inevitability this will happen, so it's not smart in the first place to st
    • Re: (Score:3, Interesting)

      This is only a problem for people who are violating one of the primary security policies in the first place, and that's putting your contact list in Gmail in the first place. While Google may claim to not be evil now, there's no guarantee at any time in the future, all the information they collect from you and on you won't be given or sold to other entities or otherwise exploited for nefarious purposes.

      Whilst this is true, it's just the same as giving one's details to banks, credit card companies, phone companies, etc, etc ... they all have access to private and confidential information. I'm not sure that there's any more reason to suspect that they're any better or worse than Google - and judging from all the credit card snail-mail spam (from rival companies) that I've got since reluctantly obtaining a credit card, there's very good evidence to suggest that they wilfully share this info.

      Of course, by p

  • You shouldn't be suprised... as you all know GMail is still in beta.
  • It doesn't seem to work in Opera 9.02, despite some people saying that it works on every browser. Either Google has changed something or the example code isn't working.
  • I posted this on reddit [reddit.com] which broke the story earlier, and on my blog [betterexplained.com]. Thought you might find it useful.

    Quick follow-up. On digg someone posted the un-obfuscated code: http://www.cc.gatech.edu/~achille/contacts-source. txt [gatech.edu]

    How it works

    The code is pretty straightforward. Basically, Google docs has an embedded script that will run a callback function, passing the function your contact list as an object. The embedded script presumably checks a cookie to ensure you are logged into a Google account before handing
    • And to solve the cache problem, they send the "Cache-Control: no-store, no-cache, must-revalidate" header for that script.