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

Rafa Marin-Lopez <> Sat, 04 September 2021 19:19 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 4EB753A0AD5; Sat, 4 Sep 2021 12:19:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.096
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: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id U-6znKewZ-zA; Sat, 4 Sep 2021 12:19:52 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 62B773A0AD9; Sat, 4 Sep 2021 12:19:52 -0700 (PDT)
Received: from ( []) by with ESMTP id 184JJcbR032616-184JJcbS032616; Sat, 4 Sep 2021 21:19:38 +0200
Received: from localhost (localhost []) by (Postfix) with ESMTP id 82A952030C; Sat, 4 Sep 2021 21:19:38 +0200 (CEST)
X-Virus-Scanned: by antispam in UMU at
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with LMTP id WlfMlr63McIr; Sat, 4 Sep 2021 21:19:38 +0200 (CEST)
Received: from [] ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: by (Postfix) with ESMTPSA id A091320063; Sat, 4 Sep 2021 21:19:35 +0200 (CEST)
From: Rafa Marin-Lopez <>
Message-Id: <>
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: <>
Cc: Rafa Marin-Lopez <>, =?utf-8?Q?Christian_Ams=C3=BCss?= <>, Dan Garcia Carrillo <>, "" <>
To: =?utf-8?Q?G=C3=B6ran_Selander?= <>, EMU WG <>
References: <> <> <>
X-Mailer: Apple Mail (2.3445.104.21)
X-FEAS-SPF: spf-result=pass, ip=,,
Authentication-Results:; spf=pass ( domain of designates as permitted sender)
X-FE-Policy-ID: 2:15:0:SYSTEM,
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt;; 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: <>
Subject: Re: [Ace] About securing last exchange CoAP-EAP ( and EAP state machine - RFC 4137)
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Authentication and Authorization for Constrained Environments \(ace\)" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-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 <> 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" < <> on behalf of <>> 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 < <>> on behalf of Dan Garcia Carrillo < <>>
> Date: Saturday, 14 August 2021 at 13:37
> To: EMU WG < <>>, " <>" < <>>
> Cc: " <>" < <>>
> 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
> <>
> <>
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: