Re: [IPsec] Paul Wouters' Discuss on draft-ietf-ipsecme-ikev2-multiple-ke-10: (with DISCUSS and COMMENT)

Valery Smyslov <svan@elvis.ru> Wed, 30 November 2022 17:03 UTC

Return-Path: <svan@elvis.ru>
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 609F0C1522C6; Wed, 30 Nov 2022 09:03:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.096
X-Spam-Level:
X-Spam-Status: No, score=-7.096 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_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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=elvis.ru
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 XnxR3_Fq-E31; Wed, 30 Nov 2022 09:03:23 -0800 (PST)
Received: from akmail.elvis.ru (akmail.elvis.ru [82.138.51.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2C91CC1522C3; Wed, 30 Nov 2022 09:03:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=elvis.ru; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:In-Reply-To:References:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tPUfnD+LSa+eg8KRv0iK2Hfis5eZXKGieVZnXrsac/g=; b=fQQ2+ydc47ctziZqgiqUze8mKQ FA7Rtp+tAerz6zb18GaXDuZZVnBEL2glg4E15yJLq2+06P3yc1js1ihMJstlcygqZt4XlzjgrFth1 byLL0zkw2PYOOAm6QWFmOptAA8z6GuuaSUy+XBNxGwPZYChHWKo1En6k2pJ3CKsCqhno=;
Received: from kmail.elvis.ru ([93.188.44.208]) by akmail.elvis.ru with esmtp (Exim 4.92) (envelope-from <svan@elvis.ru>) id 1p0QUJ-0005ck-8m; Wed, 30 Nov 2022 20:03:11 +0300
Received: from mail16.office.elvis.ru ([10.111.1.29] helo=mail.office.elvis.ru) by kmail.elvis.ru with esmtp (Exim 4.92) (envelope-from <svan@elvis.ru>) id 1p0QUJ-0004Pc-0v; Wed, 30 Nov 2022 20:03:11 +0300
Received: from MAIL16.office.elvis.ru (10.111.1.29) by MAIL16.office.elvis.ru (10.111.1.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Wed, 30 Nov 2022 20:03:10 +0300
Received: from buildpc (10.111.10.33) by MAIL16.office.elvis.ru (10.111.1.29) with Microsoft SMTP Server id 15.1.1779.2 via Frontend Transport; Wed, 30 Nov 2022 20:03:10 +0300
From: Valery Smyslov <svan@elvis.ru>
To: 'Paul Wouters' <paul@nohats.ca>
CC: 'Paul Wouters' <paul.wouters@aiven.io>, 'The IESG' <iesg@ietf.org>, draft-ietf-ipsecme-ikev2-multiple-ke@ietf.org, ipsecme-chairs@ietf.org, ipsec@ietf.org, 'Tero Kivinen' <kivinen@iki.fi>
References: <166966973968.20669.3414159618699952233@ietfa.amsl.com> <150601d90418$3cf314b0$b6d93e10$@elvis.ru> <d1d99f3b-f3c3-1bb4-756b-075d636ea328@nohats.ca> <15b001d904c4$c7509b30$55f1d190$@elvis.ru> <41f0e39f-d86b-6791-5888-c8f51cbf921d@nohats.ca>
In-Reply-To: <41f0e39f-d86b-6791-5888-c8f51cbf921d@nohats.ca>
Date: Wed, 30 Nov 2022 20:03:12 +0300
Message-ID: <15d901d904dd$a182fce0$e488f6a0$@elvis.ru>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQHTakZOHe5RmhmsuhtM/dRIvN2LsgMLPS48AbPLEQYByxlnkQHaOWIqrh+xBWA=
Content-Language: ru
X-CrossPremisesHeadersFilteredBySendConnector: MAIL16.office.elvis.ru
X-OrganizationHeadersPreserved: MAIL16.office.elvis.ru
X-KLMS-AntiSpam-Interceptor-Info: not scanned
X-KLMS-Rule-ID: 1
X-KLMS-Message-Action: clean
X-KLMS-AntiSpam-Status: not scanned, disabled by settings
X-KLMS-AntiPhishing: Clean, bases: 2022/11/30 15:52:00
X-KLMS-AntiVirus: Kaspersky Security for Linux Mail Server, version 8.0.3.30, bases: 2022/11/30 12:09:00 #20628588
X-KLMS-AntiVirus-Status: Clean, skipped
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipsec/5jOoMl46azsb1l4dpsrTGOp0ZtY>
Subject: Re: [IPsec] Paul Wouters' Discuss on draft-ietf-ipsecme-ikev2-multiple-ke-10: (with DISCUSS and COMMENT)
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.39
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: Wed, 30 Nov 2022 17:03:27 -0000

We are converging :-)

> > I'm a bit reluctant to add all this information to the abstract. It is already a bit too long
> > (since Éric and Warren suggested to augment it with the explanation text of how
> > this design helps in situation when PQ algorithms are less trusted). So currently
> > the abstract is:
> >
> >        This document describes how to extend the Internet Key Exchange Protocol
> >        Version 2 (IKEv2) to allow multiple key exchanges to take place
> >        while computing a shared secret during a Security Association (SA) setup.
> >
> >        The primary application of this feature in IKEv2 is the ability to perform one or more
> >        post-quantum key exchanges in conjunction with the classical (Elliptic Curve) Diffie-Hellman (EC)DH
> key exchange,
> >        so that the resulting shared key is resistant against quantum computer attacks.
> >        Since there is currently no post-quantum key exchange that is trusted at
> >        the level that (EC)DH is trusted for against conventional (non-quantum)
> >        adversaries, performing multiple key exchanges with different post-quantum algorithms along
> >        with the well-established classical key exchange algorithms addresses this concern, since the
> >        overall security is at least as strong as each individual primitive.
> >
> >        Another possible application for this extension is the ability to combine several key exchanges
> >        in situations when no single key exchange algorithm is trusted by both initiator and responder.
> >
> >       This document updates RFC7296 by renaming a transform type 4 from "Diffie-Hellman Group (D-H)"
> >        to "Key Exchange Method (KE)" and renaming a field in the Key Exchange Payload from "Diffie-
> Hellman Group Num"
> >        to "Key Exchange Method". It also renames an IANA registry for this transform type
> >        from "Transform Type 4 - Diffie-Hellman Group Transform IDs" to
> >        "Transform Type 4 - Key Exchange Method Transform IDs". These changes generalize
> >        key exchange algorithms that can be used in IKEv2.
> >
> > Do you *really* want to make it longer? I'm not sure that if we just mention
> > the names of the added exchange and notifies, that will help readers of the abstract
> > to understand what this document is about...
> 
> This document updates RFC7296. It introduces the IKE_FOLLOWUP_KE Exchange. It renames [...]
> 
> > [update]
> >
> > I've just noticed your message sent in response to Warren. So, since you insist :-),
> > I suggest adding the following text before "This document updates...":
> >
> >    This document utilizes the IKE_INTERMEDIATE exchange to perform multiple key exchanges when
> >    an IKE SA is being established and introduces a new IKEv2 exchange IKE_FOLLOWUP_KE to perform
> >    them when IKE SA is up (during rekeys or creating additional Child SAs).
> >
> > is it now OK?
> 
> Also fine :)

Great!

> >> I don't think it would hurt pointing to Section 2.4 of RFC 7296. I see
> >> this as a likely possible implemention mistake.
> >
> > My problem with your proposal here is that this situation is not
> > specific to this document. In other words, whether the initiator
> > proposes any additional key exchanges or not, if an attacker
> > manages to send a response before the genuine responder
> > and the initiator continues establishing IKE SA using this response,
> > then it will fail. There is nothing specific to the multiple key exchanges.
> > And we implicitly assume that implementations follow RFC 7296.
> 
> I want to prevent code like:
> 
>  	if (AKE-required && !AKE-received)
>  		return STF_FATAL    // kills state
> 
> I know it is a "reminder", but I think an important one.

RFC 7296 states that the proposed defense against this attack is a MAY
(due to relatively high cost of the defense). So, I've added the following text at the end
of 3.2.1:

    It is possible that an attacker manages to send a response to the initiator's IKE_SA_INIT request 
    before the genuine responder. If the initiator continues creating IKE SA using this response, the attempt will fail.
    Implementers may wish to consider a possible defense technique described in Section 2.4 of [RFC7296].

We really cannot advise something marked as MAY, we can only remind that this technique exists.

> >> Just give it some thought, but if we leave it as is that is fine too.
> >
> > As I'm lazy, I prefer to do nothing here (unless you or my co-authors strongly disagree :-))
> 
> Fine with me. Can't get worse than CREATE_CHILD_SA I guess :P

CREATE_CHILD_SA_FOLLOWUP_KEY_EXCHANGE? :-)
Oh, sorry, you seemed to propose something similar :-)

