Subject: [MLS] Two poorly defined aspects of the spec

From: Cornelissen Eric <[email-masked]>
Date: Thu, 6 Aug 2020 10:02:08 +0000

Hi All,

I have two questions about things that are unclear to me in the current state of the spec as they are undefined/poorly defined.

1. What is the intended value of interim_transcript_hash_[0]?

>From the current draft I cannot definitively (i.e. with 100% certainty) say whether the value of the first interim_transcript_hash should be:

a. "the zero-length octet string" following the last line of Group state section<https://github.com/mlswg/mls-protocol/blob/39455d2ea5e8fb42e8f0f0624bddd8c56675da0e/draft-ietf-mls-protocol.md#group-state><https://github.com/mlswg/mls-protocol/blob/master/draft-ietf-mls-protocol.md#group-state>, or
b. a value derived based on the MLSPlaintextCommitAutData for the first commit concatenated with 0:
    interim_transcript_hash_[0]
        = Hash(confirmed_transcript_hash_[0] || MLSPlaintextCommitAuthData_[0])
        = Hash(0 || MLSPlaintextCommitAuthData_[0])

The draft strongly suggests to me that it is the former, but the latter seems to more accurately reflect the statement "The confirmed_transcript_hash field contains a running hash over the messages that led to this state."

In the case that a is correct I would suggest updating the definition of interim_transcript_hash_[n] to:

    interim_transcript_hash_[0] = 0
    interim_transcript_hash_[n] =
        Hash(confirmed_transcript_hash_[n] ||
            MLSPlaintextCommitAuthData_[n]);

In the case that b is correct I would suggest adding a "warning" that says something along the lines of "as a placeholder value" to the place(s) where the draft says that the interim_transcript_hash of a group is initialized to 0.

2. What is the `members` array mentioned in the Group creation section<https://github.com/mlswg/mls-protocol/blob/39455d2ea5e8fb42e8f0f0624bddd8c56675da0e/draft-ietf-mls-protocol.md#group-creation>?

In that section it is stated that "A new member receiving a Welcome message can recognize group creation if the number of entries in the `members` array is equal to the number of leaves in the tree minus one." First of all, it is not clear what this `members` array is. It seems this refers to a field of the now-removed Init struct. Interestingly this struct was removed in the very same PR that added the above sentence (see #239<https://github.com/mlswg/mls-protocol/pull/239>). But I wasn't able to really figure out what the draft-09 equivalent of it should be.

In addition, I'm pretty sure this technique would no longer work to detect group creation (but that would depend on how the sentence should be updated).

Regards,
Eric

---

From: Richard Barnes <[email-masked]>
Date: Mon, 10 Aug 2020 10:22:47 -0400

Hi Eric,

Thanks for the analysis here.  More good finds.

1. I think the right answer is a little of both.  If you initialize a
one-member group, before any Commit messages have been sent, then it should
be the zero-length octet string.  But then as soon as the group is used for
something, it is updated.  Maybe the way to clarify this is to fix the
indices.  If we have the interim hash belong to the new epoch, then we
could have something like the following:

interim_[0] = 0
confirmed_[n] = Hash(interim_[n] || MLSPlaintextCommitContent_[n]);
interim_[n+1] = Hash(confirmed_[n] || MLSPlaintextCommitAuthData_[n]);

1.a. BTW, this raises another issue: I had thought we had removed direct
dependencies on hash functions when we move from invoking HKDF to invoking
the KDF from HPKE.  But this points out that we still have raw hash
invocations.  I filed an issue for this:

https://github.com/mlswg/mls-protocol/issues/386

FWIW, I think the latter course there is the right answer, i.e., to keep
the raw hash invocations and clarify that the ciphersuite specifies a hash
function.

2. It seems like the right reference here is probably to the "secrets"
array in the Welcome message.  There's one entry there for each member
being added, so if len(secrets) = len(group_info.tree.leaves) - 1, then
there was only one member in the group to start with.  It's not strictly
true to say that this is a new creation, since one commit could remove all
but one of the members of the group and re-add a new set of members.  But
this distinction doesn't really seem salient.

On Thu, Aug 6, 2020 at 6:02 AM Cornelissen Eric <[email-masked]>
wrote:

> Hi All,
>
>
> I have two questions about things that are unclear to me in the current
> state of the spec as they are undefined/poorly defined.
>
>
>
> 1. What is the intended value of *interim_transcript_hash_**[0]*?
>
> From the current draft I cannot definitively (i.e. with 100% certainty)
> say whether the value of the first *interim_transcript_hash *should be:
>
> a. "the zero-length octet string" following the last line of Group state
> section
> <https://github.com/mlswg/mls-protocol/blob/39455d2ea5e8fb42e8f0f0624bddd8c56675da0e/draft-ietf-mls-protocol.md#group-state>
> <https://github.com/mlswg/mls-protocol/blob/master/draft-ietf-mls-protocol.md#group-state>,
> or
> The draft strongly suggests to me that it is the former, but the latter
> seems to more accurately reflect the statement "The
> *confirmed_transcript_hash* field contains a running hash over the
> messages that led to this state."
>
> In the case that *a* is correct I would suggest updating the definition
> of *interim_transcript_hash_**[n]* to:
>
> In the case that *b* is correct I would suggest adding a "warning" that
> says something along the lines of "*as a placeholder value" *to the
> place(s) where the draft says that the *interim_transcript_hash* of a
> group is initialized to 0.
>
>
> 2. What is the `members` array mentioned in the Group creation section
> <https://github.com/mlswg/mls-protocol/blob/39455d2ea5e8fb42e8f0f0624bddd8c56675da0e/draft-ietf-mls-protocol.md#group-creation>
> ?
>
> In that section it is stated that "A new member receiving a Welcome
> message can recognize group creation if the number of entries in the
> `members` array is equal to the number of leaves in the tree minus one."
> First of all, it is not clear what this `members` array is. It seems this
> refers to a field of the now-removed Init struct. Interestingly this struct
> was removed in the very same PR that added the above sentence (see #239
> <https://github.com/mlswg/mls-protocol/pull/239>). But I wasn't able to
> really figure out what the draft-09 equivalent of it should be.
>
> In addition, I'm pretty sure this technique would no longer work to detect
> group creation (but that would depend on how the sentence should be
> updated).
>
>
> Regards,
> Eric
> _______________________________________________
> MLS mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/mls
>

---

From: Cornelissen Eric <[email-masked]>
Date: Tue, 11 Aug 2020 13:47:30 +0000

Hi Richard,

1. In that case I would agree that clarifying the indices is the way to go. I personally think just adding interim_[0] = 0 to the current definition would suffice and be clearer than your suggestion here, but that's just personal taste.

2. The "secrets" array makes a ton of sense.

If the welcome is ignored when the verification fails, then the fact that this is not strictly true seems to make it impossible to continue with a group after all but one person left (unfortunately, the paragraph doesn't specify what should happen if the verification fails). This is not a cryptographic problem, but I'd imagine this being confusing for end users if the application layer doesn't deal with it properly.

However, as I just pointed out in #385<https://github.com/mlswg/mls-protocol/pull/385>, it seems that we (I) made it impossible for joiners to verify group creation at all.

Regards,

Eric

________________________________
From: Richard Barnes <[email-masked]>
Sent: Monday, August 10, 2020 5:22:47 PM
To: Cornelissen Eric
Cc: [email-masked]
Subject: Re: [MLS] Two poorly defined aspects of the spec

Hi Eric,

1. I think the right answer is a little of both.  If you initialize a one-member group, before any Commit messages have been sent, then it should be the zero-length octet string.  But then as soon as the group is used for something, it is updated.  Maybe the way to clarify this is to fix the indices.  If we have the interim hash belong to the new epoch, then we could have something like the following:

interim_[0] = 0

1.a. BTW, this raises another issue: I had thought we had removed direct dependencies on hash functions when we move from invoking HKDF to invoking the KDF from HPKE.  But this points out that we still have raw hash invocations.  I filed an issue for this:

FWIW, I think the latter course there is the right answer, i.e., to keep the raw hash invocations and clarify that the ciphersuite specifies a hash function.

2. It seems like the right reference here is probably to the "secrets" array in the Welcome message.  There's one entry there for each member being added, so if len(secrets) = len(group_info.tree.leaves) - 1, then there was only one member in the group to start with.  It's not strictly true to say that this is a new creation, since one commit could remove all but one of the members of the group and re-add a new set of members.  But this distinction doesn't really seem salient.

On Thu, Aug 6, 2020 at 6:02 AM Cornelissen Eric <[email-masked]<mailto:[email-masked]>> wrote:

Hi All,

Regards,
Eric
_______________________________________________
MLS mailing list
[email-masked]<mailto:[email-masked]>
https://www.ietf.org/mailman/listinfo/mls

---

From: Richard Barnes <[email-masked]>
Date: Tue, 11 Aug 2020 11:22:32 -0400

I filed #388 to fix (1) and (1a).

https://github.com/mlswg/mls-protocol/pull/388

Not sure what to do with your observations about Welcome.  If you have
thoughts about how to clarify, please send a PR!

--Richard

On Tue, Aug 11, 2020 at 9:47 AM Cornelissen Eric <[email-masked]>
wrote:

> Hi Richard,
>
>
> 1. In that case I would agree that clarifying the indices is the way to
> go. I personally think just adding *interim_[0] = 0* to the current
> definition would suffice and be clearer than your suggestion here, but
> that's just personal taste.
>
>
> If the welcome is ignored when the verification fails, then the fact that
> this is not strictly true seems to make it impossible to continue with a
> group after all but one person left (unfortunately, the paragraph doesn't
> specify what should happen if the verification fails). This is not a
> cryptographic problem, but I'd imagine this being confusing for end users
> *if* the application layer doesn't deal with it properly.
>
>
> However, as I just pointed out in #385
> <https://github.com/mlswg/mls-protocol/pull/385>, it seems that we (I)
> made it impossible for joiners to verify group creation at all.
>
>
>
> Regards,
>
> Eric
>
> ------------------------------
> *From:* Richard Barnes <[email-masked]>
> *Sent:* Monday, August 10, 2020 5:22:47 PM
> *To:* Cornelissen Eric
> *Cc:* [email-masked]
> *Subject:* Re: [MLS] Two poorly defined aspects of the spec
>
> Hi Eric,
>
>> In addition, I'm pretty sure this technique would no longer work to
>> detect group creation (but that would depend on how the sentence should be
>> updated).
>>
>>
>> Regards,
>> Eric

---

From: Cornelissen Eric <[email-masked]>
Date: Tue, 18 Aug 2020 14:27:11 +0000

Thanks Richard

Regarding my observations about Welcome. I would need some context about whether or not we want joiners to verify group creation. (*)

  1. We want to verify group creation.

  In this case, first of all, the changes in <https://github.com/mlswg/mls-protocol/pull/385> #385<https://github.com/mlswg/mls-protocol/pull/385><https://github.com/mlswg/mls-protocol/pull/385> need to be reverted (as pointed
  out in that thread and in #390<https://github.com/mlswg/mls-protocol/issues/390><https://github.com/mlswg/mls-protocol/issues/390>). Then, to prevent the attack for which that change
  was introduce I would propose the following: disallow the use of "add-only" commits
  on group creation AND requiring the initial group member(s) to verify that a "full"
  commit was used in the group creation.

  2. We don't need to verify group creation.

  In this case the only thing (I think) that has to change is that the last paragraph of
  the should be remove. (and #390<https://github.com/mlswg/mls-protocol/issues/390> can be closed.)

As I stated earlier, I would personally be in favor of option 2 as 1) it is the simpler solution, 2) the existing method of detecting group creation is not foolproof (**), and 3) I don't see a reason to verify the group creation process. In fact, a malicious client can always prevent joiners from being able to do this verification by simply performing a separate commit before adding the actual group members (***).

If you agree that 2 is the way to go, I'll get out a PR as soon as possible.

Regards,
Eric

(*): The git history isn't of much help here. As far as I can tell the group creation verification paragraph was added in 5490d0e<https://github.com/mlswg/mls-protocol/commit/5490d0ebfa1b41fff0ee54966ef375c37dadab68>/2f2f5d8<https://github.com/mlswg/mls-protocol/commit/2f2f5d813037f7cf3c3d0d78612bc506f31eef5e>/#239<https://github.com/mlswg/mls-protocol/pull/239>. None of which provide any insight into why the verification is useful. Perhaps this was discussed in a meeting somewhere?
(**): Nor do I think there exists any effective way of detecting group creation.
(***): In which case reverting #385<https://github.com/mlswg/mls-protocol/pull/385><https://github.com/mlswg/mls-protocol/pull/385> would only hurt the malicious client.

________________________________
From: Richard Barnes <[email-masked]>
Sent: Tuesday, August 11, 2020 6:22:32 PM
To: Cornelissen Eric
Cc: [email-masked]
Subject: Re: [MLS] Two poorly defined aspects of the spec

Not sure what to do with your observations about Welcome.  If you have thoughts about how to clarify, please send a PR!

--Richard

On Tue, Aug 11, 2020 at 9:47 AM Cornelissen Eric <[email-masked]<mailto:[email-masked]>> wrote:

Hi Richard,

Regards,

Eric

Cc: [email-masked]<mailto:[email-masked]>

Hi Eric,

interim_[0] = 0

Hi All,

Regards,
Eric

---

From: Richard Barnes <[email-masked]>
Date: Tue, 18 Aug 2020 10:40:10 -0400

Hi Eric,

I agree with (2).  I think the stuff that's in the spec right now about
verifying group creation is mainly just a legacy of the fact that we used
to have separate Init and Add operations.  When those got coalesced into
Welcome, it must have seemed appealing to enable recipients to continue to
distinguish the cases.  But as you point out, that's not really tenable.

So please feel free to send a PR!

Thanks,
--Richard

On Tue, Aug 18, 2020 at 10:27 AM Cornelissen Eric <[email-masked]>
wrote:

> Thanks Richard
>
> Regarding my observations about Welcome. I would need some context about
> whether or not we want joiners to verify group creation. (*)
>
>   In this case, first of all, the changes in
> <https://github.com/mlswg/mls-protocol/pull/385>#385
> <https://github.com/mlswg/mls-protocol/pull/385>
> <https://github.com/mlswg/mls-protocol/pull/385> need to be reverted (as
> pointed
>   out in that thread and in #390
> <https://github.com/mlswg/mls-protocol/issues/390>
> <https://github.com/mlswg/mls-protocol/issues/390>). Then, to prevent the
> attack for which that change
>   the should be remove. (and #390
> <https://github.com/mlswg/mls-protocol/issues/390> can be closed.)
>
>
> As I stated earlier, I would personally be in favor of option 2 as 1) it
> is the simpler solution, 2) the existing method of detecting group creation
> is not foolproof (**), and 3) I don't see a reason to verify the group
> creation process. In fact, a malicious client can always prevent joiners
> from being able to do this verification by simply performing a separate
> commit before adding the actual group members (***).
>
>
> (*): The git history isn't of much help here. As far as I can tell the
> group creation verification paragraph was added in 5490d0e
> <https://github.com/mlswg/mls-protocol/commit/5490d0ebfa1b41fff0ee54966ef375c37dadab68>
> /2f2f5d8
> <https://github.com/mlswg/mls-protocol/commit/2f2f5d813037f7cf3c3d0d78612bc506f31eef5e>
> /#239 <https://github.com/mlswg/mls-protocol/pull/239>. None of which
> provide any insight into why the verification is useful. Perhaps this was
> discussed in a meeting somewhere?
> (***): In which case reverting #385
> <https://github.com/mlswg/mls-protocol/pull/385>
> <https://github.com/mlswg/mls-protocol/pull/385> would only hurt the
> malicious client.
>
> *Sent:* Tuesday, August 11, 2020 6:22:32 PM
> *To:* Cornelissen Eric
> *Cc:* [email-masked]
> On Tue, Aug 11, 2020 at 9:47 AM Cornelissen Eric <
> [email-masked]> wrote:
>
>> Hi Richard,
>>
>>
>> group after all but one person left (unfortunately, the paragraph
>> doesn't specify what should happen if the verification fails). This is
>> not a cryptographic problem, but I'd imagine this being confusing for end
>> users *if* the application layer doesn't deal with it properly.
>>
>>
>> On Thu, Aug 6, 2020 at 6:02 AM Cornelissen Eric <
>> [email-masked]> wrote:
>>
>>> Hi All,
>>>
>>>
>>> a. "the zero-length octet string" following the last line of Group
>>> state section

---

From: Cornelissen Eric <[email-masked]>
Date: Tue, 18 Aug 2020 14:48:25 +0000

Hi Richard,

Thanks for the confirmation. I submitted a PR for this at https://github.com/mlswg/mls-protocol/pull/395.

Regards,

Eric

________________________________
From: Richard Barnes <[email-masked]>
Sent: Tuesday, August 18, 2020 5:40:10 PM
To: Cornelissen Eric
Cc: [email-masked]
Subject: Re: [MLS] Two poorly defined aspects of the spec

Hi Eric,

I agree with (2).  I think the stuff that's in the spec right now about verifying group creation is mainly just a legacy of the fact that we used to have separate Init and Add operations.  When those got coalesced into Welcome, it must have seemed appealing to enable recipients to continue to distinguish the cases.  But as you point out, that's not really tenable.

Thanks,
--Richard

On Tue, Aug 18, 2020 at 10:27 AM Cornelissen Eric <[email-masked]<mailto:[email-masked]>> wrote:

Thanks Richard

Regards,
Eric

--Richard

Hi Richard,

Regards,

Eric

Hi Eric,

interim_[0] = 0

Hi All,

Regards,
Eric