250 points · by EwanToo · 14y ago · 132 comments
I guess this is actually an instance where those Hollywood "guess the password one character at a time" animations would make sense.
1. To know the format of cookies used for the web site you are targetting. Specifically, whatever cookie contains authentication.
2. The ability to injection a request to the target web server while someone is connected (such as with JavaScript, an XSS, or plug-in).
3. Ability to monitor the SSL connection is it is transported across TCP.
Would have been fun if they called this the CPE1704TKS attack instead of CRIME: http://www.youtube.com/watch?v=NHWjlCaIrQo
That one was not cracked one character at a time in series, portions in the middle were discovered sooner. But, yeah, would have been a more appropriate, cooler name.
Did you see the BEAST attack? Exactly one byte at a time: http://www.youtube.com/watch?v=BTqAIDVUvrU
You're right that Hollywood "guess the password one character at a time" animation makes sense here. It also makes sense for timing based attacks. Ie, if checking "AB" against the password takes longer than "A", you know the second character is B...
Variable time until some threshold number of repeat failures occurs (e.g. 3). After this, manipulate the comparison time in such a manner that someone attempting to do this sort of attack would come up with a dummy password. If they come up with said dummy password, alert the user of an attempted attack.
So I suspect the attack there cannot work on TLS, and in fact the demo code posted in a comment attacks local zlib, not TLS.
I think the actual attack, if it's along these lines, involves getting the server to echo back your guess of the cookie, so that the cookie and your guess are both on the same stream. Perhaps with TRACE?
Edit: Wait, I am. That wouldn't work because it'd compress the repeated subsequences. D'oh.
At least we can still do compression at the HTTP (or other higher-level protocol) level. That gets us most of the benefit anyway.
What would be the procedure if you use bzip2 (which is based on Burrows-Wheeler transformation) compression?
I do a lot of experimentation with new compression techniques for web demos, and I recently implemented my own compression algo from scratch based around the same building blocks as bzip2. The variance I saw was just staggering; a tiny change in my source material would totally warp the output.
Seriously, we know how to build secure cryptographic protocols. Unfortunately, step #1 is "don't try to be backwards compatible with the horribly broken things people were doing in the 1990s".
(Reason: because encrypted data is [should be] indistinguishable from random data, and random data does not compress)
It's easy for me to believe that you've internalized "minimize data-dependent branches in crypto code" and thus wouldn't have designed a compressed encrypted transport.
It is very hard for me to believe that you would have spotted this flaw immediately had anyone pointed out to you that TLS supported compression.
There is well-regarded (though not by me) crypto advice recommending that people compress before encrypting, to destroy structure in the plaintext.
Compression before encryption is not a problem if the sender is the only person that decides what is in the message to be sent. Compression doesn't make it vulnerable to chosen plain-text attacks either. Mixing victims's and attacker's data before compression and encryption will leak data, yes.
I've studied cryptography theory, and I've implemented various ciphers and attacks, and the more I learn the more certain I become that I would never, ever use any of my own crypto code in production.
Data compression is often used in data storage or transmission. Suppose you want to use data compression in conjunction with encryption. Does it make more sense to
A. Compress the data and then encrypt the result, or
B. Encrypt the data and then compress the result.
Now we know the correct answer is Neither.
[1] http://crypto.stanford.edu/~dabo/cs255/hw_and_proj/hw1.pdf
For a confusing example of a fairly leaky cryptosystem involving compression that works well in practice and has a proof of security that is aware of the leak, see Douceur et al.'s "convergent encryption".
http://research.microsoft.com/apps/mobile/publication.aspx?i...
Disabling compression could certainly contribute to global warming in a relatively small way...
GET / HTTP/1.0
X-Pad: GET / HTTP/aaaaaaa
Where X-Pad randomly repeats previous bytes, and perhaps 0..8 bytes of random/repeating variable-length data. By randomizing the effectiveness of the compression, surely this attack can be generally prevented by the browser?You could argue that given enough samples the noise could be filtered and the attack still remains, but the same could be said the same for many successful patches over the years (TCP sequence number randomization, Kaminsky's DNS issue, etc.), and the number of samples required would be pretty infeasible.
See:http://code.google.com/p/chromium/issues/detail?id=31628
Even if you don't have direct access to the library code creating SSL objects, there are still some tricks with ctypes, ffi, dlopen that have the same effect.
It might even work with JacaScript turned. Have a page with nested iframes. Serve each one from a different IP address and have the server not answer right away. The server answers with the first iframe having a chosen URL while Eve snoops the wire. Eve tells the server which URL to use for the next iframe body that it sends. Repeat until the cookie is deduced. The server can use a nested tree of iframes to avoid having a bazillion iframes in the top level document.
Will a site using HTTPS be able to serve compressed assets (like javascript & css)?
If not, we’ll urgently need a way for site devs to whitelist precomputed (and thus immune) static assets for compression.
Compression: Specifies whether compression is allowed, or delayed until the user has authenticated successfully. The argument must be "yes", "delayed", or "no". The default is "delayed".
I don't know why they chose "delayed" as default, but this seems to prevent this attack.
So, not so much.