Re: [openpgp] OpenPGP encryption block modes (Was: The Argon2 proposal seems incomplete (Draft 6))

Marcus Brinkmann <marcus.brinkmann@rub.de> Sat, 20 August 2022 01:38 UTC

Return-Path: <marcus.brinkmann@rub.de>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DCC5BC1524D1 for <openpgp@ietfa.amsl.com>; Fri, 19 Aug 2022 18:38:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.095
X-Spam-Level:
X-Spam-Status: No, score=-2.095 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_PDS_SHORTFWD_URISHRT_QP=0.01, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=rub.de
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id se_bA6JwJ41N for <openpgp@ietfa.amsl.com>; Fri, 19 Aug 2022 18:38:51 -0700 (PDT)
Received: from out1.mail.ruhr-uni-bochum.de (out1.mail.ruhr-uni-bochum.de [134.147.53.149]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DAA93C1522D4 for <openpgp@ietf.org>; Fri, 19 Aug 2022 18:38:50 -0700 (PDT)
Received: from mx1.mail.ruhr-uni-bochum.de (localhost [127.0.0.1]) by out1.mail.ruhr-uni-bochum.de (Postfix mo-ext) with ESMTP id 4M8h9L58Mrz8SGH; Sat, 20 Aug 2022 03:38:46 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rub.de; s=mail-2017; t=1660959526; bh=fb/uhG6BZVINd0aRheeI7y5ssSoocl4KB5uBTGus7CA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=On/bLn6BjZ2ykZdY1kIDVTw8f2neEQ4SXBPfDx32i3d4ui3J9JavAZLT+w9EvBEUk hEEAzFS2vwPL+opKhiMH4Jds/GMl6WPD1SYnA1sKca2oBB8iII3Cavto2odjqDwOXd k01SDsnrnOm2zV6RvZIB2pY8Bb9hJTxT+7ssM16o=
Received: from out1.mail.ruhr-uni-bochum.de (localhost [127.0.0.1]) by mx1.mail.ruhr-uni-bochum.de (Postfix idis) with ESMTP id 4M8h9L4QRHz8SGD; Sat, 20 Aug 2022 03:38:46 +0200 (CEST)
X-RUB-Notes: Internal origin=IPv6:2a05:3e00:c:1001::8693:2aec
X-Envelope-Sender: <marcus.brinkmann@rub.de>
Received: from mail2.mail.ruhr-uni-bochum.de (mail2.mail.ruhr-uni-bochum.de [IPv6:2a05:3e00:c:1001::8693:2aec]) by out1.mail.ruhr-uni-bochum.de (Postfix mi-int) with ESMTP id 4M8h9L1kTwz8SFr; Sat, 20 Aug 2022 03:38:46 +0200 (CEST)
X-Virus-Status: Clean
X-Virus-Scanned: clamav-milter 0.104.1 at mx1.mail.ruhr-uni-bochum.de
Received: from smtpclient.apple (p4fe3f2a6.dip0.t-ipconnect.de [79.227.242.166]) by mail2.mail.ruhr-uni-bochum.de (Postfix) with ESMTPSA id 4M8h9K4flkzDgyg; Sat, 20 Aug 2022 03:38:45 +0200 (CEST)
X-Virus-Status: Clean
X-Virus-Scanned: clamav-milter 0.104.2 at mail2.mail.ruhr-uni-bochum.de
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\))
From: Marcus Brinkmann <marcus.brinkmann@rub.de>
In-Reply-To: <Yv/2F7+muV0/JPo4@watt.59.ca>
Date: Sat, 20 Aug 2022 03:38:45 +0200
Cc: openpgp@ietf.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <07340226-1E01-47AC-BB53-362E99D1288D@rub.de>
References: <YuAErZRsF/KbOw1s@watt.59.ca> <87edy7keb6.fsf@thinkbox> <YuFc+w02FiRQmHcg@watt.59.ca> <87bktajjvq.fsf@thinkbox> <YuKpxp0/Dy1DfC19@watt.59.ca> <875yjhjg2c.fsf@thinkbox> <87r124m64c.fsf@wheatstone.g10code.de> <YulX9jI1+wOCwLJq@ohm.59.ca> <845A0B33-D115-4BA7-BD4D-ED76B72E0EB3@rub.de> <Yv/2F7+muV0/JPo4@watt.59.ca>
To: Bruce Walzer <bwalzer@59.ca>
X-Mailer: Apple Mail (2.3693.60.0.1.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/rSgb5ETZgaeT2X2o69qrvkOII60>
Subject: Re: [openpgp] OpenPGP encryption block modes (Was: The Argon2 proposal seems incomplete (Draft 6))
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 20 Aug 2022 01:38:55 -0000

Hi,

> Am 19.08.2022 um 22:44 schrieb Bruce Walzer <bwalzer@59.ca>:
> 
> On Mon, Aug 08, 2022 at 09:19:15PM +0200, Marcus Brinkmann wrote:
>>> Am 02.08.2022 um 18:59 schrieb Bruce Walzer <bwalzer@59.ca>:
>>> AEAD isn't even a very accurate term in an OpenPGP context. There is
>>> no AD (associated data) exposed to the user of such a system. It just
>>> doesn't work that way.
>> 
>> It would be very useful to expose AD in OpenPGP to users to prevent exfiltration attacks in the context of email. See our research at [1].
> [...]
>> [1] Jörg Schwenk, Marcus Brinkmann, Damian Poddebniak, Jens Müller, Juraj Somorovsky, and Sebastian Schinzel. 2020. Mitigation of Attacks on Email End-to-End Encryption. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security (CCS '20). Association for Computing Machinery, New York, NY, USA, 1647–1664. https://doi.org/10.1145/3372297.3417878
>> 
>> Preprint available here: https://www.nds.ruhr-uni-bochum.de/media/nds/veroeffentlichungen/2020/12/06/schwenk2020.pdf
> 
> Correct me if I am wrong, but the basic idea here is to include
> information about the context that existed at the time of encryption
> in the associated data (AD) of a AEAD encrypted packet. A receiver of
> such a packet could then check to see if the context had changed, and
> if it had, if it had changed in a reasonable way.

That’s one way to do it, but what we are proposing is more severe: The context is not included in the message, but has to be reconstructed at the recipient side from the actual context that is seen there. So, if the context changes, the recipient can not decrypt anymore.

There is a tradeoff made here.

* Not including the context protects against implementation errors, because it is much harder for developers to accidentally or on purpose ignore context changes and subsequently process unauthenticated plaintext. Which was exactly the failure mode responsible for Efail (recall that Efail worked despite SEIPD-MDC because implementations revealed unauthenticated plaintext and ignored integrity check failures).

* Including the context allows recovery of plaintext in case the context is lost, for example when relevant email headers are changed by email servers during transport (false positive). We evaluated that for the email servers we tested, email headers and MIME structure were preserved (with the exception of Outlook, which has since been fixed AFAIK).

>> From the linked paper:
> 
>> ...EFAIL-MG has been mitigated in IETF standards with the
>> introduction of Authenticated Encryption with Associated Data (AEAD)
>> algorithms.
> 
> I don't accept that the addition of AEAD modes to the standard
> provides any benefit over what can be done with the exiting well
> standardized SEIPD-MDC mode against EFAIL-MG. So I can't assume that
> any mode with AD has to exist. This would have to stand as a argument
> to provide such a mode on its own to be compelling to me.

In an earlier revision of our paper we included a security proof for a legacy construction based on a PRF with a collision-resistant hash function and a CPA-secure and INT-CTXT secure cipher. This can be shown to be equivalent to an AEAD construction.

SEIPD-MDC is not quite there. We don’t have any security proofs for this construction, but just from looking at it, it can at best only achieve INT-PTXT (because the MDC protects the integrity of the plaintext, rather than the ciphertext). So, you will never get the same security notion from SEIPD-MDC as for an AEAD mode. However, if plaintext integrity is good enough for you, SEIPD-MDC can certainly also be extended to include a context in a similar way as we did.

My personal opinion is that the stronger security notion INT-CTXT that you get from an AEAD mode is strongly preferable, as it protects against format oracle attacks such as the Vaudenay-Oracle. Now, it’s a happy circumstance that OpenPGP uses a variant of CFB rather than CBC, so it does not have a padding scheme. This means that Vaudenay is not directly applicable. However, the plaintext does have internal structure and validity checks, so other oracles are potentially possible (a well known example is the „quick check“ that is mentioned in the spec, but there are more, for example decompression failures, as I reported recently on this list even for AEAD in GnuPG). These attacks are well understood by the academic research community, but they do require an oracle that can be queried multiple times by an attacker to be exploited. Such oracles are difficult to construct for OpenPGP only because of its limited use in the real world, not(!) because of its security notions. From my perspective, this is just an accident waiting to happen. Anyway, that’s the case I would make for AEAD (or any other INT-CTXT-secure encryption mode).

> Would sending this context data in plain text as AD even be the best
> choice here? Wouldn't it be better to prevent attacker knowledge of
> this data by encrypting it? Why give the attacker information about
> the context they would have to forge?

Thank you for this question. As I said above, our proposal is not to include the context explicitly in the OpenPGP data, but to let the recipient infer it from the actual context seen. This also implies that the context can only include things that are public.

This may be seen as a disadvantage in some use cases, but note that the sender decides what the context is (our proposal includes a way for the sender to specify the decryption context policy, and of course the sender also sets the actual headers and MIME structure of the outgoing email). So, a sender that has privacy concerns can limit the context in any way that seems appropriate to their use case.

> One way this might be done would be to define a new packet type for
> context and add that packet into the encrypted SEIPD-MDC packet. That,
> in theory, would be entirely compatible with existing usage. That
> would be as opposed to creating AEAD packets that are entirely
> incompatible with existing usage.

The principled argument against that construction is that it requires the recipient to process unauthenticated plaintext, which gives the attacker an attack surface to launch oracle attacks. However, there are also non-legalistic arguments against this. Consider an Efail-attacker with a malleability gadget, and a vulnerable implementation that does not achieve even INT-PTXT security (as was the case for email clients vulnerable against Efail). It is conceivable that this allows the attacker to construct a cipher text with a context that matches the attack email, defeating the whole purpose of the context parameter. This is a chicken-and-egg problem: The context can’t be included in the cipher text (or plaintext), because it is intended to authenticate the cipher text (or plaintext).

Thanks,
Marcus

—
Dipl.-Math. Marcus Brinkmann

Lehrstuhl für Netz- und Datensicherheit
Ruhr Universität Bochum
Universitätsstr. 150, Geb. ID 2/461
D-44780 Bochum

Telefon: +49 (0) 234 / 32-25030
http://www.nds.rub.de/chair/people/mbrinkmann