Re: [IPsec] AD review of draft-ietf-ipsecme-qr-ikev2-08

Paul Wouters <paul@nohats.ca> Tue, 05 November 2019 03:39 UTC

Return-Path: <paul@nohats.ca>
X-Original-To: ipsec@ietfa.amsl.com
Delivered-To: ipsec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0CDEB12003F; Mon, 4 Nov 2019 19:39:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.997
X-Spam-Level:
X-Spam-Status: No, score=-1.997 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=nohats.ca
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 l-sDThe3r2oW; Mon, 4 Nov 2019 19:39:53 -0800 (PST)
Received: from mx.nohats.ca (mx.nohats.ca [193.110.157.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 47A03120020; Mon, 4 Nov 2019 19:39:53 -0800 (PST)
Received: from localhost (localhost [IPv6:::1]) by mx.nohats.ca (Postfix) with ESMTP id 476b5L30yxz398; Tue, 5 Nov 2019 04:39:50 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nohats.ca; s=default; t=1572925190; bh=0KTCHzKSh8aILH71LqSm61Ywi3RI/iXj0IzA/0nT6JQ=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=tcNOiqyJn+n1u7NNOiRFHow+Rj/r9PzYG76AS9ypH7bUp5AqCaKPGwkhbxQIT2TGs iZd3nQxqPMeHT+6tzK5KJeFMh3QoIE9JQnIzvsSW8qb5YNVYbl8fgf4X+X3pRipL8J PrwPPcY42oT32/QgRlHYSQsdD1uM3kHNZipAo2GI=
X-Virus-Scanned: amavisd-new at mx.nohats.ca
Received: from mx.nohats.ca ([IPv6:::1]) by localhost (mx.nohats.ca [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id T1Kj9cY6q2Ue; Tue, 5 Nov 2019 04:39:47 +0100 (CET)
Received: from bofh.nohats.ca (bofh.nohats.ca [76.10.157.69]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.nohats.ca (Postfix) with ESMTPS; Tue, 5 Nov 2019 04:39:47 +0100 (CET)
Received: by bofh.nohats.ca (Postfix, from userid 1000) id 51B2E6007C4D; Mon, 4 Nov 2019 22:39:46 -0500 (EST)
Received: from localhost (localhost [127.0.0.1]) by bofh.nohats.ca (Postfix) with ESMTP id 4DFC323D09D; Mon, 4 Nov 2019 22:39:46 -0500 (EST)
Date: Mon, 04 Nov 2019 22:39:46 -0500
From: Paul Wouters <paul@nohats.ca>
To: Benjamin Kaduk <kaduk@mit.edu>
cc: draft-ietf-ipsecme-qr-ikev2.all@ietf.org, ipsec@ietf.org
In-Reply-To: <20191105023831.GH55993@kduck.mit.edu>
Message-ID: <alpine.LRH.2.21.1911042155390.10876@bofh.nohats.ca>
References: <20191105023831.GH55993@kduck.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"; format="flowed"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipsec/h7hyNrbDChI7ZKzT9P5F7ioaVqc>
Subject: Re: [IPsec] AD review of draft-ietf-ipsecme-qr-ikev2-08
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Discussion of IPsec protocols <ipsec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipsec>, <mailto:ipsec-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ipsec/>
List-Post: <mailto:ipsec@ietf.org>
List-Help: <mailto:ipsec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipsec>, <mailto:ipsec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 05 Nov 2019 03:39:57 -0000

On Mon, 4 Nov 2019, Benjamin Kaduk wrote:

[ignoring the nits and leaving that to the authors, although reading it
again I would like to see "he" and "she" replaced by "it" everwhere]

>   It is an open question whether or not it is feasible to build a
>   Quantum Computer (and if so, when one might be implemented), but if
>
> Feasibility of some quantum computer is becoming much less of an open
> question; perhaps we want some qualifiers about efficiency, scale,
> and/or general-purpose-nature.

It all depends on the algorithms these machines support as well as their
key size. It's hard to read the the quantum marketing to know what to
believe :)

>   would be compromised.  IKEv1 [RFC2409], when used with strong
>   preshared keys, is not vulnerable to quantum attacks, because those
>   keys are one of the inputs to the key derivation function.  If the
>   preshared key has sufficient entropy and the PRF, encryption and
>   authentication transforms are postquantum secure, then the resulting
>   system is believed to be quantum resistant, that is, invulnerable to
>   an attacker with a Quantum Computer.
>
> Do we have a reference for this "it is believed", or is it just the
> outcome of the WG discussions?

These are one-way functions with unknown input. There is no way to
reverse that using any known quantum algorithm.

>   The general idea is that we add an additional secret that is shared
>   between the initiator and the responder; this secret is in addition
>   to the authentication method that is already provided within IKEv2.
>   We stir this secret into the SK_d value, which is used to generate
>   the key material (KEYMAT) and the SKEYSEED for the child SAs; this
>   secret provides quantum resistance to the IPsec SAs (and any child
>   IKE SAs).  We also stir the secret into the SK_pi, SK_pr values; this
>   allows both sides to detect a secret mismatch cleanly.
>
> With apologies for the pedanticism, let's be careful what wording we
> use, as just mixing into SK_d is not necessarily enough to get quantum
> resitsance for the parent IPsec SA.
> [need to check this some more]

It is not, but none of the above thanks about the Parent SA. It only
talks about the Child SA (AKA IPsec SA)

> Every directorate reviewer and IESG member is going to suggest that we
> use the RFC 8174 version of the boilerplate, if we don't preemptively do
> so :)

To be fair, I had to check the publication date of 8174 to see which was
older - the RFC of the latest version of this draft waiting for the AD :)

>   This PPK is independent of the preshared key (if any) that the IKEv2
>
> I expect us to get a few questions about why we need a separate PPK in
> cases when an authentication psk is also available; a short note here
> might forestall such questions.  (It's needed because PSK for auth does
> not feed into any of the other key derivations, right?)

Correct, the PSK is only used in the AUTH payload calculation. In IKEv1, it
was also mixed into the SKEYSEED, and so a mismatched PSK lead to a
garbled unreadable IKE packet which was not nice for administrators to
debug. In IKEv2 this was changed so we can provide proper error messages
on a wrong PSK. But we did lose the post-quantum protection.

>   N(USE_PPK) is a status notification payload with the type 16435; it
>   has a protocol ID of 0, no SPI and no notification data associated
>   with it.
>
> [check the IANA status of the value]

Those values have been used already for interoperability tests between
libreswan, strongswan, elvis+, cisco and apple :)

>   responder included the USE_PPK notification.  If the responder did
>   not and the flag mandatory_or_not indicates that using PPKs is
>   mandatory for communication with this responder, then the initiator
>   MUST abort the exchange.  This situation may happen in case of
>
> We might get some directorate questions about what it means to "abort
> the exchange"; I note that RFC 7296 does not use that terminology,
> though I'm perfectly happy to leave this as-is and see if we get any ADs
> that are concerned about it.

It could be rephased as "abort the exchange by sending an AUTHENTICATION_FAILED
error notify message back to the initiator".

>   If the responder did not include the USE_PPK notification and using a
>   PPK for this particular responder is optional, then the initiator
>   continues with the IKEv2 protocol as normal, without using PPKs.
>
> Do we want to say anything about logging or notifications for this case,
> in case someone is concerned about the level of quantum-resistance in
> use?

That could be done. I just checked our implementation, and we seem to
not be tracking informational notifies, only error notifies (as can be
seen here: https://vpn.nohats.ca/munin/vpn-month.html on a test server)
and indeed we should add it to our implementation. And having a line of
text here would have cause implementors to do so :)

>   If the responder did include the USE_PPK notification, then the
>   initiator selects a PPK, along with its identifier PPK_ID.  Then, she
>   computes this modification of the standard IKEv2 key derivation:
>
> Just to double-check: the responder's USE_PPK is just a boolean "I'm
> willing to do PPK", right?  So we don't really hae a signal as to which
> PPK_IDs the peer thinks are valid?

Right. You would not want to tell an unauthenticated peer which IDs are
valid. In the case of a remote access VPN, you would have too many valid
IDs to share. Also in case of using ephemeral or pseudo-random IDs, you
couldn't have a complete list of these.

>   That is, we use the standard IKEv2 key derivation process except that
>   the three subkeys SK_d, SK_pi, SK_pr are run through the prf+ again,
>   this time using the PPK as the key.  Using prf+ construction ensures
>
> Do we want to say anything about why only these three values need the
> PPK mixed in to them?  (I guess the idea is that the parent SA is
> "short-lived" on the timescale of a quantum computer and the messages
> protected directly by it are not of interest to an attacker years in the
> future.  This does mean that this scheme does not provide much value
> when a quantum computer is available at the time of the exchange,
> though, right?

Practically all information that is in the parent can be learned by an
active attacker that has no valid credentials, that MITMs a connection.
The exception to this are the traffic selectors of the IPsec SA.

Additionally, if you care about this, you can first establish a
childless Parent SA, then do a Parent SA rekey that uses the PPK, and
only when you are quantum-safe, do a create_child_sa for the IPsec SA.
That way, no traffic selectors are available even if the initial Parent
SA is compromised by a quantum computer. Similarly, if you believe a
quantum computer would be fast enough to do real time attacks on the
Parent SA, this trick prevents someone with such a quantum computer from
sending valid IKE packets. Although even there, the damage that can be
done is very limited - send a keepalive probe, a delete request, or a
rekey or create request. Note that a compromised Parent SA does _not_
lead to compromised Child SA (IPsec SA) because the PPK is not known
to the attacker even after cracking the Parent SA encryption.


>   The responder then continues with the IKE_AUTH exchange (validating
>   the AUTH payload that the initiator included) as usual and sends back
>   a response, which includes the PPK_IDENTITY notification with no data
>   to indicate that the PPK is used in the exchange:
>
> Why does the responder not need to transmit an explicit PPK_ID?  (I see
> that the following paragraph says that the initiatore MUST ignore any
> content to that notification, but why?)

The identity of the responder is always known to the initiator. It is
the responder they set out to reach. They already know which PPK to
use with that. The responder however, might not know which of the many
valid initiators out there is trying to reach them, so they need to be
told.

>      Initiator                         Responder
>      ----------------------------------------------------------------
>      HDR, SK {IDi, [CERTREQ,]
>          [IDr,] SAi2,
>          TSi, TSr}  -->
>                                   <--  HDR, SK {IDr, [CERT,] AUTH,
>                                            EAP}
>      HDR, SK {EAP}  -->
>                                   <--  HDR, SK {EAP (success)}
>      HDR, SK {AUTH,
>          N(PPK_IDENTITY, PPK_ID)
>          [, N(NO_PPK_AUTH)]}  -->
>                                   <--  HDR, SK {AUTH, SAr2, TSi, TSr
>                                        [, N(PPK_IDENTITY)]}
>
> Am I missing something subtle as to why N(PPK_IDENTIFY) is listed as
> optional here in the EAP case but not in the previous diagram for the
> non-EAP case?

You found a real bug :)

>
>   NO_PPK_AUTH notification.  If both the responder and initiator have
>   been upgraded and properly configured, they will both realize it, and
>   in that case, the link will be quantum secure.
>
> I think that "the link will be quantum secure" is probably overselling
> things a little bit; for one, the confidentiality protection we provide
> is only for the child SAs, and the discussion earlier in the document is
> about providing protection for current connections against future
> development of a quantum computer, while most people probably think of
> full "quantum secure" as being protection even against a current quantum
> computer.

Instead of the "link", it should probably talk about the IPsec SA being
quantum secure. A disclaimer like "based on current academic knowledge"
could be added :P

>      value.  Not all implementations are able to configure arbitrary
>      octet strings; to improve the potential interoperability, it is
>      recommended that, in the PPK_ID_FIXED case, both the PPK and the
>      PPK_ID strings be limited to the base64 character set, namely the
>      64 characters 0-9, A-Z, a-z, + and /.
>
> I don't have much experience with the conventions in this space; does it
> make sense to distinguish between the PPK representation as configured
> (which would use the base64 alphabet) and the "actual PPK" that could be
> binary after, e.g., a base64-decoding step?  I guess it could be
> reasonable to rely on the ability of the PRF to take an arbitrary-length
> input and just have sufficient entropy even while limiting the PPK value
> to the base64 alphabet.

Based on operational experience, anything not following the above will
run into interoperability problems. Often people cannot even input a hex
PSK, so we felt it better to just avoid the PSK issues we know about
with the new PPK. Similarly, ID_KEY_ID is an ID type that is mostly
useless in IKE because it is configured differently on each
implementation.

>   The PPK_ID type value 0 is reserved; values 3-127 are reserved for
>   IANA; values 128-255 are for private use among mutually consenting
>   parties.
>
> I guess that anything done in the 128-255 range could also be done under
> the PPK_ID_OPAQUE space (at the cost of an extra octet), but I don't
> object to this breakdown.

Yes. It was mostly done because implementers like something easy to
compare, and do not like "sub-typing" :)

