Every CVE Search/ Get API key

CVE-2021-40823

matrix-js-sdk can be tricked into disclosing E2EE room keys to a participating homeserver

5.9 MediumFix available

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
High
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
None
Availability
None

Exploit likelihood

0.66%Unchanged since Sep 14, 2021
90%50%10%1%

What each source reports

NVD Score used 5.9

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Record
CVE-2021-40823
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
CVSS 2.0
4.3 MediumAV:N/AC:M/Au:N/C:P/I:N/A:N
Weakness
CWE-290
Updated
2026-11-02
CVE List No score

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Record
CVE-2021-40823
Updated
2026-11-02
EUVDEUVD-2021-1944 No score

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Record
EUVD-2021-1944
Updated
2026-11-03
GitHub AdvisoriesGHSA-23cm-x6j7-6hq3 5.9

matrix-js-sdk can be tricked into disclosing E2EE room keys to a participating homeserver

Impact

A logic error in the room key sharing functionality of matrix-js-sdk before 12.4.1 allows a malicious Matrix homeserver† participating in an encrypted room to steal room encryption keys from affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

† Or anyone with access to the account of the original recipient of an encrypted message.

Known clients affected (via their use of vulnerable versions of matrix-js-sdk):

  • Element Web (1.8.2 and earlier)
  • Element Desktop (1.8.2 and earlier)
  • SchildiChat Web (1.7.32-sc1 and earlier)
  • SchildiChat Desktop (1.7.32-sc1 and earlier)
  • Cinny (1.2.0 and earlier)

Patch

This was fixed in https://github.com/matrix-org/matrix-js-sdk/commit/894c24880da0e1cc81818f51c0db80e3c9fb2be9.

Workarounds

To prevent a homeserver from being able to steal the room keys, vulnerable clients can be taken offline or signed out. If signing out, care should be taken to either set up Secure Backup or export E2E room keys in order to preserve access to past messages.

Record
GHSA-23cm-x6j7-6hq3
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200, CWE-327
Updated
2026-11-02
OSVALPINE-CVE-2021-40823 5.9

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Record
ALPINE-CVE-2021-40823
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-03
OSV 5.9

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Record
CVE-2021-40823
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02
OSVDEBIAN-CVE-2021-40823 5.9

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Record
DEBIAN-CVE-2021-40823
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02
OSVGHSA-23cm-x6j7-6hq3 5.9

matrix-js-sdk can be tricked into disclosing E2EE room keys to a participating homeserver

Impact

A logic error in the room key sharing functionality of matrix-js-sdk before 12.4.1 allows a malicious Matrix homeserver† participating in an encrypted room to steal room encryption keys from affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

† Or anyone with access to the account of the original recipient of an encrypted message.

Known clients affected (via their use of vulnerable versions of matrix-js-sdk):

  • Element Web (1.8.2 and earlier)
  • Element Desktop (1.8.2 and earlier)
  • SchildiChat Web (1.7.32-sc1 and earlier)
  • SchildiChat Desktop (1.7.32-sc1 and earlier)
  • Cinny (1.2.0 and earlier)

Patch

This was fixed in https://github.com/matrix-org/matrix-js-sdk/commit/894c24880da0e1cc81818f51c0db80e3c9fb2be9.

Workarounds

To prevent a homeserver from being able to steal the room keys, vulnerable clients can be taken offline or signed out. If signing out, care should be taken to either set up Secure Backup or export E2E room keys in order to preserve access to past messages.

Record
GHSA-23cm-x6j7-6hq3
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200, CWE-327
Updated
2026-11-02
OSVUBUNTU-CVE-2021-40823 5.9

A logic error in the room key sharing functionality of matrix-js-sdk (aka Matrix Javascript SDK) before 12.4.1 allows a malicious Matrix homeserver present in an encrypted room to steal room encryption keys (via crafted Matrix protocol messages) that were originally sent by affected Matrix clients participating in that room. This allows the homeserver to decrypt end-to-end encrypted messages sent by affected clients.

Record
UBUNTU-CVE-2021-40823
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
matrix-js-sdk
npm
before 12.4.1
12.4.1
element-web
Alpine:v3.18
before 1.8.4-r0
1.8.4-r0
element-web
Alpine:v3.19
before 1.8.4-r0
1.8.4-r0
element-web
Alpine:v3.20
before 1.8.4-r0
1.8.4-r0
element-web
Alpine:v3.21
before 1.8.4-r0
1.8.4-r0
element-web
Alpine:v3.22
before 1.8.4-r0
1.8.4-r0
element-web
Alpine:v3.23
before 1.8.4-r0
1.8.4-r0
element-web
Alpine:v3.24
before 1.8.4-r0
1.8.4-r0
riot-web
Alpine:v3.14
before 1.8.4-r0
1.8.4-r0
riot-web
Alpine:v3.15
before 1.8.4-r0
1.8.4-r0
Show 6 moreShow less
Affected packages
PackageAffectedFixed
riot-web
Alpine:v3.16
before 1.8.4-r0
1.8.4-r0
riot-web
Alpine:v3.17
before 1.8.4-r0
1.8.4-r0
node-matrix-js-sdk
Debian:11
All versions, plus listed versions
9.11.0+~cs9.9.16-19.11.0+~cs9.9.16-29.3.0+~cs9.9.16-29.7.0~~rc1+~cs9.9.16-19.7.0~~rc1+~cs9.9.16-2
None known
node-matrix-js-sdk
Ubuntu:20.04:LTS
All versions, plus listed versions
0.9.2-1
None known
node-matrix-js-sdk
Ubuntu:22.04:LTS
All versions, plus listed versions
9.3.0+~cs9.9.16-29.11.0+~cs9.9.16-1
None known
node-matrix-js-sdk
Ubuntu:24.04:LTS
All versions, plus listed versions
9.11.0+~cs9.9.16-2
None known

History

History
RecordedChangedSources
affected, aliases, referencesOSV
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-40823 is a medium vulnerability (CVSS 5.9) in Matrix Javascript Sdk, published September 13, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.66%, the 51st percentile. Fixed in matrix-js-sdk 12.4.1.

References

Show 5 moreShow less
MoveEnter Open