Re: [Ace] About securing last exchange CoAP-EAP ( and EAP state machine - RFC 4137)

Rafa Marin-Lopez <rafa@um.es> Sat, 04 September 2021 19:19 UTC

Return-Path: <rafa@um.es>
X-Original-To: ace@ietfa.amsl.com
Delivered-To: ace@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4EB753A0AD5; Sat, 4 Sep 2021 12:19:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.096
X-Spam-Level:
X-Spam-Status: No, score=-2.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, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=um.es
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 U-6znKewZ-zA; Sat, 4 Sep 2021 12:19:52 -0700 (PDT)
Received: from mx01.puc.rediris.es (outbound6mad.lav.puc.rediris.es [130.206.19.150]) (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 62B773A0AD9; Sat, 4 Sep 2021 12:19:52 -0700 (PDT)
Received: from xenon44.um.es (xenon44.um.es [155.54.212.171]) by mx01.puc.rediris.es with ESMTP id 184JJcbR032616-184JJcbS032616; Sat, 4 Sep 2021 21:19:38 +0200
Received: from localhost (localhost [127.0.0.1]) by xenon44.um.es (Postfix) with ESMTP id 82A952030C; Sat, 4 Sep 2021 21:19:38 +0200 (CEST)
X-Virus-Scanned: by antispam in UMU at xenon44.um.es
Received: from xenon44.um.es ([127.0.0.1]) by localhost (xenon44.um.es [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WlfMlr63McIr; Sat, 4 Sep 2021 21:19:38 +0200 (CEST)
Received: from [192.168.1.38] (99.red-83-45-12.dynamicip.rima-tde.net [83.45.12.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: rafa@um.es) by xenon44.um.es (Postfix) with ESMTPSA id A091320063; Sat, 4 Sep 2021 21:19:35 +0200 (CEST)
From: Rafa Marin-Lopez <rafa@um.es>
Message-Id: <38B0BDE9-5B5C-4F77-B914-DFA98AB711B0@um.es>
Content-Type: multipart/alternative; boundary="Apple-Mail=_C12154EB-76FF-47D5-A37A-A093401737AF"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\))
Date: Sat, 4 Sep 2021 21:19:35 +0200
In-Reply-To: <BB962406-48C4-4BE8-B13F-8D55291964E6@ericsson.com>
Cc: Rafa Marin-Lopez <rafa@um.es>, =?utf-8?Q?Christian_Ams=C3=BCss?= <christian@amsuess.com>, Dan Garcia Carrillo <garciadan@uniovi.es>, "ace@ietf.org" <ace@ietf.org>
To: =?utf-8?Q?G=C3=B6ran_Selander?= <goran.selander=40ericsson.com@dmarc.ietf.org>, EMU WG <emu@ietf.org>
References: <07cd0942-9ee0-b124-b3a7-649f262d7c9e@uniovi.es> <6d2a20fc-7b79-4555-840e-d57f686be42f@VE1EUR02FT003.eop-EUR02.prod.protection.outlook.com> <BB962406-48C4-4BE8-B13F-8D55291964E6@ericsson.com>
X-Mailer: Apple Mail (2.3445.104.21)
X-FEAS-SPF: spf-result=pass, ip=155.54.212.171, helo=xenon44.um.es, mailFrom=rafa@um.es
Authentication-Results: mx01.puc.rediris.es; spf=pass (rediris.es: domain of rafa@um.es designates 155.54.212.171 as permitted sender) smtp.mailfrom=rafa@um.es
X-FE-Policy-ID: 2:15:0:SYSTEM, 2:15:1:uniovi.es
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; d=um.es; s=DKIM; c=relaxed/relaxed; h=from:message-id:content-type:mime-version:subject:date:cc:to:references; bh=iK3C1DA8f+MdK2UyGrnecTFBf/LuuVwV2avuH5RoXcg=; b=Sj0jD7cCckU7HBNskMASR8YupqrVDX/fGUINtNJJ7UIR4eHAmuAF+75ngMW4NEOomB0lmHf9s8gh p5mzzXIPqsAz0kwXkGKG6jm6vVdwY8UXjOze/sr4Og75EhLeOnir/WMTti3zoigkP+qMLHe8LAJb Q+1DyMzxi/ZWQCHOg0FuKoBsVGMs3yJC0Zeu6cypx5cV5mKZ3gwP5E385Z72xg+fp4xG9Pf+V4Mz jcEkmFF2JQzzEh25M4C/eodI6En9H361MZD6+bK9Cx7Xgbq8t50ViC0iOEh89geP4nbowSHNqZ4R koFs9cv720qTMsPmVpzQwHuu0L4KyGVmrxZwfw==
Archived-At: <https://mailarchive.ietf.org/arch/msg/ace/5PkNSpcWm-5U9bTRGwB96Uk7xcc>
Subject: Re: [Ace] About securing last exchange CoAP-EAP ( and EAP state machine - RFC 4137)
X-BeenThere: ace@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Authentication and Authorization for Constrained Environments \(ace\)" <ace.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ace>, <mailto:ace-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ace/>
List-Post: <mailto:ace@ietf.org>
List-Help: <mailto:ace-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ace>, <mailto:ace-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 04 Sep 2021 19:19:59 -0000

Hi Göran:

Thanks for your comments. Please see ours inline

> El 26 ago 2021, a las 12:12, Göran Selander <goran.selander=40ericsson.com@dmarc.ietf.org> escribió:
> 
> Hi,
>  
> Here is a late response to this thread (see first mail at the end).
>  
> On 2021-08-16, 16:52, "Ace on behalf of Christian Amsüss" <ace-bounces@ietf.org <mailto:ace-bounces@ietf.org> on behalf of christian@amsuess.com <mailto:christian@amsuess.com>> wrote:
>  
>     Hello,
>  
>     On Sat, Aug 14, 2021 at 01:37:06PM +0200, Dan Garcia Carrillo wrote:
>     > As such, CoAP server (left side) could not see the content of the CoAP
>     > message (message 7) without deciphering it. Moreover, as the URI-path is
>     > also ciphered we cannot point to the right application to process the
>     > message to achieve an alternate indication of success.
>  
>     If the recipient ID were available a bit earlier (and not derived from
>     the MSK), would it then be viable to infer from the OSCORE ID that this
>     is the last message, process an "EAP success", and start derivation just
>     to extract the session lifetime (and thereby confirm the keys)?
>  
>     (That'd be all assuming that the "EAP success" contains really just the
>     EAP success code and no further information, which would be "compressed"
>     into the "some OSCORE is sent on this" information, and that the
>     Session-Lifetime does not need to be known to advance the EAP state
>     machine).
>  
> [GS] If I understand right, MSK is not intended to be available from the EAP state machine until "EAP success" has been declared,
> which creates a problem to protect the message carrying the "EAP success" with MSK or key derived from it. Even if EAP success would only be integrity protected, there is still need to access the key to verify the integrity of the success message which is a catch 22.

In reality, the problem is not protecting message 7 (in fact, the EAP authenticator can protect it) but the EAP peer (CoAP server) is not able to verify the protected message 7 with OSCORE. 

To be more specific. The EAP state machine (RFC 4137), in particular, the EAP peer state machine (Figure 3), defines two variables that constitute part of the interface with the EAP lower-layer (which is CoAP-EAP). One variable is eapKeyData and the other eapKeyAvailable. It turns out that eapKeyData changes from NONE to the key value in state METHOD when the EAP method exports a key, which means the MSK is set in eapKeyData. However, only in the SUCCESS state, the eapKeyAvailable variable is set to TRUE, indicating to the EAP lower-layer that there is a key available. The SUCCESS state is reached when receiving, for example, an EAP success or for example there is an indication of the EAP  lower-layer (altAccept). However, and here it is the problem, the EAP peer needs the key to process/decrypt message 7 and the eapKeyAvailable is FALSE because EAP peer state machine is not in SUCCESS state.

Having said this, it seems that nothing precludes that an EAP lower-layer can check the state of eapKeyData to see if eapKeyData != NONE and to access key even though eapKeyAvailable is still FALSE. In fact, eapKeyAvailable is set TRUE when the SUCCESS state is reached by verifying precisely if eapKeyData != NONE. As an example, wpa_supplicant has a function to recover this key:

const u8 * eap_get_eapKeyData(struct eap_sm *sm, size_t *len)
{
	if (sm == NULL || sm->eapKeyData == NULL) {
		*len = 0;
		return NULL;
	}

	*len = sm->eapKeyDataLen;
	return sm->eapKeyData;
}

which is checking if eapKeyData is not NULL (NONE) to return the key. There is no other verification. And the function is well programmed according to the RFC 4137, in our opinion.

Therefore, the EAP lower-layer could access the MSK by looking at the eapKeyData variable. If the EAP lower-layer accesses the eapKeyData, it can create the OSCORE context with the single goal of decrypting message 7 without the need of an opportunistic success. In fact, the state machine is not yet moved to SUCCESS state when accessing eapKeyData. If message 7 protected with OSCORE is verified correctly, it means the counterpart (EAP authenticator) already has the MSK, and it could be considered as AltAccept, which will move the EAP peer state machine to the final state. If, for some reason (though we are not able to find out one), the EAP peer ends up in the FAILURE state, the EAP peer can get rid of the OSCORE context and report an error to the EAP authenticator.

In this sense, we have a question for the EMU WG: 

Would be a problem, taking into account RFC 4137, if an EAP lower-layer access the eapKeyData value (if eapKeyData changes from NONE to a value) for (only) decrypting information sent by the EAP authenticator before reaching the SUCCESS state? Apparently, it would be for the definition of eapKeyAvailable, although we do not see any impediment taking into account the eapKeyData is exposed in the current EAP peer state machine. If this option is considered an acceptable behavior, the problem is solved. 

>  
> As far as I understand the two proposals (by the authors and by Christian) they are both opportunistic: preliminary declare success, get the MSK, derive the key, and attempt to verify the message. But it was not clear to me if success can be "withdrawn" or what happens if the message doesn't verify.

In the option we described above, it would not be opportunistic because there is no declaration of success until message 7 is processed correctly (including OSCORE)
>  
> Or conversely, if success can be declared opportunistically before access to MSK and without verification of message 7, then why not do that already before reception of message 7, and withdraw if it doesn't verify?

I think that is not possible because that would move the EAP peer state machine to a final state SUCCESS without any chance to withdraw. 

>  
> Other alternatives:
>  
> * If the mapping from EAP to CoAP client/server is instead reversed, then message 8 would be a CoAP request which can be protected by OSCORE using a key derived from MSK since it is by then available. This would add a message 9 (10% of the total no. of messages) for key confirmation in the other direction.

If we change the role, the EAP responses go inside the CoAP requests that complicates the design. Moreover, we have the reasons mentioned in the I-D (section 5.3)

>  
> * Alternatively, OSCORE may be started after EAP is concluded. This would add another message exchange but that exchange could be normal traffic and thus not add to the number of messages, if key confirmation can wait until there is traffic. An extra exchange for key confirmation can be added only in use cases it can't wait and there is no traffic, whatever those are. There is a similar setting in LAKE, where EDHOC has an optional message 4 if explicit key confirmation cannot be obtained otherwise.

Yes, we have considered this case as well. As we see it, key confirmation cannot wait. So it becomes mandatory. Without that step, the EAP peer will not know the access has been granted. Therefore, under CoAP-EAP standpoint, running OSCORE after EAP would be required (which means that two additional messages are included in the design anyway). It is true the exchange could be also used to send traffic. The advantage of this approach is that OSCORE can be used and the design may be more simple. The disadvantage is that we are adding two additional messages, which is not good if we consider constrained links. 

Btw, two other options would be also possible:

1) To add a new cryptosuite to OSCORE to support NULL encryption + integrity 
2) Or to create an authentication tag based on COSE but acting only at payload level. We would achieve key confirmation in message 7 and 8 without using OSCORE, and after that OSCORE core context can be created safely for posterior exchanges. But under CoAP-EAP standpoint the process has finished.