> >> I also think that is only a reason to ignore the CREATE_CHILD_SA, and
> >> not a reason to destroy the existing IKE SA (and thus any existing Child
> >> SA)
> >
> > Well, generally invalid response means that there is something wrong
> > with the peer thus we cannot be sure that it follows spec.
> 
> Yeah but stabbing them in the heart in case they might be dying is a bit
> drastic :P
> 
> Put it in another way, I would violate the RFC on this point and keep
> the existing IKE SA until its lifetime has been reached.
>
> >>> I think that the text may be clarified a bit. How about?
> >>
> >> I guess first we need to agree on what to do.....
> >
> > OK, let me clarify our point.
> >
> > First, there is nothing specific to the multiple key exchanges here. The situation is that
> > the responder sends a message that is inappropriate from the protocol point of view.
> > There may be many reasons to consider it inappropriate - missing mandatory
> > payload, incorrect choice of algorithms etc., this specification just adds one
> > more reason - duplicated algorithms.
> >
> > What should the initiator do in this situation? It generally cannot send INVALID_SYNTAX,
> > since RFC 7296 discourages doing so (section 2.21.3):
> >
> >   Because sending such
> >   error messages as an INFORMATIONAL exchange might lead to further
> >   errors that could cause loops, such errors SHOULD NOT be sent.
> >
> > The initiator generally cannot continue using this SA, because of possible
> > the states on the peers are now out of sync (the responder thinks the exchange completed
> successfully).
> > So the safe way is to delete the problem SA. If it is not yet created, then just stop creating it,
> > otherwise send a Delete payload.
> >
> > Note, that the text you proposed
> >
> >    the initiator should log the error and MUST abort the exchange with a permanent error
> >
> > actually has the same consequence. Since the responder sent a response with no error notify,
> > it thinks that the exchange is completed successfully. On the other hand, your text suggests
> > that the initiator treat this exchange as failed. So, the states on the initiator and the responder
> > are now out of sync. RFC 7296 states (2.21.3):
> >
> >   If errors are seen that indicate that the peers do not have the same
> >   state, it might be good to delete the IKE SA to clean up state and
> >   start over.
> 
> "might" :-)

