int mutt_body_handler (BODY *b, STATE *s)
{
int plaintext = 0;
- handler_t handler = NULL;
+ handler_t handler = NULL, encrypted_handler = NULL;
int rc = 0;
int oflags = s->flags;
* the only operation needed.
*/
if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
- handler = crypt_pgp_application_pgp_handler;
+ encrypted_handler = handler = crypt_pgp_application_pgp_handler;
else if (option(OPTREFLOWTEXT) && ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0)
handler = rfc3676_handler;
else
handler = mutt_signed_handler;
}
else if (mutt_is_valid_multipart_pgp_encrypted (b))
- handler = valid_pgp_encrypted_handler;
+ encrypted_handler = handler = valid_pgp_encrypted_handler;
else if (mutt_is_malformed_multipart_pgp_encrypted (b))
- handler = malformed_pgp_encrypted_handler;
+ encrypted_handler = handler = malformed_pgp_encrypted_handler;
if (!handler)
handler = multipart_handler;
plaintext = 1;
}
else if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
- handler = crypt_pgp_application_pgp_handler;
+ encrypted_handler = handler = crypt_pgp_application_pgp_handler;
else if ((WithCrypto & APPLICATION_SMIME) && mutt_is_application_smime(b))
- handler = crypt_smime_application_smime_handler;
+ encrypted_handler = handler = crypt_smime_application_smime_handler;
}
/* only respect disposition == attachment if we're not
option(OPTVIEWATTACH))) &&
(plaintext || handler))
{
+ /* Prevent encrypted attachments from being included in replies
+ * unless $include_encrypted is set. */
+ if ((s->flags & MUTT_REPLYING) &&
+ (s->flags & MUTT_FIRSTDONE) &&
+ encrypted_handler &&
+ !option (OPTINCLUDEENCRYPTED))
+ goto cleanup;
+
rc = run_decode_and_handler (b, s, handler, plaintext);
}
/* print hint to use attachment menu for disposition == attachment
fputs (" --]\n", s->fpout);
}
+cleanup:
s->flags = oflags | (s->flags & MUTT_FIRSTDONE);
if (rc)
{
** Controls whether or not a copy of the message(s) you are replying to
** is included in your reply.
*/
+ { "include_encrypted", DT_BOOL, R_NONE, OPTINCLUDEENCRYPTED, 0},
+ /*
+ ** .pp
+ ** Controls whether or not Mutt includes separately encrypted attachment
+ ** contents when replying.
+ ** .pp
+ ** This variable was added to prevent accidental exposure of encrypted
+ ** contents when replying to an attacker. If a previously encrypted message
+ ** were attached by the attacker, they could trick an unwary recipient into
+ ** decrypting and including the message in their reply.
+ */
{ "include_onlyfirst", DT_BOOL, R_NONE, OPTINCLUDEONLYFIRST, 0},
/*
** .pp