Skip to content
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

Should To and Cc header fields be protected? #4223

Open
alejandro-colomar opened this issue Mar 29, 2024 · 9 comments · Fixed by #4227
Open

Should To and Cc header fields be protected? #4223

alejandro-colomar opened this issue Mar 29, 2024 · 9 comments · Fixed by #4227
Labels
bug:upstream Also exists in upstream Mutt topic:security Security issue type:bug Bug

Comments

@alejandro-colomar
Copy link
Member

alejandro-colomar commented Mar 29, 2024

I believe this can be^W^Wis a security vulnerability, but it's so obvious that I don't think it should be embargoed.

Alice sends a secret message to Bob.
Mallory wants to read the message, and Bob's reply to it.

Mallory intercepts the message, and adds himself to the Cc: header field.
(I'm not sure if the following is possible, but let's assume it is:) Mallory also modifies the metadata of the encrypted part, to add himself as a listed recipient, even if he can't really decrypt the message. (@dd9jn, is this possible?)

Bob receives the message, and sees that Alice CCed Mallory, and that the encrypted message seems to be encrypted to Mallory too (currently, neomutt(1) doesn't show this, but Bob reads that info by running the gpg(1) command on the message; in the future, he sees that in the encryption information block).

When Bob replies to Alice, quoting a large part of the original message, he keeps Mallory in Cc (replies to all), disclosing the conversation to Mallory.

This could be prevented by protecting the To and Cc header fields, by including them in the signed part. It doesn't make sense to replace them by dummy ... as done with the Subject, since they need to receive the message, but it makes sense to repeat them in the signed part, and possibly warn if they don't match the outer ones (hmm, maybe we shouldn't warn if they mismatch; just showing the protected To and Cc in the pager should be enough; it's simpler).

@alejandro-colomar
Copy link
Member Author

Related: #4221
Related: https://linux.codidact.com/posts/291205

@alejandro-colomar
Copy link
Member Author

alejandro-colomar commented Mar 29, 2024

Related config:

     crypt_protected_headers_read
            Type: boolean
            Default: yes

            When set, NeoMutt will display protected headers  ("Memory
            Hole")  in  the pager, When set, NeoMutt will display pro‐
            tected headers in the pager, and will update the index and
            header cache with revised headers.

            Protected headers  are  stored  inside  the  encrypted  or
            signed  part of an an email, to prevent disclosure or tam‐
            pering.  For more information  see  https://github.com/au‐
            tocrypt/protected-headers  Currently NeoMutt only supports
            the Subject header.

            Encrypted messages using protected headers  often  substi‐
            tute  the  exposed  Subject header with a dummy value (see
            $crypt_protected_headers_subject).   NeoMutt  will  update
            its  concept  of  the correct subject after the message is
            opened, i.e. via the <display-message> function.   If  you
            reply  to a message before opening it, NeoMutt will end up
            using the dummy Subject header, so be sure to open such  a
            message first.  (Crypto only)
     crypt_protected_headers_subject
            Type: string
            Default: "..."

            When  $crypt_protected_headers_write  is set, and the mes‐
            sage is marked for encryption, this  will  be  substituted
            into the Subject field in the message headers.

            To  prevent  a  subject from being substituted, unset this
            variable, or set it to the empty string.  (Crypto only)

     crypt_protected_headers_write
            Type: boolean
            Default: no

            When set, NeoMutt  will  generate  protected  headers  for
            signed and encrypted emails.

            Protected  headers  are  stored  inside  the  encrypted or
            signed part of an an email, to prevent disclosure or  tam‐
            pering.   For  more information see https://github.com/au‐
            tocrypt/protected-headers

            Currently  NeoMutt  only  supports  the  Subject   header.
            (Crypto only)

@alejandro-colomar
Copy link
Member Author

alejandro-colomar commented Mar 29, 2024

Alice sends a secret message to Bob. Mallory wants to read the message, and Bob's reply to it.

Mallory intercepts the message, and adds himself to the Cc: header field. (I'm not sure if the following is possible, but let's assume it is:) Mallory also modifies the metadata of the encrypted part, to add himself as a listed recipient, even if he can't really decrypt the message. (@dd9jn, is this possible?)

Bob receives the message, and sees that Alice CCed Mallory, and that the encrypted message seems to be encrypted to Mallory too (currently, neomutt(1) doesn't show this, but Bob reads that info by running the gpg(1) command on the message; in the future, he sees that in the encryption information block).

When Bob replies to Alice, quoting a large part of the original message, he keeps Mallory in Cc (replies to all), disclosing the conversation to Mallory.

The worst part of this bug is that Bob will assume that Alice CCed Mallory, and when Alice receives Bob's reply, Alice will also likely assume that Bob added Mallory to CC, so it's very likely that none of them would realize that Mallory added himself to the conversation maliciously.

@alejandro-colomar
Copy link
Member Author

alejandro-colomar commented Mar 29, 2024

I think this deserves not only making To and Cc protected headers, but also change the default to protect headers. Not protecting headers is an insecure default, which is a bad thing, when dealing with crypto stuff. Consider users who may not know about the existence of this issue, or about the existence of the $crypt_protected_* options, and who will assume that enabling signing and encryption neomutt(1) will just do The Right Thing(tm).

alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 30, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug neomutt#4223 linked below.

Closes: <neomutt#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <neomutt#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 30, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug neomutt#4223 linked below.

Closes: <neomutt#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <neomutt#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 30, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug neomutt#4223 linked below.

Closes: <neomutt#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <neomutt#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
@alejandro-colomar
Copy link
Member Author

alejandro-colomar commented Mar 31, 2024

For messages without Cc, there should be an empty Cc: header field in the protected part, to avoid Mallory adding one outside of the protected part.

alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 31, 2024
They are part of the crypto message, which means the sender considers
them part of the important data, and should not be carelessly weeded.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 31, 2024
There are several attacks that are possible if the To or Cc fields are
not protected.  One of them is:

-  The metadata of a signed+encrypted message can be modified (without
   decrypting it), to add a mallicious recipient.  Subsequent replies to
   the thread will likely also encrypt to the mallicious recipient,
   disclosing secret data.

The "From" isn't strictly necessary, as the signature will specify an
address, but it doesn't hurt either, and since the public key may have
several IDs, this makes sure that the message contains the one that the
sender wants to use.

Read the links below for a more detailed explanation of the problem.

To be paranoic, we might want to also protect other address lists,
like "Reply-To".  That would need more careful analysis, and also
implies more noise in the pager, so I'm not convinced.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 31, 2024
They are part of the crypto message, which means the sender considers
them part of the important data, and should not be carelessly weeded.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 31, 2024
There are several attacks that are possible if the To or Cc fields are
not protected.  One of them is:

-  The metadata of a signed+encrypted message can be modified (without
   decrypting it), to add a mallicious recipient.  Subsequent replies to
   the thread will likely also encrypt to the mallicious recipient,
   disclosing secret data.

The "From" isn't strictly necessary, as the signature will specify an
address, but it doesn't hurt either, and since the public key may have
several IDs, this makes sure that the message contains the one that the
sender wants to use.

Read the links below for a more detailed explanation of the problem.

To be paranoic, we might want to also protect other address lists,
like "Reply-To".  That would need more careful analysis, and also
implies more noise in the pager, so I'm not convinced.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 31, 2024
There are several attacks that are possible if the To or Cc 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 mallicious recipient,
   disclosing secret data.

The "From" isn't strictly necessary, as the signature will specify an
address, but it doesn't hurt either, and since the public key may have
several IDs, this makes sure that the message contains the one that the
sender wants to use.

Read the links below for a more detailed explanation of the problem.

To be paranoic, we might want to also protect other address lists,
like "Reply-To".  That would need more careful analysis, and also
implies more noise in the pager, so I'm not convinced.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Mar 31, 2024
There are several attacks that are possible if the To or Cc 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.

The "From" isn't strictly necessary, as the signature will specify an
address, but it doesn't hurt either, and since the public key may have
several IDs, this makes sure that the message contains the one that the
sender wants to use.

Read the links below for a more detailed explanation of the problem.

To be paranoic, we might want to also protect other address lists,
like "Reply-To".  That would need more careful analysis, and also
implies more noise in the pager, so I'm not convinced.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Apr 1, 2024
They are part of the crypto message, which means the sender considers
them part of the important data, and should not be carelessly weeded.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Apr 1, 2024
There are several attacks that are possible if the To or Cc 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.

The "From" isn't strictly necessary, as the signature will specify an
address, but it doesn't hurt either, and since the public key may have
several IDs, this makes sure that the message contains the one that the
sender wants to use.

Read the links below for a more detailed explanation of the problem.

To be paranoic, we might want to also protect other address lists,
like "Reply-To".  That would need more careful analysis, and also
implies more noise in the pager, so I'm not convinced.

Link: <neomutt#4223>
Link: <neomutt#4226>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
@alejandro-colomar
Copy link
Member Author

alejandro-colomar commented Apr 1, 2024

Fun fact:

Old mutt(1) has a bug by which it injects To (and a few other header fields) into the protected header.

However, it's just a bug; probably they forgot to clear some structure.

It's clearly a bug, however, because mutt(1) never reads that back on the receiving side. It only presents the non-protected headers. So, a malicious actor can preserve the protected headers (so gpg(1) will accept the signature), modify the non-protected ones, and trick the recipient to trust the mail. Since mutt(1) doesn't show the protected To, the user cannot know about it.

alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Apr 3, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug neomutt#4223 linked below.

Closes: <neomutt#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <neomutt#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
@alejandro-colomar
Copy link
Member Author

I think I'll end up protecting every AddressList in the Envelope structure.

alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue Apr 5, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug neomutt#4223 linked below.

Closes: <neomutt#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <neomutt#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
@flatcap
Copy link
Member

flatcap commented Apr 5, 2024

bcc leakage!

This isn't a bug in your changes, just a general feature of (Neo)Mutt.

Experimenting with both your PRs (#4221, #4227)...

I sent a signed/encrypted email to multiple recipients:

Compose

    From: Richard Russon <rich@flatcap.org>
      To: Alex Lacamoire <al@tangerine.com>
      Cc: Bing Crosby <bc@apple.com>
     Bcc: Cate Blanchett <cb@elderberry.com>
 Subject: Test

Security: Sign, Encrypt (PGP/MIME)
 Sign as: 0x69AD1D636AC292E820658C16EBC150E4B5DA63DF

Note, I have: set pgp_self_encrypt = yes

Email arrived (annotated with key owners)

Date: Fri, 5 Apr 2024 16:58:40 +0100
From: Richard Russon <rich@flatcap.org>
To: Alex Lacamoire <al@tangerine.com>
Cc: Bing Crosby <bc@apple.com>
Subject: ...
User-Agent: NeoMutt/20240329-149-6243fc

[-- Begin encryption information --]
Recipient: RSA key, ID 19D4D91AF95EE3D1 Alex Lacamoire <al@tangerine.com>
Recipient: RSA key, ID 934F123BFA86E1E9 Bing Crosby <bc@apple.com>
Recipient: RSA key, ID 7D276576DECDF4F8 Cate Blanchett <cb@elderberry.com>
Recipient: RSA key, ID 544F271C223CE792 Richard Russon (flatcap) <rich@flatcap.org>
[-- End encryption information --]

[-- The following data is PGP/MIME encrypted --]

[-- Begin signature information --]
Good signature from: Richard Russon (flatcap) <rich@flatcap.org>
            created: Fri 05 Apr 2024 16:58:40 BST
[-- End signature information --]

[-- The following data is signed --]

To: Alex Lacamoire <al@tangerine.com>
Cc: Bing Crosby <bc@apple.com>
Subject: Test

TEXT

NeoMutt effectively encrypts like gpg --recipient.
In the example above, the recipients can infer that Cate Blanchett was also sent a copy of the email.

Can we change the behaviour to mimic gpg --hidden-recipient for the bcc: field?

@alejandro-colomar
Copy link
Member Author

alejandro-colomar commented Apr 6, 2024

bcc leakage!

This isn't a bug in your changes, just a general feature of (Neo)Mutt.

Hmmm!

Experimenting with both your PRs (#4221, #4227)...

I sent a signed/encrypted email to multiple recipients:

Compose

    From: Richard Russon <rich@flatcap.org>
      To: Alex Lacamoire <al@tangerine.com>
      Cc: Bing Crosby <bc@apple.com>
     Bcc: Cate Blanchett <cb@elderberry.com>
 Subject: Test

Security: Sign, Encrypt (PGP/MIME)
 Sign as: 0x69AD1D636AC292E820658C16EBC150E4B5DA63DF

Note, I have: set pgp_self_encrypt = yes

Email arrived (annotated with key owners)

Date: Fri, 5 Apr 2024 16:58:40 +0100
From: Richard Russon <rich@flatcap.org>
To: Alex Lacamoire <al@tangerine.com>
Cc: Bing Crosby <bc@apple.com>
Subject: ...
User-Agent: NeoMutt/20240329-149-6243fc

Seems good. The delivered message doesn't show the BCC.

[-- Begin encryption information --]
Recipient: RSA key, ID 19D4D91AF95EE3D1 Alex Lacamoire al@tangerine.com
Recipient: RSA key, ID 934F123BFA86E1E9 Bing Crosby bc@apple.com
Recipient: RSA key, ID 7D276576DECDF4F8 Cate Blanchett cb@elderberry.com
Recipient: RSA key, ID 544F271C223CE792 Richard Russon (flatcap) rich@flatcap.org
[-- End encryption information --]

Seems bad, but can be expected: we only encrypt once.

[-- The following data is PGP/MIME encrypted --]

[-- Begin signature information --]
Good signature from: Richard Russon (flatcap) rich@flatcap.org
created: Fri 05 Apr 2024 16:58:40 BST
[-- End signature information --]

[-- The following data is signed --]

To: Alex Lacamoire al@tangerine.com
Cc: Bing Crosby bc@apple.com
Subject: Test

TEXT

And seems good. The protected headers don't show the BCC. It's just the list of encryption recipients.

NeoMutt effectively encrypts like gpg --recipient. In the example above, the recipients can infer that Cate Blanchett was also sent a copy of the email.

Can we change the behaviour to mimic gpg --hidden-recipient for the bcc: field?

We could fix it in several ways:

  • Encrypt only once, as we do, but ask gpg to hide the recipients that correspond to BCC. This would leave traces to the recipient that someone else can read it, possibly a BCC. It's not as bad of a leak, but it still leaks the fact that someone hidden got a copy. You could argue that it's a feature.

  • Encrypt several times, so that each encrypted copy only shows the recipients that the recipient should see. Slower. Less leaky. But makes it easier to allow the sender to leak data without the recipient noticing (if they really want, they'll do it anyway).

The first one is what you suggest. At first glance, I agree, as I think it will be simpler to implement.

(I've copied the info from here into a new bug report.)

@alejandro-colomar alejandro-colomar changed the title Should To and Cc header fields be protected? [crypto] Should To and Cc header fields be protected? Apr 6, 2024
@alejandro-colomar alejandro-colomar changed the title [crypto] Should To and Cc header fields be protected? Should To and Cc header fields be protected? Apr 6, 2024
@alejandro-colomar alejandro-colomar added the topic:security Security issue label Apr 6, 2024
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
Link: <neomutt#4236>
Link: <neomutt#4223>
Link: <neomutt#4226>
Reviewed-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
... 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: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
This function copies a src ListHead at the tail of a dst ListHead.

This is similar to mutt_addrlist_copy(), but for ListHead.

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
Move some code out of a conditional, to add support for other protected
headers in the following commits.

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
…ists

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
This function writes a list to a buffer.

It is similar to mutt_addrlist_write(), but simpler, and for ListHead.

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
…fields

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar added a commit to alejandro-colomar/neomutt that referenced this issue May 2, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug neomutt#4223 linked below.

Closes: <neomutt#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <neomutt#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Cc: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug neomutt#4223 linked below.

Closes: <neomutt#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <neomutt#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Cc: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
... 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: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
This function copies a src ListHead at the tail of a dst ListHead.

This is similar to mutt_addrlist_copy(), but for ListHead.

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
Move some code out of a conditional, to add support for other protected
headers in the following commits.

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
…ists

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
This function writes a list to a buffer.

It is similar to mutt_addrlist_write(), but simpler, and for ListHead.

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
…fields

Link: <neomutt#4223>
Link: <neomutt#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
Protected header fields are part of the crypto message, which means the
sender considers them part of the important data, and should not be
carelessly weeded.

If the user want to do it, allow them via this variable, but default to
not weeding them.

Link: <neomutt#4223>
Link: <neomutt#4226>
Link: <neomutt#4227>
Link: <neomutt#4236>
Link: <neomutt#4237>
Cc: Richard Russon <rich@flatcap.org>
Reviewed-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Pietro Cerutti <gahr@gahr.ch>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
Link: <neomutt#4236>
Link: <neomutt#4223>
Link: <neomutt#4226>
Reviewed-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
Show a block of information about the encryption of a message, which
includes the recipients that can decrypt the message.

This info isn't necessarily complete: the sender could hide some
recipients, so that they are able to decrypt the message, but aren't
listed.  See gpg(1) options --recipient and --hidden-recipient.  I'm not
sure, but I suspect a malicious sender could also add fake recipients,
which are listed, but cannot really decrypt the message.

Therefore, this should be taken only as an informative block, and with a
pinch of salt.

It would be good to protect the To and Cc header fields, to provide a
guarantee to the recipient that the listed recipients match the original
recipients as intended by the sender.  See the bug #4223 linked below.

Closes: <#4163>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Public%20Key%20Algorithms>
Link: <https://www.gnupg.org/documentation/manuals/gpgme.pdf#Decrypt>
Link: <https://linux.codidact.com/posts/291205>
Link: <#4223>
Co-developed-by: Richard Russon <rich@flatcap.org>
Cc: Werner Koch <wk@gnupg.org>
Cc: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
... 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 <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
This function copies a src ListHead at the tail of a dst ListHead.

This is similar to mutt_addrlist_copy(), but for ListHead.

Link: <#4223>
Link: <#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
Link: <#4223>
Link: <#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
Move some code out of a conditional, to add support for other protected
headers in the following commits.

Link: <#4223>
Link: <#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
…ists

Link: <#4223>
Link: <#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
This function writes a list to a buffer.

It is similar to mutt_addrlist_write(), but simpler, and for ListHead.

Link: <#4223>
Link: <#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
…fields

Link: <#4223>
Link: <#4226>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
Link: <#4236>
Link: <#4223>
Link: <#4226>
Reviewed-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Richard Russon <rich@flatcap.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit to alejandro-colomar/neomutt that referenced this issue May 8, 2024
Protected header fields are part of the crypto message, which means the
sender considers them part of the important data, and should not be
carelessly weeded.

If the user want to do it, allow them via this variable, but default to
not weeding them.

Link: <neomutt#4223>
Link: <neomutt#4226>
Link: <neomutt#4227>
Link: <neomutt#4236>
Link: <neomutt#4237>
Cc: Richard Russon <rich@flatcap.org>
Reviewed-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Pietro Cerutti <gahr@gahr.ch>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
flatcap pushed a commit that referenced this issue May 8, 2024
Protected header fields are part of the crypto message, which means the
sender considers them part of the important data, and should not be
carelessly weeded.

If the user want to do it, allow them via this variable, but default to
not weeding them.

Link: <#4223>
Link: <#4226>
Link: <#4227>
Link: <#4236>
Link: <#4237>
Cc: Richard Russon <rich@flatcap.org>
Reviewed-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: Pietro Cerutti <gahr@gahr.ch>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:upstream Also exists in upstream Mutt topic:security Security issue type:bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants