-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffering issues with STARTTLS in IMAP #386
Comments
Hey, have you found time to take a look at this? This might cause serious security issues in applications using libetpan to handle IMAP STARTTLS connections, as an attacker can insert plaintext into the encrypted session. |
@duesee Could you send a pull request with your change? |
I opened #387 |
The same bug is present in SMTP:
And in POP3:
I will try to send you a pull request for these as well shortly. |
CVE-2020-15953 appears to have been assigned for this issue. |
We found a STARTTLS issue in libEtPan which affects IMAP (and probably other protocols.)
When the server responds with its "let's do TLS now message", e.g.
A OK begin TLS\r\n
, libEtPan will read any data after the \r\n and save it into some internal buffer for later processing. This is problematic, because a MITM attacker can inject arbitrary responses. I havn't tested it to this extent, but I suspect that this is enough to forge entire mailboxes even though STARTTLS is used.There is a nice blogpost by Wietse Venema about a "command injection" in postfix (http://www.postfix.org/CVE-2011-0411.html). What we have here is the problem in reverse, i.e. not a command injection, but a "response injection."
Example trace to give an intuition:
An attacker can probably inject more responses and (in the worst case) mimic a whole session.
There are (from my view) three possible fixes: 1) discard any remaining data after stls, 2) shovel the extra data into the TLS layer (where it belongs), and 3) error out as this is clearly a protocol violation.
The (maybe silly or even wrong) commit in duesee@5462750#diff-b01e5693616d9ee0714273a3491bc713 seems to fix the issue (please ignore the .idea folder :P)
The text was updated successfully, but these errors were encountered: