matrix-org / matrix-org/matrix-spec

Immutable encryption and history visibility

Open
#2,302 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

improvement
Dominant language
HTML
Stars
330
Forks
150
Avg merge
2h 21m
Merged PRs (30d)
3

Description

End-to-end encryption plays a much more important role in today's Matrix than originally envisioned. However, only room messages are end-to-end encrypted and authenticated while room state is not. This impacts both confidentiality—exposing information to the homeserver that it should not possess—but also integrity, because the homeserver can also freely manipulate the room state and not just the rooms members. This issue will ignore the confidentiality aspect and focus on integrity.

For some types of state, this risk is somewhat acceptable. For example if the homeserver changes the room topic, that's not very exciting and is largely a nuisance. But for other state, like the room's encryption settings or history visibility (especially with MSC4268), it can be devastating because it provides the homeserver with a potential mechanism to also impact the confidentiality of messages.

In the absence of authenticated room state, we've developed a number of partial solutions to the problem. For example, once Matrix clients observe a `m.room.encryption` event, they will permanently enable decryption and prevent downgrade. However, these solutions are inherently somewhat flaky.

Recently, I (and others) have wondered how important it really is to support mutating these settings during the lifetime of a room. I propose that it isn't and that mutation would be better modelled by spawning a new room. This then presents another potential solution to the problem: making these settings immutable. Somewhat serendipitously, project Hydra has recently ensured that with new room versions the create event is bound to the room ID, allowing a joiner a way to be sure they got the genuine (and unique) create event for the room. The create event then provides a natural way to store important room settings in an authenticated way.

I therefore propose the idea that room encryption settings and history visibility should be made immutable by storing them in the `m.room.create` event in a future room version. Note that there is prior art for the encryption algorithm specifically, in the form of MSC4245, though it's framed there as an MLS-compatibility measure rather than a generic security mechanism.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with this issue and review the referenced MSC4245 and MSC4268 proposals, along with the mention of Hydra's room versions. Determine the required future room-version specification changes for immutable encryption settings and history visibility; done means the proposal is concretely specified and its security implications are addressed.

Written by the indexing model from the issue text.

Assessment

Domain
cryptography, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.