File CVE-2020-28896.patch of Package mutt.17505

From 04b06aaa3e0cc0022b9b01dbca2863756ebbf59a Mon Sep 17 00:00:00 2001
From: Kevin McCarthy <>
Date: Mon, 16 Nov 2020 10:20:21 -0800
Subject: [PATCH] Ensure IMAP connection is closed after a connection error.

During connection, if the server provided an illegal initial response,
Mutt "bailed", but did not actually close the connection.  The calling
code unfortunately relied on the connection status to decide to
continue with authentication, instead of checking the "bail" return

This could result in authentication credentials being sent over an
unencrypted connection, without $ssl_force_tls being consulted.

Fix this by strictly closing the connection on any invalid response
during connection.  The fix is intentionally small, to ease
backporting.  A better fix would include removing the 'err_close_conn'
label, and perhaps adding return value checking in the caller (though
this change obviates the need for that).

This addresses CVE-2020-28896.  Thanks to Gabriel Salles-Loustau for
reporting the problem, and providing test cases to reproduce.
 imap/imap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- imap/imap.c
+++ imap/imap.c	2020-11-23 12:44:34.499588230 +0000
@@ -524,9 +524,9 @@ int imap_open_connection (IMAP_DATA* ida
 #if defined(USE_SSL)
-  imap_close_connection (idata);
+  imap_close_connection (idata);
   FREE (&idata->capstr);
   return -1;
openSUSE Build Service is sponsored by