> Section 5.2.1
>
> I'm kind of confused by the PSKC reference, especially the implication
> ("algorithm ("Algorithm=urn:ietf:params:xml:ns:keyprov:pskc:pin") as the
> PIN") that a fixed string is to be used as a PIN.  (I also think it's
> better to discuss what it does as "key transport" than "key exchange",
> noting that the latter string does not appear in RFC 6030.)

I'm pretty confused about that too actually.

> Section 6
>
> We should document the privacy considerations of the PPK_ID both in the
> face of an attacker with a quantum computer (now or in the future) and
> in the face of a classical attacker.  The latter would, IIUC, need to be
> an active MITM in order to see anything other than N(USE_PPK), and who
> would also get IDi along with the PPK_ID value, so there's not much of a
> change in the privacy stance.

I don't think the attack differs whether you have a quantum computer or
not. Just by relaying as MITM, you can learn IDs. It is inevitable.

>
>   [RFC8019] for more detail).  It is RECOMMENDED that implementations
>   in this situation cache the negative result of negotiation for some
>   time and don't make attempts to create it again for some time,
>   because this is a result of misconfiguration and probably some re-
>   configuration of the peers is needed.
>
> Is this "implementations" as initiators, responders, or both?

Initiators. In IKEv2, responders always only respond once per
received initiator packet.

