Re: [lamps] [EXTERNAL] Re: Security Consideration for draft-turner-lamps-nist-pqc-kem-certificates

Nimrod Aviram <nimrod.aviram@gmail.com> Fri, 25 March 2022 16:13 UTC

Return-Path: <nimrod.aviram@gmail.com>
X-Original-To: spasm@ietfa.amsl.com
Delivered-To: spasm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 76D453A10E2 for <spasm@ietfa.amsl.com>; Fri, 25 Mar 2022 09:13:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.107
X-Spam-Level:
X-Spam-Status: No, score=-2.107 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 wPsKnfs77J2D for <spasm@ietfa.amsl.com>; Fri, 25 Mar 2022 09:13:06 -0700 (PDT)
Received: from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com [IPv6:2607:f8b0:4864:20::a2a]) (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 0E7C23A1111 for <spasm@ietf.org>; Fri, 25 Mar 2022 09:13:06 -0700 (PDT)
Received: by mail-vk1-xa2a.google.com with SMTP id q85so4473175vkq.4 for <spasm@ietf.org>; Fri, 25 Mar 2022 09:13:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OVv/R5GMqAB5Qy/pUTzD1nKejz2FP3p6oBZziBTdk7s=; b=bG3Loun8a2a20Z7+v8OG7qBDL3KZK5R8Lger6KWxAOinh1HeVNAx0aLQCOzVcTI6qV d+7649x+n+fZob/c+CTo8ioSnigZEBwQk2B54HLkFfNqtktglrzvZfWVQLon38cWiAon 9IKwKQ8QnQpUCb26cTvSdhp8QsVLAB5/dsMOdB/1hdy/VEFsnvREwzFDTOw2PsSy/X/f TCEfgzu/cgfKWaZRClXTXjmrymdB8i/Yr+w2Q40V+Xxb9eu2llFUjDxbLOqDszLoul7C /9QEM+/haDHUKwgRwg811q0ndCuAW9Cd2zjx1OvrctpdH/HbAAlM1g4ClU7yegjNWUit rdEQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OVv/R5GMqAB5Qy/pUTzD1nKejz2FP3p6oBZziBTdk7s=; b=iQqCce9F9PLZ7DGSbq7/I7XnFJhqR4A95zZHvxwlfEArexMtzUlAlsKqxhRFYCpaLH 2KaVCnwEtC0LumWdxb0PXeqsetujqFIcFP2ik4ud7qAK56lxLycVhxdsG/gH6cZNqQJS ZJcpHQEFpzMFOZJPsbn1c8M0xkPpcxN+Kk4u2ZiNP/Bax/gGT9RBFV0BlW+rnwwTnVXh muM+gSsY+pLOzC1+TydphGq28ObNTEZJT/RERMySkmuy95mZxMJM9vDQrY4ue/n81/Cp xQfAOdVMWfrXjnnp2QRtOxQc7jvpwKI/kqxlze0wVHqbMWAvngzbm+StxAw6Q2Ywq/AL b5yw==
X-Gm-Message-State: AOAM5323H8ZFmII7/Y/aOqGvQqW/54zTHCP+CnVbI9qv6U9xGoK/BNMM s4vJmLW4uV/4y3VWHnljAAyda/bn/ArO7n8ZMIM=
X-Google-Smtp-Source: ABdhPJwUBc0PMuhP+UEb36vQfgxCh0f8H7dCaderReyAb6xTDGl+tQ59qOJLPa1fiZAYeb6u01WR1WIshrHi35+zJC4=
X-Received: by 2002:ac5:c302:0:b0:33f:bc83:953 with SMTP id j2-20020ac5c302000000b0033fbc830953mr4943043vkk.18.1648224784543; Fri, 25 Mar 2022 09:13:04 -0700 (PDT)
MIME-Version: 1.0
References: <CH0PR11MB5739B640691C4692D6343E219F1A9@CH0PR11MB5739.namprd11.prod.outlook.com> <LO0P123MB404186BF69C1FCC6275E7560D71A9@LO0P123MB4041.GBRP123.PROD.OUTLOOK.COM> <CH0PR11MB5739C9106FBE6D82E6B1EC1D9F1A9@CH0PR11MB5739.namprd11.prod.outlook.com> <19CA2384-E8A9-4E8F-9AA7-F8175393F065@gmail.com> <CH0PR11MB5739FFCC0723B521224BE9C59F1A9@CH0PR11MB5739.namprd11.prod.outlook.com>
In-Reply-To: <CH0PR11MB5739FFCC0723B521224BE9C59F1A9@CH0PR11MB5739.namprd11.prod.outlook.com>
From: Nimrod Aviram <nimrod.aviram@gmail.com>
Date: Fri, 25 Mar 2022 19:12:53 +0300
Message-ID: <CABiKAoQqhNgcLKfk2NzfpxF-xjh+Kz+m9Zfx4Lw4U9qQt6iSQQ@mail.gmail.com>
To: Mike Ounsworth <Mike.Ounsworth@entrust.com>
Cc: Douglas Stebila <dstebila@gmail.com>, Florence D <Florence.D=40ncsc.gov.uk@dmarc.ietf.org>, LAMPS <spasm@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000caf51805db0d3c80"
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/IiCcOHNE_DSTpQTpmX_Lcugibd8>
Subject: Re: [lamps] [EXTERNAL] Re: Security Consideration for draft-turner-lamps-nist-pqc-kem-certificates
X-BeenThere: spasm@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is a venue for discussion of doing Some Pkix And SMime \(spasm\) work." <spasm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/spasm>, <mailto:spasm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm/>
List-Post: <mailto:spasm@ietf.org>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/spasm>, <mailto:spasm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 25 Mar 2022 16:13:12 -0000

If it's envisioned that concatenate-and-hash is used with variable-length
shared secrets, padding the first secret such that it always occupies a
multiple of the hash function block size should stop attacks of this type
(APOP-style attacks).

I agree with Ilari (downthread) that truncating could have unexpected
consequences.

Also, variable-length KEMs indeed open the door to Raccoon-style attacks
that attempt to time the hash calculation in order to learn information
about the secret. I agree with Doulgas that this might merit some extra
care, esp. if using peculiar algorithms. At first glance, it seems that
requiring all KEMs to either be CCA-secure or to have fixed length should
prevent Raccoon-style attacks, but obviously this requires more careful
analysis.

best,
Nimrod



On Fri, 25 Mar 2022 at 16:30, Mike Ounsworth <Mike.Ounsworth@entrust.com>
wrote:

> > So if your scenario envisions concatenating a traditional (RSA/FFDH/ECC)
> shared secret and a PQ shared secret, one would want to be sure the first
> component of the concatenation is not variable length.
>
> Another good point!
>
> Thinking out loud: does padding solve the problem?
>
> H(ss_1 || ss_2 || .. || ss_n)
>
> if ss_i are each padded / truncated to, say, the security level of the
> underlying hash function, does that work?
>
> ---
> Mike Ounsworth
>
> -----Original Message-----
> From: Douglas Stebila <dstebila@gmail.com>
> Sent: March 25, 2022 8:24 AM
> To: Mike Ounsworth <Mike.Ounsworth@entrust.com>
> Cc: Florence D <Florence.D=40ncsc.gov.uk@dmarc.ietf.org>; LAMPS <
> spasm@ietf.org>; Nimrod Aviram <nimrod.aviram@gmail.com>
> Subject: [EXTERNAL] Re: [lamps] Security Consideration for
> draft-turner-lamps-nist-pqc-kem-certificates
>
> WARNING: This email originated outside of Entrust.
> DO NOT CLICK links or attachments unless you trust the sender and know the
> content is safe.
>
> ______________________________________________________________________
> On Mar 25, 2022, at 9:14 AM, Mike Ounsworth <Mike.Ounsworth@entrust.com>
> wrote:
> >
> > > assuming that we use the NIST algorithms as they’re defined, the
> length of the shared secret shouldn't be ambiguous as it will be part of
> the parameter set for the KEM.
> >
> > Oh that’s good to know!
> > I saw that many (most? all?) of the remaining KEMs use SHAKE as their
> last internal step, so in theory they are variable-length, but if the NIST
> specs will fix the output length then that’s probably sufficient.
>
> All of the round 3 KEM finalists and alternate candidates have fixed
> length shared secrets, even if they happen to be using the extendable
> output function SHAKE internally while generating the shared secret.
>
> But it's not just the PQ shared secret that would need to be fixed
> length.  If one is concatenating two shared secrets and then hashing --
> H(ss_1 || ss_2) -- the concern arises when ss_1 is variable-length.  So if
> your scenario envisions concatenating a traditional (RSA/FFDH/ECC) shared
> secret and a PQ shared secret, one would want to be sure the first
> component of the concatenation is not variable length.  For TLS 1.3 key
> exchange, the number of standardized curves is quite small so one can
> reasonably have confidence the scenario won't arise.  For general
> certificates with arbitrary algorithms, I can see there being a long tail
> of peculiar algorithms, some of which might be variable-length, so this
> scenario might merit some extra care.
>
> > At the TLS WG this week, Douglas Stebila presented on a known issue in
> the hybrid KEM combiner they’re proposing for TLS
> (draft-ietf-tls-hybrid-design): it gets into trouble if the attacker gets
> to play with the lengths of the shared secrets at runtime. Obvious
> solution: KEM codepoints need to fix the SS length in the spec so that it’s
> not variable at runtime.
>
>
> To be clear on the context here, there are additional requirements that
> have to be satisfied for there to be trouble, not the least of which is the
> ability to find collisions in the hash function used on concatenated
> secrets.
>
> Douglas
>
> >
> > The experts in this case are @Nimrod Aviram, and @Douglas Stebila.
> >
> > ---
> > Mike Ounsworth
> >
> > From: Florence D <Florence.D=40ncsc.gov.uk@dmarc.ietf.org>
> > Sent: March 25, 2022 8:09 AM
> > To: Mike Ounsworth <Mike.Ounsworth@entrust.com>; 'LAMPS' <spasm@ietf.org
> >
> > Subject: [EXTERNAL] RE: [lamps] Security Consideration for
> draft-turner-lamps-nist-pqc-kem-certificates
> >
> > WARNING: This email originated outside of Entrust.
> > DO NOT CLICK links or attachments unless you trust the sender and know
> the content is safe.
> > > We’re putting together a draft which provides essentially the same
> combiner for hybrid CMS content encryption (yuck terminology hell. Florence
> D. please save us and write a terminology draft!).
> >
> > Very happy to write something.  I suspect the word hybrid is already so
> overloaded that agreeing on anything will be much more difficult but I’m
> happy to get started.
> >
> > > At the TLS WG this week, Douglas Stebila presented on a known issue in
> the hybrid KEM combiner they’re proposing for TLS
> (draft-ietf-tls-hybrid-design): it gets into trouble if the attacker gets
> to play with the lengths of the shared secrets at runtime. Obvious
> solution: KEM codepoints need to fix the SS length in the spec so that it’s
> not variable at runtime.
> > On the shared secret length, assuming that we use the NIST algorithms as
> they’re defined, the length of the shared secret shouldn't be ambiguous as
> it will be part of the parameter set for the KEM.  If we’re proposing doing
> something different then this probably merits some security analysis of its
> own.   I’ll defer to more experienced protocol designers on whether it’s
> worth encoding the length in the codepoint if it’s implicit from the
> scheme, I’m not sure of the precedent.
> >
> > Flo
> >
> > From: Spasm <spasm-bounces@ietf.org> On Behalf Of Mike Ounsworth
> > Sent: 25 March 2022 11:17
> > To: 'LAMPS' <spasm@ietf.org>
> > Subject: [lamps] Security Consideration for
> draft-turner-lamps-nist-pqc-kem-certificates
> >
> > The comment I was going to make at the mic:
> >
> > At the TLS WG this week, Douglas Stebila presented on a known issue in
> the hybrid KEM combiner they’re proposing for TLS
> (draft-ietf-tls-hybrid-design): it gets into trouble if the attacker gets
> to play with the lengths of the shared secrets at runtime. Obvious
> solution: KEM codepoints need to fix the SS length in the spec so that it’s
> not variable at runtime.
> >
> > We’re putting together a draft which provides essentially the same
> combiner for hybrid CMS content encryption (yuck terminology hell. Florence
> D. please save us and write a terminology draft!).
> > For that combiner to avoid the attack, I think we need Sean’s KEM OIDs
> draft to fix the shared secret length for each KEM that it specifies.
> >
> > So for now I think I’m just asking @Sean to throw a Security
> Consideration into his draft so we don’t forget that it’s important.
> >
> > ---
> > Mike Ounsworth
> > Software Security Architect, Entrust
> >
> > Any email and files/attachments transmitted with it are confidential and
> are intended solely for the use of the individual or entity to whom they
> are addressed. If this message has been sent to you in error, you must not
> copy, distribute or disclose of the information it contains. Please notify
> Entrust immediately and delete the message from your system. This
> information is exempt under the Freedom of Information Act 2000 (FOIA) and
> may be exempt under other UK information legislation. Refer any FOIA
> queries to ncscinfoleg@ncsc.gov.uk. All material is UK Crown Copyright ©
>
>