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

Receiver can't decrypt messages, missing identity and fingerprint key #11049

Open
TheTimeWalker opened this issue Oct 4, 2019 · 14 comments
Open
Labels
A-E2EE T-Defect Z-UISI Unable to decrypt errors

Comments

@TheTimeWalker
Copy link

TheTimeWalker commented Oct 4, 2019

Description

One of our coworker booted up her Riot Desktop and is greeted by a big list of "Could not decrypt messages" from every sender that she could receive. Curiously, all messages are the same that they do not contain any identity or fingerprint key.

447803955_55263
Example with one of my messages.

Steps to reproduce are unknown, the only thing that can be said for reproduction is that she didn't open the Desktop client for a week. She never logged out so the device is still in the account's device list.

Android Riot also fails to decrypt messages. They however do have a fingerprint and identity key. It even shows from what device they appear but it still silently fails in the background.

Logs being sent: yes

Version information

macOS Mojave, Riot Desktop 1.4.1
Android 7.0, Riot.im 0.9.6

Bounty

I have added a 20$ bounty for anybody that can fix this issue: https://www.bountysource.com/issues/81389159-receiver-can-t-decrypt-messages-missing-identity-and-fingerprint-key

@TheTimeWalker
Copy link
Author

TheTimeWalker commented Oct 9, 2019

Okay so I have checked out what happens in the logs and I found this part very interesting:
device-list-flush

What it seems like is that Riot marks the device list as obsolete and probably removes the device list while the key retrieval and decryption is still working. This probably breaks the decryption as it can't put the keys to the specific devices it needs to and fails. This could also explain why it feels like this happens randomly and less reproducible than it seems.

Especially noteworthy: all the messages of these three people mentioned in the console couldn't be decrypted which includes myself too from my mobile phone.

@TheTimeWalker
Copy link
Author

I have added a 20$ bounty for anybody that can fix this issue: https://www.bountysource.com/issues/81389159-receiver-can-t-decrypt-messages-missing-identity-and-fingerprint-key

@imtbl
Copy link

imtbl commented Oct 22, 2019

I can confirm this (or a very similar) behavior sometimes happening to both messages I sent myself (from a different device) and messages sent by a friend.

Even though all those devices (both mine and my friend's) are verified with each other, I sometimes get the following notification when accessing the room and trying to read the messages on a different device than the one the message was sent from:

** Unable to decrypt: The sender's device has not sent us the keys for this message. **

Looking at the end-to-end encryption information of such messages, it says unknown device under Sender device information and identity and fingerprint keys are also sometimes missing.

The only thing I am quite certain of at this point is that it never occurs on a device if Riot is open while messages are coming in. It only happens if Riot is closed at the time the messages are written and it pulls them once it's launched and the room is accessed.

This bug seems to be independent of the platform, since I have experienced this on macOS, iOS, iPadOS, Windows and Arch Linux so far. It also happened when using accounts on both matrix.org and a self-hosted homeserver (using the latest version of Synapse).

@TheTimeWalker
Copy link
Author

This issue is still hitting us all very often, myself included. This happens on both 1:1 chats and group chats. It seems to be a Riot Desktop only bug and almost always happens when trying to fetch and decrypt messages when for example the laptop was offline for a while - generally can be 30min. With this it's not feasible to have encryption by default for people that exclusively use Riot Desktop and none of the other clients 😞

@ara4n
Copy link
Member

ara4n commented Nov 30, 2019

i’m actively hunting these bugs currently in the run-up to enabling e2ee by default. please submit bug reports from the sending & receiving device immediately after an undecryptable message and i will dig into it.

@TheTimeWalker
Copy link
Author

TheTimeWalker commented Dec 4, 2019

Others and I did send a few logs for this in hopes that this could solve it. The difficult part is that the time distance between sender and receiver is sometimes too big and the failed decryption happens at seemingly random.

As said prior, this pretty much happens at any time when the receiver wasn't online for a while, either by having the laptop closed or not connected to the internet. And this also can't be done by quickly disconnecting for a minute, sending and then connecting again. You need to be offline for at least 30min.

From my POV after looking into it a while, it feels like there's some discrepancy between when Riot invalidates the device list and when it's in the process of decrypting. I did try to dabble into the SDK code but couldn't find a solution to it myself yet either. And from my personal standpoint, sadly after suggesting this client in our work space, I'm getting lash back as decryption doesn't work properly for people that exclusively use Riot Desktop only where E2E was the main selling point. (Note it's only group chats of maybe 4-5 people) ☹️

@TheTimeWalker
Copy link
Author

TheTimeWalker commented Jun 4, 2020

Since this has been a while and cross signing was implemented, let me just write into here that this issue still persists with the latest Riot Web/Desktop 1.6.2

image

As usual, this only happens if the Riot Web/Desktop instance was offline for a while and reconnects. This doesn't happen if it's connected to the server. Weirdly enough, it occasionally fails to decrypt my messages even though my device list has been the same since cross signing dropped to release

Just noticed now, you can see those red shields on the left side. It seems that anytime it can't decrypt those messages then it is marked as "Encrypted by a deleted session"

@TheTimeWalker
Copy link
Author

TheTimeWalker commented Jul 14, 2020

Riot Web 1.6.8
Same symptoms as usual. The new thing that I noticed is this:
image

Sometimes it seems like the messages get decrypted but their authenticity can not be guaranteed which is very strange. Looking at the source of the message and comparing it with the device list of the sent message, the device id are matching. That means it fails to compare the source device id with the person's device list. This also only happened after waking up from standby (Riot reconnects) so my assumption is that it's connected to this issue.

