Skip to content

Wrong message index when sending an image via Share Extension, message not decryptable in Element-Web, can break rooms when session-ID is affected! #7499

Open
@jacotec

Description

@jacotec

Steps to reproduce

I've posted the initial issue in Element-Web here: element-hq/element-web#25108

I've seen that sometimes messages can't be decoded in Element-Web. The "Retreieve encryption keys from other device" banner pops up, but does not solve the issue. Neither does clearing the cache. These messages are undecryptable forever in Element-Web and Desktop.

The raw message display in Element-Web shows this error:

"msgtype": "m.bad.encrypted",
    "body": "** Unable to decrypt: DecryptionError: Duplicate message index, possible replay attack: 

I was told in the Element-Web issue that this is a sender issue, so I investigated in this direction. I found that this always happens, when someone sends something (i.e. a picture) to the Element-IOS app via the IOS Share Extension. The very next message after this message can'be be decrypted in Element-Web:

  1. Send an image from the Gallery via the Share Extension to an encrypted room
  2. Write a text message afterwards into the same room
  3. The text message can't be read in Element-Web and Element-Desktop. Error message "Message decryption not possible".
  4. The next text message reads fine

This does not happen when the same picture is sent directly from within Element with the "+"-Button.

Maybe the message index is not updated/incremented after sending something via the Share Extension, causing the "Duplicate Index" error in Element-Web?

Element-IOS and Android are decrypting the message (maybe they don't care about duplicated message indices?)

image

image

Outcome

What did you expect?

Even after sending something via the IOS Share Extension, the next message shall be decryptable in all access ways (Element-Web, Element-Dsktop)

What happened instead?

The very next message after a message sent via Share Extension can never be decrypted in Element-Web and Element-Desktop, always showing "DecryptionError: Duplicate message index, possible replay attack"

Your phone model

iPhone 14 Pro Max, iPad Pro 10.5

Operating system version

IOS 16.4.1

Application version

Element 1.10.10

Homeserver

Synapse 1.81

Will you send logs?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ShareExtensionO-OccasionalAffects or can be seen by some users regularly or most users rarelyS-MajorSeverely degrades major functionality or product features, with no satisfactory workaroundT-DefectSomething isn't working: bugs, crashes, hangs and other reported problems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions