Commit 3e88866d authored by Kevin J. McCarthy's avatar Kevin J. McCarthy
Browse files

Prevent possible IMAP MITM via PREAUTH response.

This is similar to CVE-2014-2567 and CVE-2020-12398.  STARTTLS is not
allowed in the Authenticated state, so previously Mutt would
implicitly mark the connection as authenticated and skip any
encryption checking/enabling.

No credentials are exposed, but it does allow messages to be sent to
an attacker, via postpone or fcc'ing for instance.

Reuse the $ssl_starttls quadoption "in reverse" to prompt to abort the
connection if it is unencrypted.

Thanks very much to Damian Poddebniak and Fabian Ising from the
Münster University of Applied Sciences for reporting this issue, and
their help in testing the fix.
parent f64ec1de
......@@ -530,6 +530,22 @@ int imap_open_connection (IMAP_DATA* idata)
}
else if (ascii_strncasecmp ("* PREAUTH", idata->buf, 9) == 0)
{
#if defined(USE_SSL)
/* An unencrypted PREAUTH response is most likely a MITM attack.
* Require a confirmation. */
if (!idata->conn->ssf)
{
if (option(OPTSSLFORCETLS) ||
(query_quadoption (OPT_SSLSTARTTLS,
_("Abort unencrypted PREAUTH connection?")) != MUTT_NO))
{
mutt_error _("Encrypted connection unavailable");
mutt_sleep (1);
goto err_close_conn;
}
}
#endif
idata->state = IMAP_AUTHENTICATED;
if (imap_check_capabilities (idata) != 0)
goto bail;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment