Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC4153: Exclude non-cross-signed devices #4153

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions proposals/4153-invisible-crypto.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client embodying these values (preferably cross platform).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that EW and EX both implement this, via their respective labs flags.

EW's setting looks like this:

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving @escix 's question to a thread:

I am a non-technical person, so apologies if I am not making sense in my comments.

Currently, EX uses three identity confirmation methods:

  • Use another device= This is the easiest one as all cryptography is already done in another device.

  • Enter a recovery key= This, I believe, is the Security key to obtain the encryption key from the server.

  • Can't confirm= This is to reset my message history and setup a new Security key.

If I understand properly, this MSC is to make login, identity verification and backup on the first login simple and efficient.

Login: dealt with username and password

Identity verification: Unless the persons are next to each other this will be an out-of-band confirmation. If the persons are next to each other this can be verified by scanning a QR code or something. On an out of bound scenario, this can be a phone call and confirmation of emojis or random numbers. However, in the current proposal, in the first use it is proposed to accept the identity by default. This will improve the user engagement, but can an advance section present so the above methods can be used by advanced users?

Backup Security keys: I think, by default, the encryption keys must be saved in the server and also in the device (downloaded as a file). Both can be protected with the same Security key.

So on the first login, use the username and password to login and presented with the option for identity verification with a skip button for non-technical users. Then proceed to 'backup encryption keys' with a Security Key.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your questions aren't easy to understand, but:

However, in the current proposal, in the first use it is proposed to accept the identity by default. This will improve the user engagement, but can an advance section present so the above methods can be used by advanced users?

Yes, it is proposed that users will trust other users' identity on first use, but it will still be possible to verify other users' identity explicitly via QR codes or emoji. And some applications may expose a feature where they will only send messages in rooms where all users have been explicitly verified in this way. I don't think there are any plans to support that in EX, but that would be a matter for the Element X issue trackers, not this Matrix spec proposal.

Backup Security keys: I think, by default, the encryption keys must be saved in the server and also in the device (downloaded as a file). Both can be protected with the same Security key.