We tend to think option 2), as Dan mentioned, would meet all we want : access to the MSK as expected in the EAP state machine (SUCCESS state); key confirmation; reducing the number of messages; and creating the OSCORE context safely afterwards. The only “problem” we see is that we are not using OSCORE in message 7 and 8 but COSE with integrity for (only) the payload. Opinions?

Best Regards.

>  
>  
> Göran
>  
>  
>  
>  
> From: Ace <ace-bounces@ietf.org <mailto:ace-bounces@ietf.org>> on behalf of Dan Garcia Carrillo <garciadan@uniovi.es <mailto:garciadan@uniovi.es>>
> Date: Saturday, 14 August 2021 at 13:37
> To: EMU WG <emu@ietf.org <mailto:emu@ietf.org>>, "ace@ietf.org <mailto:ace@ietf.org>" <ace@ietf.org <mailto:ace@ietf.org>>
> Cc: "garciadan@uniovi.es <mailto:garciadan@uniovi.es>" <garciadan@uniovi.es <mailto:garciadan@uniovi.es>>
> Subject: [Ace] About securing last exchange CoAP-EAP
>  
> Dear ACE and EMU WG members,
>  
> In the last exchange of CoAP-EAP we intended to run OSCORE to achieve key confirmation, a protected EAP success and the establishment of the OSCORE security association. It was our understanding that only integrity protection was possible but it is not the case after consulting OSCORE authors. More specifically, the payload and URI-Path with OSCORE are class E they are ciphered (and integrity protected) and, as far as we understand, there is no option, currently, of using a NULL encryption suite to achieve only integrity. 
>  
>              CoAP                                     CoAP
>             Sever                                    Client
>                                ...
>            5) |<----------------------------------------|
>               | ACK [0x9869]                            |
>               | Token (0xac)                            |
>               | 2.01 Created Location-Path [/a/z]       | MSK
>               | Payload EAP-X-Resp (n)                  |  |
>            6) |---------------------------------------->|  v
>               |                CON [0x7811] POST /a/z   |OSCORE
>               |                  Token (0xac), OSCORE   |CONTEXT
>     MSK       | Payload (EAP success||Session-Lifetime) |(*)
>      |     7) |<----------------------------------------|
>      v        | ACK [0x7811]                            |
>    OSCORE  (*)| Token (0xac), OSCORE                    |
>    CONTEXT 8) |---------------------------------------->|
>               (*) Protected with OSCORE
>  
> As such, CoAP server (left side) could not see the content of the CoAP message (message 7) without deciphering it. Moreover, as the URI-path is also ciphered we cannot point to the right application to process the message to achieve an alternate indication of success. However, the MSK required to create the OSCORE context, which allows deciphering the message, is not available yet (even though eapKeyData variable has content). The reason is that, according to EAP state machine (RFC 4137) Figure 3, the MSK becomes available (eapKeyAvailable = TRUE) when EAP success (rxSuccess or altSuccess from the EAP lower layer) is sent to EAP state machine.
>  
> rxSuccess &&
>     (reqId == lastId) &&
>     (decision != FAIL)   
>              |
>              V
> __________________________
> |______SUCCESS_____________|
> |if (eapKeyData != NONE)   |
> |   eapKeyAvailable = TRUE |
> |eapSuccess = TRUE         |
> |__________________________|
>              ^
>              |
> (altAccept && decision != FAIL) ||
>     (idleWhile == 0 &&
>      decision == UNCOND_SUCC)
>  
> Our proposed solution is to generate an authentication tag in the form of a COSE object that will be used to integrity-protect the payload of message 7 and message 8, allowing the EAP peer to see the EAP success and sending it to the EAP state machine so that, after obtaining the MSK, verifying the authentication tag in message 7 (key confirmation). After message 7 is processed correctly, CoAP server will be able to generate the OSCORE security context and after processing message 8 CoAP client (right entity in the exchange) will create the OSCORE context. From this point CoAP messages between both entities can be protected using OSCORE context.
>  
>              CoAP                                     CoAP
>             Sever                                    Client
>            5) |<----------------------------------------|
>               | ACK [0x9869]                            |
>               | Token (0xac)                            |
>               | 2.01 Created Location-Path [/a/z]       |
>               | Payload EAP-X-Resp (n)                  |
>            6) |---------------------------------------->|
>               |                CON [0x7811] POST /a/z   |
>               |                          Token (0xac)   |      MSK
>               | Payload (EAP success||Session-Lifetime  |     |  |
>   MSK         |           || AuthenticationTag)         |     v  |
>   | |      7) |<----------------------------------------|AUTH_KEY|
>   | v         | ACK [0x7811]                            |        |
>   |AUTH_KEY   | 2.01 Created Location-Path [/a/z1]      |        |
>   v           | Token (0xac)                            |        |
> OSCORE Context| Payload(AuthenticationTag)              |        V
>            8) |---------------------------------------->|      OSCORE
>                                                                Context
>  
> _______________________________________________
> Ace mailing list
> Ace@ietf.org <mailto:Ace@ietf.org>
> https://www.ietf.org/mailman/listinfo/ace <https://www.ietf.org/mailman/listinfo/ace>
------------------------------------------------------- 
Rafa Marin-Lopez, PhD
Dept. Information and Communications Engineering (DIIC)
Faculty of Computer Science-University of Murcia
30100 Murcia - Spain
Telf: +34868888501 Fax: +34868884151 e-mail: rafa@um.es
-------------------------------------------------------