Hi Hanno, Hi all,

I believe it would be useful to add some extra sentences to the draft to 
retaining the old key material.

In your example below, the sender of the initial KeyUpdate has to re-send it 
because of the lost ACK. In order to resubmit it, it has to use the old keying 
material (or cache the message). The receiver cannot immediately delete keying 
material after processing the initial KeyUpdate message because it does not 
know whether the ACK will subsequently get lost.

Ciao
Hannes

From: TLS <tls-boun...@ietf.org> On Behalf Of Hanno Becker
Sent: Saturday, March 28, 2020 11:31 PM
To: tls@ietf.org
Subject: [TLS] Possible deadlock when ACKing KeyUpdate messages?

In relation to ACKs for KeyUpdate messages, DTLS 1.3 Draft 37 states:

   Although KeyUpdate MUST be acknowledged, it is possible for the ACK
   to be lost, in which case the sender of the KeyUpdate will retransmit
   it.  Implementations MUST retain the ability to ACK the KeyUpdate for
   up to 2MSL.  It is RECOMMENDED that they do so by retaining the pre-
   update keying material, but they MAY do so by responding to messages
   which appear to be out-of-epoch with a canned ACK message; in this
   case, implementations SHOULD rate limit how often they send such
   ACKs.

This seems to allow implementations to remove old incoming keys immediately
after ACKing the KeyUpdate, which appears to open the door for the following
situation leading to deadlock:


  +-------------------------+
  |   KeyUpdate, epoch N    |-------------> received
  +-------------------------+
                                          +------------------------+
                               lost x-----|     ACK,   epoch M     |
                                          +------------------------+

                                          [ new incoming epoch N+1,
                                            remove keys for epoch N ]

-                                         +------------------------+
                  received  <-------------|   KeyUpdate, epoch M   |
                                          +------------------------+
  +-------------------------+
  |       ACK, epoch N      |-------[ irrelevant whether it goes through - see 
below ]
  +-------------------------+

  [ new incoming epoch M+1,
    remove keys for epoch M ]

Note: This isn't an entirely unlikely situation, since a KeyUpdate with 
update_requested flag
will result in a subsequent KeyUpdate from the other side, and the only unlucky 
thing that
needs to happen is for the original ACK to be lost while both KeyUpdate 
messages go through.

At this point, both sides have updated their incoming key material but
not their outgoing key material, since they're still awaiting the ACK -
however, it turns out that they can't actually read those ACKs anymore:

After some time, the peers resend the KeyUpdate messages, which will be
blindly ACKed by the peer according to the recommendation in the spec;
however, the ACKs will be encrypted with the wrong keys and cannot
be parsed on either side:

  +---------------------------+
  | resent KeyUpdate, epoch N |-------------> received, but can't be read
  +---------------------------+               because incoming epoch N+1

                                                send 'blind' ACK

  received, but can't be read                +------------------------+
  because incoming epoch M+1  <--------------|     ACK,   epoch M     |
                                             +------------------------+

The same will happen to KeyUpdate retransmission from the other side.

It seems that this results in a deadlock. Am I missing / misunderstanding 
something?

A possible mitigation would be to force retaining the old key material for 2MSL,
or alternatively, to mandate that old key material must only be removed upon
receipt and successful decryption of a message using the new keys.
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
TLS mailing list
TLS@ietf.org
https://www.ietf.org/mailman/listinfo/tls

Reply via email to