I think that when you say "Backup Security keys", you mean what we now refer to as the Recovery key? (see also element-hq/element-meta#2394 (comment)). I don't think this MSC changes anything in this area.

Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# MSC4153: Invisible Cryptography

End-to-end encryption was first introduced to Matrix in 2016. Over the years,
more encryption-related features have been added, such as key verification,
cross-signing, key backup, and secure storage/sharing.

The current spec allows clients freedom to choose what features to implement.
And while clients should be able to make decisions based on their threat model,
there are behaviours that the spec can recommend that will improve the user
experience and security of encrypted conversations.

In general, this MSC proposes to standardize on using cross-signing as a basis
for trusting devices. While a user may be unable to verify every other user
that they communicate with, or may be unaware of the need to verify other
users, cross-signing gives some measure of protection and so should be used
where possible. One of the goals of this MSC is to reduce the number of
warnings that users will encounter by taking advantage of cross-signing.

## Proposal

The changes below only apply to clients that support encryption.

### Users should have cross-signing keys

Clients should create new cross-signing keys for users who do not yet have
cross-signing keys.

Users should have Secret Storage with a default key that encrypts the private
cross-signing keys and key backup key (if available)

The spec currently does not give recommendations for what information is stored
in Secret Storage, or even whether Secret Storage is available to users. A
user’s Secret Storage should contain the user’s cross-signing secret keys and
the key backup decryption key (if the user is using key backup). This ensures
that users have a more consistent experience.

### Verifying individual devices of other users is deprecated

When one user verifies a different user, the verification should verify the
users’ cross-signing keys. Any flow that verifies only the device keys of
different users is deprecated. Verifying a user’s own device keys is still
supported.

### Devices should be cross-signed

Clients should encourage users to cross-sign their devices. This includes both
when logging in a new device, and for existing devices. Clients may even go so
far as to require cross-signing of devices by preventing the user from using
the client until the device is cross-signed. If the user cannot cross-sign
their device (for example, if they have forgotten their Secret Storage key),
the client can allow users to reset their Secret Storage, cross-signing, and
key backup.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a client enforces cross signing, how would cross signing work without access to other devices or recovery key?

Real scenario that happens to me from time to time:
Not all my accounts have the same powerlevel in rooms, sometimes I need to switch accounts on the go to carry out a moderation action. Worse, most of the moderation bot rooms I interact with on the regular use End-to-End Encryption (usually via Pantalaimon). Additionally, I do not feel comfortable keeping a copy of my Recovery Keys on my phone, or accessible to my phone, nor want to rely on physical devices (eg. security keys) when eg. going to a party, hanging out with friends at an entertainment park, etc.

Element X Android provides a good example here: while I enjoy using sliding sync, using Element X left me unable to carry out moderation actions due to being unable to switch accounts without cross-signing.
I'm currently using Schildichat Next to bypass cross signing requirements, but having multiple copies installed would exacerbate my out-of-memory issues on my phone, which are already preventing me from using it effectively at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paragraph says "may even", so enforcing cross-signing when logging in is not a requirement. Moreover, moderation actions are usually state events, which are not E2EE authenticated at the moment, so the situation there should remain unchanged.

Your unsigned device should get ignored for everything that is E2EE authenticated though, and for a good reason—the very concept of unsigned devices is unsound in an E2EE setting, because such devices can be freely added by the server, so in what sense is it E2EE at all? I don't think your scenario has much bearing on that fact.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why moderation bots is a concern is because they are controlled via regular messages in dedicated rooms. Said room if your using mjolnir is recomended to be Encrypted.


### Clients should flag when cross-signing keys change

If Alice’s cross-signing keys change, Alice’s own devices must alert her to
this fact, and prompt her to re-cross-sign those devices. If Bob is in an
encrypted room with Alice, Bob’s devices should inform him of Alice’s key
change and should prevent him from sending an encrypted message to Alice
without acknowledging the change.

Bob’s clients may behave differently depending on whether Bob had previously
verified Alice or not. For example, if Bob had previously verified Alice, and
Alice’s keys change, Bob’s client may require Bob to re-verify, or may display
a more aggressive warning.

Note that this MSC does not propose a mechanism for remembering previous
cross-signing keys between devices. In other words if Alice changes her
cross-signing keys and then Bob logs in a new device, Bob’s new device will not
know that Alice’s cross-signing keys had changed, even if Bob has other devices
that were previously logged in. Such a mechanism could be proposed by another
MSC.

### Room keys should by default not be sent to non-cross-signed devices

Since non-cross-signed devices don’t provide any assurance that the device
belongs to the user, and server admins can trivially create new devices for
users, clients should not send room keys to non-cross-signed devices by
default. Clients may provide users the ability to encrypt to specific
non-cross-signed devices, for example, for development or testing purposes.

### Messages from non-cross-signed devices should be untrusted

Similarly, clients have no assurance that encrypted messages sent from
non-cross-signed devices were sent by the user, rather than an
impersonator. Therefore messages sent from non-cross-signed devices cannot be
trusted and should be displayed differently to the user. For example, the
message could be displayed with a warning, or may be hidden completely from the
user. Again, clients may be allow the user to override this behaviour for
specific devices for development or testing purposes.

## Potential Issues

If a user has devices that are not cross-signed, they will not be able to
communicate with other users whose clients implement this proposal completely,
due to the last two points. Thus we encourage clients to implement
cross-signing as soon as possible, and to encourage users to cross-sign their
devices, and clients should delay the implementation of the last two points (or
make it optional) until most clients have implemented cross-signing.

TODO: status of cross-signing in clients

## Alternatives

## Security considerations

## Unstable prefix

No new names are introduced, so no unstable prefix is needed.

## Dependencies

Though not strictly dependencies, other MSCs improve the behaviour of this MSC:
- [authenticated backups
(MSC4048)](https://github.com/matrix-org/matrix-spec-proposals/pull/4048)
will improve the user experience by ensuring that trust information is
preserved when loading room keys from backup. TODO: I think we also need to
add information to the backup about the cross-signing status of the device
- [Including device keys with Olm-encrypted events
(MSC4147)](https://github.com/matrix-org/matrix-spec-proposals/pull/4147)
allows recipients to check the cross-signing status of devices that have been
deleted