MBOX-Line: From jkt at flaska.net  Sun Sep 30 04:40:27 2012
To: imap-protocol@u.washington.edu
From: =?UTF-8?B?SmFuIEt1bmRyw6F0?= <jkt@flaska.net>
Date: Fri Jun  8 12:34:48 2018
Subject: [Imap-protocol] SSL compression attack and IMAP
Message-ID: <50682FAB.5030102@flaska.net>

Hi,
recently, there's been an attack on TLS connections which carry the HTTP 
traffic -- "CRIME" [1]. I'm not a cryptographic expert (although I like 
to play one occasionally), but to my understanding, the attack combines 
adaptive stream compression leaking data about the plaintext with the 
attacker being able to control what gets transferred through the stream. 
Together, these can reveal a secret HTTP cookie in just 6 requests per 
each byte of the plaintext. Basically, when a secret cookie of 
"foo=123456789" is passed in the HTTP headers (which happens to be 
automatically included by the browser), an attacker-chosen payload later 
in the stream like "foo=123xxx" will compress better than "foo=120xxx", 
revealing one byte of the plaintext at a time.

The browser vendors have reacted by disabling the TLS compression 
unconditionally. The Qt library which my IMAP client Trojita [2] uses 
has changed to disable TLS compression by default [3].

To my non-expert understanding, this attack could probably be limited by 
explicitly flushing the compressor's dictionary before and after sending 
the sensitive data over the wire. However, this is only my quick 
analysis of how the attack works, and I cannot guarantee that it is 
reasonably correct.

I was wondering if any IMAP vendor has evaluated the risk here. Do you 
ship with the TLS compression on by default? (Both clients and servers 
can refuse the compression.) Do you reset the zlib compressor's 
dictionary around "sensitive" parts? What is sensitive for you -- a 
password, message payload in FETCH responses and APPEND commands? What 
else? If you support the COMPRESS extension, do you employ the same 
safeguards?

With kind regards,
Jan

[1] 
http://security.stackexchange.com/questions/19911/crime-how-to-beat-the-beast-successor
[2] http://trojita.flaska.net/
[3] http://qt.digia.com/en/Release-Notes/security-issue-september-2012/

-- 
Trojita, a fast e-mail client -- http://trojita.flaska.net/

