{"id":"CVE-2022-39251","published":"2022-09-28T00:00:00Z","modified":"2025-04-23T16:55:05Z","title":"Matrix Javascript SDK vulnerable to Olm/Megolm protocol confusion","vendor":"matrix-org","product":"matrix-js-sdk","tier":"tail","description":{"text":"Matrix Javascript SDK is the Matrix Client-Server SDK for JavaScript. Prior to version 19.7.0, an attacker cooperating with a malicious homeserver can construct messages that legitimately appear to have come from another person, without any indication such as a grey shield. Additionally, a sophisticated attacker cooperating with a malicious homeserver could employ this vulnerability to perform a targeted attack in order to send fake to-device messages appearing to originate from another user. This can allow, for example, to inject the key backup secret during a self-verification, to make a targeted device start using a malicious key backup spoofed by the homeserver. These attacks are possible due to a protocol confusion vulnerability that accepts to-device messages encrypted with Megolm instead of Olm. Starting with version 19.7.0, matrix-js-sdk has been modified to only accept Olm-encrypted to-device messages. Out of caution, several other checks have been audited or added. This attack requires coordination between a malicious home server and an attacker, so those who trust their home servers do not need a workaround.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.6,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.01202,"percentile":0.69007,"provenance":"source"},"cwes":[{"id":"CWE-322","name":"Key Exchange without Entity Authentication"},{"id":"CWE-287","name":"Improper Authentication"}],"references":[{"url":"https://github.com/matrix-org/matrix-js-sdk/commit/a587d7c36026fe1fcf93dfff63588abee359be76","tags":[]},{"url":"https://github.com/matrix-org/matrix-js-sdk/releases/tag/v19.7.0","tags":[]},{"url":"https://matrix.org/blog/2022/09/28/upgrade-now-to-address-encryption-vulns-in-matrix-sdks-and-clients","tags":[]},{"url":"https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-r48r-j8fx-mq2c","tags":[]},{"url":"https://security.gentoo.org/glsa/202210-35","tags":["vendor-advisory"]}],"priority":{"score":19.8,"factors":[{"name":"EPSS percentile","points":13.8},{"name":"CVSS severity","points":6.02}]},"vendorSlug":"matrix-org","affectedVersions":[{"vendor":"matrix-org","product":"matrix-js-sdk","versions":["< 19.7.0"]}],"ssvc":{"exploitation":"none","automatable":"yes","technicalImpact":"partial","timestamp":"2025-04-23T15:51:00.530252Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"matrix-js-sdk","vulnerableRanges":["<19.7.0"],"patched":["19.7.0"],"from":["GHSA-r48r-j8fx-mq2c"],"provenance":"source"}],"summary":{"text":"The Matrix JavaScript SDK (matrix-js-sdk) accepts to-device messages encrypted with Megolm where it should only accept Olm-encrypted ones, a protocol confusion flaw in its end-to-end encryption handling affecting versions before 19.7.0. An attacker who cooperates with a malicious homeserver can craft messages that appear to come from another user without any warning indicator, enabling targeted spoofing such as injecting a malicious key backup secret during self-verification, and no workaround is needed for users who trust their homeserver.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T07:15:30Z"},"euvd":{"id":"EUVD-2022-6927","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-matrix-org-matrix-js-sdk-cve-2021-40823","parents":[{"from":"CVE-2021-40823","to":"CVE-2022-39251","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/crypto/algorithms/megolm.ts"],"commits":["https://github.com/matrix-org/matrix-js-sdk/commit/894c24880da0e1cc81818f51c0db80e3c9fb2be9","https://github.com/matrix-org/matrix-js-sdk/commit/a587d7c36026fe1fcf93dfff63588abee359be76"],"basis":"shared function","functions":["MegolmEncryption"]}]}]}}