element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
10.99k stars 1.95k forks source link

Can't Read All Messages In Browser #27795

Open muellert opened 1 month ago

muellert commented 1 month ago

Steps to reproduce

  1. I am using Elements on a mobile.
  2. I exported the session key and copied it to my computer.
  3. I opened 'app.element.io, logged in with the same account I'm using on my mobile, and verify this with my Elements on my mobile (no other method works).
  4. I select a channel.
  5. I see "Unable to decrypt message" everywhere.
  6. I import an "E2E room key".
  7. I still see "Session key: <not supported>".

Outcome

What did you expect?

I expected to be able to read all messages in that channel.

What happened instead?

Some messages are readable. Others still show "Unable to decrypt message".

So far, it seems as if only messages I sent from my mobile while I was logged out in the browser, are unreadable in the browser once I log in there, while messages which I received during that same time, are readable.

Operating system

Debian 12

Browser information

Chromium 121.0.6167.139 (Official Build) built on Debian 12.4, running on Debian 12.6 (64-bit)

URL for webapp

app.element.io

Application version

Element version: 1.11.71 Crypto version: Rust SDK 0.7.1 (80a151e), Vodozemac 0.6.0

Homeserver

matrix.org

Will you send logs?

No (what would be in those logs?)

ruben1PvP commented 1 month ago

I have the same issue. I've seen that:

  1. It doesn't matter if you CTRL + F5 or if you log out and log in again.
  2. It doesn't matter what method you use to decrypt the messages (verifying by another device or using the secret key).
  3. It happened to me in Firefox and in Windows 10.
  4. Sometimes it says that the key backup is not working, others that it does but the session is waiting (eternally) to get them.
  5. I logged out, cleaned cookies and cache from my browser and logged in again. Problem persists.

I basically have one device where I can't decrypt the messages from my e2e rooms. The others are ok. Even new messages that I sent from the session where the decryption is not working are decrypted in other devices without any problem.

dbkr commented 1 month ago

This will need investigation to see if there's a particular, exact sequence of steps to trigger the bug. Otherwise, this is going to be tough to investigate without logs.

ruben1PvP commented 1 month ago

This will need investigation to see if there's a particular, exact sequence of steps to trigger the bug. Otherwise, this is going to be tough to investigate without logs.

Is it even possible for us (The people who have the problem) to get logs and send them here? For us, the "exact sequence of steps" is just logging in in app.element.io and verifying the session.

muellert commented 1 month ago

In a different discussion, a guy from Mozilla suggested I try their current browser (FF 128). Today, I did, and that thing can read even fewer messages than my Chromium, using the same key.

t3chguy commented 1 month ago

I import an "E2E room key".

These keys you're exporting/importing only contain keys to history at that moment in time, as megolm keys are cycled and new ones are formed any time someone joins or leaves a room to ensure Perfect Forward Secrecy. So this explains why you keep having fewer messages available as you load the same key into newer sessions.

muellert commented 1 month ago

I don't understand how logging in to the same room with the same account, just on a different browser, constitutes "joining" a room. Regarding the room in question, there are only two people in it, me, and someone else. It has been like that from day one, and there will be no change.

t3chguy commented 1 month ago

I don't understand how logging in to the same room with the same account, just on a different browser, constitutes "joining" a room.

Each of your devices has its own cryptographic identity (olm), if that didn't happen then if someone compromised your device, e.g. it was stolen, they'd be able to not only decrypt history but also future. Megolm sessions are also rotated periodically, every N messages & every M days. So again, your export only guarantees the history from before it is decryptable.

muellert commented 1 month ago

Good point. So the reason why my older messages are all readable on my phone is because they're re-encrypted with the new key?

t3chguy commented 1 month ago

You haven't given enough information about your phone to know which device it is in this series. Once a device is authenticated it'll receive any new megolm sessions from that point onwards but have no access to history unless you have keybackup (or manual key export as in your case) and then the messages for which the keys were included in the backup will be decryptable.

ruben1PvP commented 1 month ago

I import an "E2E room key".

These keys you're exporting/importing only contain keys to history at that moment in time, as megolm keys are cycled and new ones are formed any time someone joins or leaves a room to ensure Perfect Forward Secrecy. So this explains why you keep having fewer messages available as you load the same key into newer sessions.

In my case this would not be the case, knowing that if I log in another client (like Fluffychat) or in Element Android after logging in web and having these problems, all the encrypted messages are visible. Can mine be considered then a new problem? Do I have to open a new issue myself?

t3chguy commented 1 month ago

sounds like you are using key backup and for some reason it isn't getting restored, have you tried manually restoring it?

image
ruben1PvP commented 1 month ago

sounds like you are using key backup and for some reason it isn't getting restored, have you tried manually restoring it?

image

I don't know how that would change a thing, it asked me for my security key like it did multiple times before and, as I said before, that doesn't work.