by lucb1e · 13y ago · 0 comments
This seems to me as a session collision. You looked at the cookie, so you know something about how these things work, but just to be sure I'm going to explain it in basic terms. Keep in mind that this is just my theory, I'm not not affiliated with Google and have never experienced this myself.
When you log in, on pretty much any website, it generates a session. This session must be unpredictable so that others can't guess what your session is, so there is some random generator involved. An example session could be 7583 (in practice it will be a much larger number, usually with letters or even special characters involved).
When someone else logs in, they will also have a session generated for them. If the random generator happens to pick the same number, it might overwrite your session. If you then open the tab (and your browser remembers the session to keep you logged in), you will appear to be logged in as someone else.
This should never happen. The server should check whether the generated number is already in use. However, the odds of this are incredibly low. With 64-bit sessions, the odds of having two people have the same session is 1 in approximately 18446744073709551616. Even with a billion users logging in, substract 9 decimal positions from that and it's still one in eighteen billion. But it might just happen.
With the millions of users that Gmail has, it might take a lot of resources to check if the session exists somewhere in the world. Or perhaps your session had expired and has been removed, and then someone else logged in and got the session that you were previously assigned. Your browser, not knowing that its session cookie had expired, simply used it.
The odds of this are just so incredibly low, it's very surprising that it happened - if this is what happened. It would perfectly fit your explanation though. Looking at Gmail's cookie, I can't really figure out how many bits of randomness they use. The length is 194 bytes when base64-decoding it, so that would be 1.58*(10^467) possibilities. But I think they simply store some more data there, not just your session.
Hmm, writing this down and looking at the numbers, it's actually more likely that something else messed up, especially considering the complexity of Google's network. Anyhow, a very interesting bug.
Please read about the Birthday Paradox: http://en.wikipedia.org/wiki/Birthday_Paradox . The probably of a random collision in 64 bits is 1 in 2^32, not 1 in 264.
Sounds like someone used Maximum Likelihood instead of Maximum A Posteriori.
http://en.wikipedia.org/wiki/Bayesian_probability
Put simply, you multiply the "a posteriori probability" (i.e. how much it "looks" like it happened) by the original probability (how likely it is to happen).
The two are only equivalent if what you know a priori is that all causes are equally likely. In this case they aren't, so a MAP estimate would still give a very low probability to an actual collision, whereas ML doesn't care about the probability of a collision itself -- merely the probability of what it causes. :)