Skip to content

Commit 913a991

Browse files
alejandro-colomarflatcap
authored andcommitted
ncrypt/crypt.c: Protect address lists in header fields
... except Bcc, for obvious reasons. There are several attacks that are possible if the To, Cc, and similar header fields are not protected. One of them is: - The metadata of a signed+encrypted message can be modified (without decrypting it), to add a malicious recipient. Subsequent replies to the thread will likely also encrypt to the malicious recipient, disclosing secret data. Read the links below for a more detailed explanation of the problem. Link: <#4223> Link: <#4226> Cc: Richard Russon <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
1 parent 12d9d5a commit 913a991

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ncrypt/crypt.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,15 @@ int mutt_protect(struct Email *e, char *keylist, bool postpone)
271271
{
272272
struct Envelope *protected_headers = mutt_env_new();
273273
mutt_env_set_subject(protected_headers, e->env->subject);
274-
/* Note: if other headers get added, such as to, cc, then a call to
275-
* mutt_env_to_intl() will need to be added here too. */
274+
mutt_addrlist_copy(&protected_headers->return_path, &e->env->return_path, false);
275+
mutt_addrlist_copy(&protected_headers->from, &e->env->from, false);
276+
mutt_addrlist_copy(&protected_headers->to, &e->env->to, false);
277+
mutt_addrlist_copy(&protected_headers->cc, &e->env->cc, false);
278+
mutt_addrlist_copy(&protected_headers->sender, &e->env->sender, false);
279+
mutt_addrlist_copy(&protected_headers->reply_to, &e->env->reply_to, false);
280+
mutt_addrlist_copy(&protected_headers->mail_followup_to, &e->env->mail_followup_to, false);
281+
mutt_addrlist_copy(&protected_headers->x_original_to, &e->env->x_original_to, false);
282+
mutt_env_to_intl(protected_headers, NULL, NULL);
276283
mutt_prepare_envelope(protected_headers, 0, NeoMutt->sub);
277284

278285
mutt_env_free(&e->body->mime_headers);

0 commit comments

Comments
 (0)