FWIW, this is what I see a lot in my logs:
image

@uhoreg
Copy link
Member

uhoreg commented Jul 15, 2020

The "The authenticity of this encrypted message can't be guaranteed on this device" message means that it got the key from key backup or from key sharing, and is due to the way the message signatures are done.

@TheTimeWalker
Copy link
Author

Well, it doesn't seem like that. I've had it happen again and the shield is consistently staying even for newly received messages right immediately. Even after restarting element-desktop

@rgpublic
Copy link

I also got this after logging out and in again on the desktop. All my historic messages now have a gray warning shield with "the authenticity of this encrypted message can't be guaranteed on this device" warning. My own messages even have a red shield with "Encrypted by a deleted session". New messages seem to work okay again.

I don't understand. How can this happen? Why can't the authenticity be guaranteed? On my phone (where I didn't log out and in), I don't have the warning shields. Doesn't that mean that Element on my phone can in fact still guarantee the authenticity? And my desktop trusts my phone, right? Is there any way to solve this or should I just wait until all the red/gray warning shields have scrolled out into oblivion by new incoming messages?

@kazetsukaimiko
Copy link

Hey guys, for what it is worth I ran into this issue when a friend switched from using a browser (we'll call this client A) to using the electron app (we'll call this client B). His electron app/ client B would show "grey sheids" for all messages even though all sessions were verified (it also appears we lost the ability to forcefully re-verify sessions or revoke trust in an update?). What seemed to change the condition- if I restarted my client (client C), client B would no longer see the problem.

Perhaps this has something to do with where the needed encryption keys are sourced from when decrypting messages? Would a key from key backup produce a "grey shield" where the same key obtained by request from a trusted client produce a trusted message result?

@rgpublic
Copy link

For my part, I'm still wondering why the gray shield exists anyway. What exactly does it tell the users that's really worth informing them about? I can only guess: Is it perhaps that the message as you see it right now on the screen cannot be trusted to really have been sent like that in the past and might be fake/manipulated history? So that would mean: If the user didn't see the actual message back then when it didn't have the gray shield yet and still remembers that someone actually wrote such a message, it might be that this message has never been sent. Is that true? At least, that would make sense to me to warn the user about such a case... But I'm still totally unsure if it works like that or whether the gray shield has a totally different meaning. Without any further explanation I still find this highly confusing. People think sth. is broken or unsecure or sth. like that if all their messages suddenly get that icon.

@uhoreg
Copy link
Member

uhoreg commented Dec 11, 2020

The issue for the grey shield is #14323, which includes an explanation about what it means.

@jryans jryans removed the bounty label Mar 5, 2021
@MadLittleMods MadLittleMods added the Z-UISI Unable to decrypt errors label Sep 9, 2021
su-ex added a commit to SchildiChat/element-web that referenced this issue Feb 22, 2024
* OIDC: add delegatedauthentication to validated server config ([\element-hq#11053](matrix-org/matrix-react-sdk#11053)). Contributed by @kerryarchibald.
* Allow image pasting in plain mode in RTE ([\element-hq#11056](matrix-org/matrix-react-sdk#11056)). Contributed by @alunturner.
* Show room options menu if "UIComponent.roomOptionsMenu" is enabled ([\element-hq#10365](matrix-org/matrix-react-sdk#10365)). Contributed by @maheichyk.
* Allow image pasting in rich text mode in RTE ([\element-hq#11049](matrix-org/matrix-react-sdk#11049)). Contributed by @alunturner.
* Update voice broadcast redaction to use MSC3912 `with_rel_type` instead of `with_relations` ([\element-hq#11014](matrix-org/matrix-react-sdk#11014)). Fixes element-hq#25471.
* Add config to skip widget_build_url for DM rooms ([\element-hq#11044](matrix-org/matrix-react-sdk#11044)). Fixes vector-im/customer-retainer#74.
* Inhibit interactions on forward dialog message previews ([\element-hq#11025](matrix-org/matrix-react-sdk#11025)). Fixes element-hq#23459.
* Removed `DecryptionFailureBar.tsx` ([\element-hq#11027](matrix-org/matrix-react-sdk#11027)). Fixes element-hq/element-meta#1358. Contributed by @florianduros.
* Fix translucent `TextualEvent` on search results panel ([\element-hq#10810](matrix-org/matrix-react-sdk#10810)). Fixes element-hq#25292. Contributed by @luixxiul.
* Matrix matrix scheme permalink constructor not stripping query params ([\element-hq#11060](matrix-org/matrix-react-sdk#11060)). Fixes element-hq#25535.
* Fix: "manually verify by text" does nothing ([\element-hq#11059](matrix-org/matrix-react-sdk#11059)). Fixes element-hq#25375. Contributed by @kerryarchibald.
* Make group calls respect the ICE fallback setting ([\element-hq#11047](matrix-org/matrix-react-sdk#11047)). Fixes vector-im/voip-internal#65.
* Align list items on the tooltip to the start ([\element-hq#11041](matrix-org/matrix-react-sdk#11041)). Fixes element-hq#25355. Contributed by @luixxiul.
* Clear thread panel event permalink when changing rooms ([\element-hq#11024](matrix-org/matrix-react-sdk#11024)). Fixes element-hq#25484.
* Fix spinner placement on pinned widgets being reloaded ([\element-hq#10970](matrix-org/matrix-react-sdk#10970)). Fixes element-hq#25431. Contributed by @luixxiul.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-E2EE T-Defect Z-UISI Unable to decrypt errors
Projects
None yet
Development

No branches or pull requests

9 participants