Re: [openpgp] AEAD Chunk Size

"Neal H. Walfield" <neal@walfield.org> Mon, 18 March 2019 14:23 UTC

Return-Path: <neal@walfield.org>
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 790A01312B6 for <openpgp@ietfa.amsl.com>; Mon, 18 Mar 2019 07:23:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aIzAbjbBTysP for <openpgp@ietfa.amsl.com>; Mon, 18 Mar 2019 07:23:35 -0700 (PDT)
Received: from mail.dasr.de (mail.dasr.de [217.69.77.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A39DD131294 for <openpgp@ietf.org>; Mon, 18 Mar 2019 07:23:26 -0700 (PDT)
Received: from p57b22663.dip0.t-ipconnect.de ([87.178.38.99] helo=grit.huenfield.org.walfield.org) by mail.dasr.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from <neal@walfield.org>) id 1h5tAh-00063O-RT; Mon, 18 Mar 2019 14:23:23 +0000
Date: Mon, 18 Mar 2019 15:23:23 +0100
Message-ID: <87mulsi7ms.wl-neal@walfield.org>
From: "Neal H. Walfield" <neal@walfield.org>
To: "Derek Atkins" <derek@ihtfp.com>
Cc: openpgp@ietf.org, "Vincent Breitmoser" <look@my.amazin.horse>
In-Reply-To: <431ea8fdaca6b3d20e19cfe2a14f6c96.squirrel@mail2.ihtfp.org>
References: <87d0n174w6.fsf@wheatstone.g10code.de> <87mumh33nc.wl-neal@walfield.org> <3GFS71V7BTJNZ.29C5TO8OY0O44@my.amazin.horse> <sjmy35isypu.fsf@securerf.ihtfp.org> <87r2bax5u2.wl-neal@walfield.org> <sjmlg1hskdq.fsf@securerf.ihtfp.org> <87pnqtwot9.wl-neal@walfield.org> <87y35hy2i0.fsf@wheatstone.g10code.de> <87k1h0we7w.wl-neal@walfield.org> <87va0g65ht.fsf@wheatstone.g10code.de> <87va0gioae.wl-neal@walfield.org> <431ea8fdaca6b3d20e19cfe2a14f6c96.squirrel@mail2.ihtfp.org>
User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/24.5 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)
MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue")
Content-Type: text/plain; charset=US-ASCII
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/Sb9DE78m_o_DJZPWfwGqA-i3ERo>
Subject: Re: [openpgp] AEAD Chunk Size
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.29
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: Mon, 18 Mar 2019 14:23:46 -0000

On Mon, 18 Mar 2019 14:57:37 +0100,
Derek Atkins wrote:
> On Mon, March 18, 2019 4:23 am, Neal H. Walfield wrote:
> > Hi Werner,
> > Can you please explain how to get ciphertext integrity when streaming?
> >
> > To be clear: for me, truncation is an orthogonal issue; my primary
> > concern is how to ensure that no implementations ever release
> > plaintext derived from modified ciphertext.
> 
> With or without AEAD?

Well, whatever :).  As I understand Werner, he agrees that ciphertext
integrity while streaming is desirable, and, I guess, thinks that is
achievable with the current draft.  I don't think it is possible, and
I've raised a few concerns in my prior mails.  I hope Werner can
address those concerns.

> > If you think that the current proposal achieves this, I've presented a
> > few critiques in <87mum6ekbd.wl-neal@walfield.org>
> > (https://mailarchive.ietf.org/arch/msg/openpgp/WvaisWDd9WzoKXL1FyHDeZNtZ2U):
> >
> >   1. If messages can't be decrypted, because a chunk won't fit in
> >      memory, but unauthenticated streaming would otherwise "work,"
> >      implementors will do the latter, because security must not get in
> >      the way of a user getting her job done.
> >
> >   2. If unauthenticated streaming is allowed or tacitly encouraged, it
> >      will be done first, because the set of messages that
> >      unauthenticated streaming can decrypt is a superset of those that
> >      authenticated decryption can handle, and it will perhaps be done
> >      exclusively because introducing a second code path that, modulo
> >      security concerns, is functionally equivalent to the code path
> >      for unauthenticated streaming is extra work, and extra
> >      complexity, which developers will try to avoid.
> >
> >   3. If implementations revert to unauthenticated streaming for large
> >      chunk sizes, an attacker can conduct an EFAIL-style attack by
> >      changing the chunk size.
> 
> Which implementation?  The sender or the receiver?

I'm assuming that the sender is using the best we have to offer, i.e.,
chunked AEAD.

I'm assuming that the receiver emits unauthenticated plaintext in some
situations.

> Also, who is the
> attacker?  The Sender?  Or a third party?

I'm thinking of something like EFAIL.  So, a third-party attacker who
modifies the ciphertext.


> The only attack is a DoS if the end is
> truncated, and the earlier (valid) chunks have already been released.
> 
> In other words, AEAD is used for each chunked block as a single, coherent
> piece.  Also I don't see how an attacker (third party) could leverage this
> at all.  They couldn't change the chunk size enroute.

I hacked Sequoia to emit unauthenticated data, and I was able to
change the chunk size and still get the plaintext of at least the
first chunk of a message.  So, my concern is: if a receiving
implementation releases unauthenticated plaintext for large chunks
rather than fail with ENOMEM, then a third-party attacker can change
the chunk size of an intercepted message, and cause the receiver to
process unauthenticated data, even though a small chunk size was
originally used.

> Each chunk is either
> authenticated, or an error occurs.  On error, it wouldn't be released.

The question for me is: what does an implementation do if it can't
buffer the message?  Does it really throw an error?  There already
exists at least one implementation written by an editor listed on
4880bis that processes unauthenticated plaintext.