question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot decrypt messages from specific user sent using specific device: `Unable to decrypt: OLM`

See original GitHub issue

Describe the bug

When using Element Android on a phone running Android 10, E2E messages received from one specific device belonging to another user are not immediately viewable. Instead, Waiting for this message, this may take a while is seen in place of the message contents, or ** Unable to decrypt: OLM ** when Developer mode is turned on in Element’s advanced settings.

To Reproduce

A room exists consisting of me and my friend Ed, each using our own, self-hosted Synapse homeservers. We have not tested for this issue in other rooms.

Steps to reproduce the behavior:

  1. Ed uses his phone to send a message to this room.
  2. I observe the following: a. On my phone running Android 10: Often Unable to decrypt: OLM is shown in place of the message contents. Otherwise, the message contents are visible, as expected. b. On my phone running Android 6: The message contents are visible, as expected. c. On my computer with Element Desktop: The message contents visible, as expected.

For comparison, we tested the following:

  1. Ed uses his computer with Element Desktop to send a message to this room.
  2. I observe the following: a. On my phone running Android 10: The message contents visible, as expected. b. On my phone running Android 6: The message contents are visible, as expected. c. On my computer with Element Desktop: The message contents are visible, as expected.

We also tested:

  1. I use my Android 10 phone to send a message to this room.
  2. On Ed’s phone: The message contents are visible, as expected.

Finally, we tested:

  1. In a new room, without E2E enabled, Ed uses his phone to send a message to the room.
  2. I observe the following: a. On my phone running Android 10: The message contents are visible, as expected. b. On my phone running Android 6: The message contents are visible, as expected. c. On my computer with Element Desktop: The message contents are visible, as expected.

Each test consisted of Ed (or myself) sending multiple messages in quick succession, and the ‘failure’ rate for my ability to view messages on the affected phone was 100%. But under normal, “real life” circumstances (i.e. an actual conversation), this only occurred once every few messages.

I’ve concluded that this issue only affects messages sent from Ed’s phone when they’re viewed on my Android 10 phone, and in a room with E2E enabled.

On the affected (Android 10) phone, logs were captured using logcat over adb. The following is shown repeatedly when affected messages are received:

05-24 21:55:02.212 27914  1430 E OlmJniNative:  ## decryptMessageJni(): failure - olm_group_decrypt Msg=BAD_MESSAGE_MAC
05-24 21:55:02.212 27914  1430 E OlmInboundGroupSession: ## decryptMessage() failed BAD_MESSAGE_MAC

The affected messages eventually become visible on the Android 10 phone, but I have not figured out how long the delay actually is. It appears to be greater than a few hours.

This issue has not affected communications with any other users yet.

Expected behavior

When Ed sends me a message, it will be viewable on every device I have Element and E2E correctly set up on in a reasonable amount of time, regardless of which of his devices he uses to send it.

Screenshots

Screenshots have been attached.

Smartphone (please complete the following information):

My phone affected by this issue
  • Device: Motorola Moto Z3 Play
  • OS: Android 10 (LineageOS 17.1, official, build 17.1-20210303-NIGHTLY-beckham)
My phone unaffected by this issue
  • Device: Motorola Moto X
  • OS: Android 6 (LineageOS 14, unofficial, self-built)
Ed’s phone
  • Device: Google Pixel 3
  • OS: Android 11

Additional context

  • Using Element Android: 1.1.7 via Google Play (Applies to all phones listed above)
  • Homeserver: matrix.calvinrw.com (Synapse 1.34)
  • Ed’s homeserver: Synapse 1.34
  • Two rageshakes were submitted on 2021-05-23
  • This issue did not occur prior to 2021-05-05, and started occurring consistently after 2021-05-10.
  • E2E appears to be set up correctly on all devices, because Element shows the green shield for this room. We have verified each other, and all of our sessions are verified.
  • Before and during the tests described above, both of my phones were kept awake using LineageOS’s caffeine feature, so Android’s power management was not a factor.

Screenshot_Android6_20210523-134331_resize Screenshot_Android10_20210523-134337_Element_resize

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:12
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
kescherCodecommented, Jun 2, 2021

I seem to have this issue, where I am always one message behind in comparison to desktop in the only room this happens in. As soon as the other party sends another encrypted messages, the “Unable to decrypt: OLM” becomes visible, but that next message becomes “Unable to decrypt: OLM” once more.

1reaction
ewsandorcommented, Jun 18, 2021

Ed here from the original issue report.

We are now seeing the same issue in reverse. I am unable to see calvinrw’s messages on Android with the same error message, but the same message comes through okay on the Element web client.

We are both now on Android Element version 1.1.9.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to decrypt emails using mobile devices or smartphones
Another reason is the restricted device permissions necessary for the existing decryption methods. To read the content of such emails, follow the instructions ......
Read more >
End-to-End Encryption implementation guide - Matrix.org
If the client was unable to decrypt the message using any known sessions (or if there are no known sessions yet), and the...
Read more >
Unable to Decrypt a Message on Matrix - Blog@neko.dev
Sender signed out​​ Only the originally signed in session keeps count of who that particular Olm key should go to. So if they...
Read more >
A Matrix Update Patches Serious End-to-End Encryption Flaws
3D Circular Maze with orange balls rolling along the maze paths ... This can prevent the device from being able to decrypt messages...
Read more >
XEP-0384: OMEMO Encryption - XMPP
The encrypted payload is sent together with the headers as a <message> stanza. Individual recipient devices can decrypt the header item ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found