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

Christian Amsüss <> Mon, 11 October 2021 10:09 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id AD8FF3A08D3; Mon, 11 Oct 2021 03:09:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 47KfkecmO3lq; Mon, 11 Oct 2021 03:09:45 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id A90513A05A7; Mon, 11 Oct 2021 03:09:44 -0700 (PDT)
Received: from (unknown [IPv6:2a02:b18:c13b:8010:a800:ff:fede:b1bd]) by (Postfix) with ESMTPS id C12A4400D8; Mon, 11 Oct 2021 12:09:41 +0200 (CEST)
Received: from ( []) by (Postfix) with ESMTP id 97679106; Mon, 11 Oct 2021 12:09:40 +0200 (CEST)
Received: from (unknown [IPv6:2a02:b18:c13b:8010:58a:38c7:d462:d25e]) by (Postfix) with ESMTPSA id 55AEA10A; Mon, 11 Oct 2021 12:09:40 +0200 (CEST)
Received: (nullmailer pid 1455897 invoked by uid 1000); Mon, 11 Oct 2021 10:09:40 -0000
Date: Mon, 11 Oct 2021 12:09:40 +0200
From: Christian =?iso-8859-1?Q?Ams=FCss?= <>
To: Rafa Marin-Lopez <>
Cc: =?iso-8859-1?Q?G=F6ran?= Selander <>, EMU WG <>, Dan Garcia Carrillo <>, "" <>
Message-ID: <>
References: <> <> <> <>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mmAT7aS1TsIGwA0g"
Content-Disposition: inline
In-Reply-To: <>
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: Mon, 11 Oct 2021 10:09:50 -0000

Hello Rafa,

that's the mail I missed in our previous discussion -- and yes, it
largely describes already just what I think can work, see comments

On Sat, Sep 04, 2021 at 09:19:35PM +0200, Rafa Marin-Lopez wrote:
> 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. 

Does there need to be?

If a request arrives at an OSCORE context and the validation *fails*,
the most probable explanation is that someone got the key derivation
wrong -- no point in allowing another attempt.

Or, of course, an attacker has been listening, and either attempting to
guess a key (giving them several attempts is questionable) or trying to
disturb the negotiation (which they can already do more easily by
sending unsuccessful CoAP responses).

> 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.

The OSCORE context can be partially initialized, or updated over its
lifetime. This is odd if you think of the context as a Recipient ID to
key mapping, but that's not generally the case in OSCORE, and the
construction of its RFC8613 B.2 also depends on data about requests
being fed "live" into the key derivation before the actual key is there.

With agreed-on recipient IDs[1], what happens as the "last" message EAP
is involved in can be this:

* OSCORE message is received
* OSCORE library looks into OSCORE option, finds an ID placed there by
* OSCORE library asks EAP for key material for that ID (this is a
  callback, not a dictionary lookup)
* EAP sees that and declares altSuccess based on the receiption of the
  message alone, and then extracts the key material from the state
* EAP returns the context key material to the OSCORE library
* Message is decrypted

That message does not even need to go up to the EAP resource any more --
it's just as fine if that is already usable data. (If there is no
request pending and you prefer to have such a message just to clean out
the EAP state even though it has no timeouts, any encrypted message
would do, including a POST to the EAP resource).



To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom