{"id":"CVE-2021-40823","aliases":["CVE-2021-40823","GHSA-23cm-x6j7-6hq3"],"related":[],"kind":"vulnerability","state":"published","title":"matrix-js-sdk can be tricked into disclosing E2EE room keys to a participating homeserver","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nA 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.\n\n† Or anyone with access to the account of the original recipient of an encrypted message.\n\nKnown clients affected (via their use of vulnerable versions of matrix-js-sdk):\n\n- Element Web (1.8.2 and earlier)\n- Element Desktop (1.8.2 and earlier)\n- SchildiChat Web (1.7.32-sc1 and earlier)\n- SchildiChat Desktop (1.7.32-sc1 and earlier)\n- Cinny (1.2.0 and earlier)\n\n### Patch\n\nThis was fixed in https://github.com/matrix-org/matrix-js-sdk/commit/894c24880da0e1cc81818f51c0db80e3c9fb2be9.\n\n### Workarounds\nTo 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Un error lógico en la funcionalidad de compartición de claves de sala de matrix-js-sdk (también conocido como Matrix Javascript SDK) antes de la versión 12.4.1 permite que un servidor doméstico de Matrix malicioso presente en una sala cifrada robe las claves de cifrado de la sala (a través de mensajes de protocolo de Matrix manipulados) que fueron enviados originalmente por los clientes de Matrix afectados que participan en esa sala. Esto permite al servidor doméstico descifrar los mensajes cifrados de extremo a extremo enviados por los clientes afectados.e dispositivo","source":"nvd"}],"published":"2021-09-13T18:45:50.000Z","modified":"2026-06-17T04:07:28.937Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:P/I:N/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-200","CWE-290","CWE-327"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"12.4.1"}],"ecosystem":"npm","package":"matrix-js-sdk","purl":"pkg:npm/matrix-js-sdk","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"12.4.1"}],"vendor":"matrix","product":"javascript_sdk","cpe":"cpe:2.3:a:matrix:javascript_sdk:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/matrix-org/matrix-js-sdk/releases/tag/v12.4.1","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://matrix.org/blog/2021/09/13/vulnerability-disclosure-key-sharing","tags":["vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-23cm-x6j7-6hq3","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-40823","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/matrix-org/matrix-js-sdk/commit/894c24880da0e1cc81818f51c0db80e3c9fb2be9","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/matrix-org/matrix-js-sdk","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-40823","url":"https://www.cve.org/CVERecord?id=CVE-2021-40823","licence":"CVE Terms of Use","modified":"2024-08-04T02:51:06.929Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-23cm-x6j7-6hq3","url":"https://github.com/advisories/GHSA-23cm-x6j7-6hq3","licence":"CC-BY-4.0","modified":"2023-11-08T04:06:49.200Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-40823","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-40823","licence":"Public domain","modified":"2026-06-17T04:07:28.937Z"}],"updatedAt":"2026-11-25T22:58:03.915Z","epss":{"score":0.00662,"percentile":0.52945,"date":"2026-12-01T12:00:22.000Z"}}