Dear Antoine,

thanks for adding the references.

I tried to understand https://eprint.iacr.org/2020/114.pdf (Section
III.D). But to be frank, as developer, it's extremley hard not to
misunderstand, what is documented there.

For me, this seems like in QUIC, the length of the CID is encoded in the
sent message (so it's on the wire).

For draft-ietf-tls-dtls-connection-id-07, at least as far as I
understood it, there are two general possiblities:

- a peer chose to emit only CID with the same static length. In that
case, the cid-length will always be the same (cid-length is not on the
wire). It can't be injected, except someone injects the execute programm
code itself.

- a peer chose to emit CIDs with variable length. In the case the other
peer is intended just to add that received CID in the hello extension to
the dtls-records. The emitting peer has to chose a encoding for such CID
with variable length, that the emitting peer is able to decode it. In
this case the cid-length is on the wire, but the encoding is not
specified in draft-ietf-tls-dtls-connection-id-07. In my opinion it's
extremely important, to chose a encoding, which could not be interpreted
in different ways (I guess, that's what Watson ment by "injective").

With these both options, FMPOV, to add explicit someting as the
cid-length to the MAC is not required. It's either the same static
value, or must be already encoded in the CID itself, which is already in
the MAC. But it may be required, to add constraints about such a
encoding for variable length CIDs to the draft.

The confusion may be mainly caused by the idea, to support both, static
length CID and variable length CIDs. That misleads to build examples,
assming that two CID may be used, where one CID is the start of the
other. In my opinion, that's a problem of the encoding of the variable
length CID, but not the MAC.

best regards
Achim Kraus


Am 11.10.20 um 22:53 schrieb [email protected]:
Dear Watson,

I object to your comment about formal models of TLS not capturing wire encoding 
issues. miTLS does in fact formally specify the format of all messages on the 
wire to the bit.
In fact this is complex enough that we have a full paper just about the subject 
that will tell you more or less everything that was said in this thread
http://antoine.delignat-lavaud.fr/doc/usenix19.pdf - 
https://github.com/project-everest/mitls-fstar/blob/dev/src/parsers/Parsers.rfc 
is the formal TLS message format specification including the demonstrably 
unsafe constructions (implicit tags on server key exchange in 1.2 and 
CertificateEntry in TLS 1.3).

In the specific context of connection ID, QUIC up to draft 16 did suffer from 
an attack caused by the lack of encoding of the CID length. The attack is 
caused by the concatenation of two variable length fields in the network format 
(the CID and the packet number) that can both be tampered by an active 
attacker. The boundary of the concatenation is made ambiguous to the crypto 
authentication (AAD of packet content encryption) by QUIC header protection, 
which is applied before decryption. See https://eprint.iacr.org/2020/114.pdf 
(Section III.D) for a description of the attack. See 
https://github.com/project-everest/everquic-crypto/blob/master/src/QUIC.Spec.VarInt.fsti
 and 
https://github.com/project-everest/everquic-crypto/blob/master/src/QUIC.Spec.VarInt.fst
  for the formal proof that the QUIC varint encoding with minimal length 
representation satisfies the strong prefix property.

Antoine

-----Original Message-----
From: TLS <[email protected]> On Behalf Of Watson Ladd
Sent: dimanche 11 octobre 2020 08:50
To: Achim Kraus <[email protected]>
Cc: [email protected]; [email protected]; Benjamin Kaduk 
<[email protected]>
Subject: Re: [TLS] Fwd: Re: AD review of draft-ietf-tls-dtls-connection-id-07

On Sat, Oct 10, 2020 at 11:27 PM Achim Kraus <[email protected]> wrote:

Hi Joe,

  > [Joe]  It's unfortunate to find issues that require breaking change
at  > the end of the review cycle, especially for a draft that has taken a
  > long path to get here.   If there is an issue that is exploitable, even
  > in a corner case, someone will develop an attack, clever name, logo and
  > website and we will all have to scramble to deploy a fix.   It's better
  > to fix now rather than later.

Agreed, therefore I wrote at the begin of the discussion with Ben:

  >> I would prefer, if this is not changed again without strong  >>
arguments!

  > In this case, I don't have a way to  > exploit this issue, but
unless someone has a way to demonstrate that  > this is not going to
be an issue then I believe it is prudent to fix it  > now.
  >

In my opinion, ONE change may be possible. A server may be configured
to use only the old, only the new, or both by "try on the client's finish".
I'm not happy with such "dirty" work-around. I would prefer to do so
for something more the "cryptographic hygiene".

So, if the MAC is considered to be adpated again, should it not be
discussed, why at all the cid-length should be put in?
I asked this already in January 2019

https://github.com/tlswg/dtls-conn-id/pull/29#discussion_r246654915

The MAC contains already a overall length. Even in that discussion, no
one mentioned the reason for adding it. So if there a doubts about
injection, why not remove it at all?

The doubt is because of where it appears not that it appears. If every value 
was preceded by its length the encoding would obviously be injective. Here 
though it isn't clear if two different inputs to the encoding could end up the 
same. In fact I think in the MAC setting there almost certainly is a problem as 
the length of the ciphertext is right after the cid length, and with some 
cleverness you can come up with a cid and ciphertext that could be interpreted 
multiple ways.
Unfortunately I haven't followed the draft's discussions that closely.

I do not understand how a CID is supposed to be parsed by a recipient when the 
length can change and the length field is not encoded, but perhaps I'm 
misreading the intent of the [] notation in the record layer of the draft.


  > Would this issue have been caught by formal verification?

That may also be something to help, not to change still again and again.

I don't think the formal models of TLS reach the wire encoding.


--
Astra mortemque praestare gradatim

_______________________________________________
TLS mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/tls


_______________________________________________
TLS mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/tls

Reply via email to