Yes, RFC 7296 is not very clear here, using RFC 2119 language would be more appropriate :-)

> Again, I agree on killing the newly failed SA. But let's say you have an
> IKE SA up and a Child SA up (might even be a child using classic algo
> only), I don't see why adding a new Child SA that fails should kill the
> existing functional Child SA and IKE SA.
>
> Sure there should be a loop detection and exponential back-off on
> failures to prevent a DoS of trying to get this post-quantum Child SA
> up. But tearing down the existing Child SA and IKE SA will presumbly
> just cause a more complicated loop anyway. These working SA's will come
> back up again and then get torn down again when the post-quantum Child
> SA fails. So I don't think your suggestion is better.

Well, to get to some compromise we can state in the draft that in this situation
the initiator MAY send a Delete payload to delete the IKE SA itself
and MUST NOT initiate any IKE_FOLLOWUP_KE exchanges.

    If the responder's message contains one or more duplicated choices, the initiator
    should log the error and MUST treat the exchange as failed.
    The initiator MUST NOT initiate any IKE_INTERMEDIATE (or IKE_FOLLOWUP_KE) exchanges, so that no new SA is created.
    If this happens in the CREATE_CHILD_SA exchange, then the initiator MAY delete the IKE SA,  
    over which the invalid message was received, by sending a Delete payload.

Is it OK now?

> >>>> ### Section 3.2.2
> >>>> ```
> >>>>    The other keying materials SK_d, SK_ai, SK_ar, SK_ei,
> >>>>    SK_er, SK_pi, SK_pr are updated as:
> >>>>
> >>>>    [...]
> >>>> ```
> >>>> Why not say: The other keying materials SK_d, SK_ai, SK_ar, SK_ei, SK_er,
> >>>> SK_pi, SK_pr are generated from the SKEYSEED(n) as per RFC 7296.
> >>>
> >>> No objection.
> >>
> >> Just to clarify, where I wrote [...] I meant to cover the illustration
> >> under the text as well. The point of this change was to not repeat a
> >> stock 7296 exchange (which might confuse implementers in believeing this
> >> is different from stock 7296)
> >
> > I'd rather to keep the illustration. There is a subtle difference from RFC 7296 -
> > while keys have "generation", the SPIs and nonces are used from the IKE_SA_INIT.
> > The illustration makes this difference more clear, in my opinion.
> 
> If you want to keep the illustration, then just ignore this entire
> change I proposed or it becomes duplicative.

OK.

The updated PR is available at:
https://github.com/post-quantum/ietf-pq-ikev2/pull/22

> If you get a new draft before tomorrow 10am EST, I can update my DISCUSS
> to a YES ballot :)

We'll do our best :-)

Thank you,
Valery.

> Paul