Subject: [openpgp] PGP/MIME, RFC 3156, Require empty boundary preamble lines

From: Kai Engert <[email-masked]>
Date: Mon, 20 Sep 2021 11:57:53 +0200

Hello,

is this list an appropriate place to discuss PGP/MIME topics?

Please see the following example message:
https://bugzilla.mozilla.org/show_bug.cgi?id=1690603#c16

There is one line marked with
"---> preamble line inside signed content".

Thunderbird 78 had added a non-empty preamble line, which was removed by 
a mail transport agent, causing the signature verification to fail.

Perhaps a future revision of RFC 3156 could state that preamble lines 
inside the signed payload MUST be empty - in the hope that no transport 
agent will add their own preamble lines.

(TB 91 contains a coincidental change that produces empty preamble 
lines, I haven't yet investigated what had caused this, but it likely 
has the side effect to fix the reported scenario.)

I don't know if there are any transport agents that ADD preamble lines - 
hopefully there aren't.

Regards
Kai

---

From: Werner Koch <[email-masked]>
Date: Mon, 20 Sep 2021 16:57:32 +0200

> is this list an appropriate place to discuss PGP/MIME topics?

Sure.

> Thunderbird 78 had added a non-empty preamble line, which was removed
> by a mail transport agent, causing the signature verification to fail.

Welcome to the party.  Unfortunately there are many mail processing
services which don't care about the MIME standard and willy-nilly modify
messages or MIME header at any encapsulation level.  I have seen changed
content-encoding, new MIME header lines, or changed boundaries.  It is
quite common that signatures break as soon as they pass though some very
helpful tools which have been sold to companies to "secure" their
communication.

To be fair; things are better than 10 years ago and most signed mail
check out nicely (unless they got filtered out as spam as a few
corporate mail gateways do).

> inside the signed payload MUST be empty - in the hope that no

I dont think that this is a good idea.  First it is not an PGP/MIME but
a general MIME issue, and second it solves only one of the problems with
broken mail processing software.

Shalom-Salam,

   Werner

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

---

From: Daniel Kahn Gillmor <[email-masked]>
Date: Wed, 22 Sep 2021 22:03:40 -0400

> agent will add their own preamble lines.

RFC 3156 describes (among other things) how to use OpenPGP in the
context RFC 1847 multipart/signed messages.

RFC 1847 §2.1 already says:

>   The entire contents of the multipart/signed container must be treated
>   as opaque while it is in transit from an originator to a recipient.
>   Intermediate message transfer agents must not alter the content of a
>   multipart/signed in any way, including, but not limited to, changing
>   the content transfer encoding of the body part or any of its
>   encapsulated body parts.

If the MTA that mangled the sample message is not treating the signed
message content as opaque, they are already inviolation of RFC 1847.
Making a revision to make those MTAs "more" in violation seems unlikely
to cure the problem.

The best we can do here, i think, is to encourage MUAs to generate
minimally-fancy MIME messages (i.e., empty preamble and postamble seem
the simplest possible, and therefore least likely to be tampered with,
since stripping of preamble and postamble seem like the most likely form
of tampering) and encourage MTAs to comply with the now
quarter-century-old standards that were surely available to them at the
time the current operating version was released.

   --dkg

---

From: Kai Engert <[email-masked]>
Date: Thu, 23 Sep 2021 11:38:06 +0200

Daniel and Werner, thanks for your explanations, they are very helpful.

Regards
Kai