>   removing USE_PPK notification from the IKE_SA_INIT and forging
>   digital signatures in the subsequent exchange.  If using PPKs is
>   mandatory for at least one of the peers or PSK is used for
>   authentication, then the attack will be detected and the SA won't be
>   created.
>
> side note(?): Up in Section 5.2.3 we talk about PPK-only authentication,
> but here we talk about PSK authentication.  I believe those are distinct
> things (and thus that there's nothing to change in the text), but am
> checking just to be sure.

Yes there are distinct things.

>   If the attacker manages to inject this packet before the responder
>   sends a genuine response, then the initiator would abort the
>   exchange.  To thwart this kind of attack it is RECOMMENDED, that if
>   using PPKs is mandatory for the initiator and the received response
>   doesn't contain the USE_PPK notification, then the initiator doesn't
>   abort the exchange immediately, but instead waits some time for more
>   responses (possibly retransmitting the request).  If all the received
>
> I expect that some reviewer is going to note that this recommendation
> only occurs in the security considerations section and suggest moving it
> to the body of the document, and also that we will be asked to give more
> concrete guidance about "some time".  I don't think either change is
> critical to make, but consider yourself forewarned...

Sounds fair. Timing advise would be similar to how long the implemention
keeps half-open SA's around in general.

> Section 7
>
> We should have a registration template for what information new
> registration requests should include.  (In particular, since we allow
> changing entries, a "change controller" and contact information will be
> needed.)  I suggest including a column for "reference to specification
> (if available)", even though the "Expert Review" policy does not
> strictly require one.  We could also provide some guidance to the DEs as
> to what criteria they may or may not want to apply in deciding whether
> to approve or reject a registration request.

Sounds fair.

Paul