Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1yNDhyLWo4ZngtbXEyY84AAvIf
matrix-js-sdk subject to user spoofing via Olm/Megolm protocol confusion
Impact
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.
Patches
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:
- Cleartext
m.room_key
,m.forwarded_room_key
andm.secret.send
to_device messages are discarded. - Secrets received from untrusted devices are discarded.
- Key backups are only usable if they have a valid signature from a trusted device (no more local trust, or trust-on-decrypt).
- The origin of a to-device message should only be determined by observing the Olm session which managed to decrypt the message, and not by using claimed sender_key, user_id, or any other fields controllable by the homeserver.
Workarounds
As this attack requires coordination between a malicious home server and an attacker, if you trust your home server no particular workaround is needed. Notice that the backup spoofing attack is a particularly sophisticated targeted attack.
We are not aware of this attack being used in the wild, though specifying a false positive-free way of noticing malicious key backups key is challenging.
As an abundance of caution, to avoid malicious backup attacks, you should not verify your new logins using emoji/QR verifications methods until patched. Prefer verifying with your security passphrase instead.
References
For more information
If you have any questions or comments about this advisory, e-mail us at [email protected].
Permalink: https://github.com/advisories/GHSA-r48r-j8fx-mq2cJSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yNDhyLWo4ZngtbXEyY84AAvIf
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: about 2 years ago
Updated: almost 2 years ago
CVSS Score: 8.6
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N
EPSS Percentage: 0.00114
EPSS Percentile: 0.45599
Identifiers: GHSA-r48r-j8fx-mq2c, CVE-2022-39251
References:
- https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-r48r-j8fx-mq2c
- https://nvd.nist.gov/vuln/detail/CVE-2022-39251
- https://github.com/matrix-org/matrix-js-sdk/commit/a587d7c36026fe1fcf93dfff63588abee359be76
- https://github.com/matrix-org/matrix-js-sdk/releases/tag/v19.7.0
- https://matrix.org/blog/2022/09/28/upgrade-now-to-address-encryption-vulns-in-matrix-sdks-and-clients
- https://security.gentoo.org/glsa/202210-35
- https://github.com/advisories/GHSA-r48r-j8fx-mq2c
Blast Radius: 25.9
Affected Packages
npm:matrix-js-sdk
Dependent packages: 94Dependent repositories: 1,037
Downloads: 87,813 last month
Affected Version Ranges: < 19.7.0
Fixed in: 19.7.0
All affected versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.1.0, 0.1.1, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7.5, 0.7.6, 0.7.7, 0.7.8, 0.7.9, 0.7.10, 0.7.11, 0.7.12, 0.7.13, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.5, 0.10.6, 0.10.7, 0.10.8, 0.10.9, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.2.0, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.2.0, 2.3.0, 2.3.1, 2.3.2, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 3.0.0, 4.0.0, 5.0.0, 5.0.1, 5.1.0, 5.1.1, 5.2.0, 6.0.0, 6.1.0, 6.2.0, 6.2.1, 6.2.2, 7.0.0, 7.1.0, 8.0.0, 8.0.1, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 8.4.1, 8.5.0, 9.0.0, 9.0.1, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.4.1, 9.5.0, 9.5.1, 9.6.0, 9.7.0, 9.8.0, 9.9.0, 9.10.0, 9.11.0, 10.0.0, 10.1.0, 11.0.0, 11.1.0, 11.2.0, 12.0.0, 12.0.1, 12.1.0, 12.2.0, 12.3.0, 12.3.1, 12.4.0, 12.4.1, 12.5.0, 13.0.0, 14.0.0, 14.0.1, 15.0.0, 15.1.0, 15.1.1, 15.2.0, 15.2.1, 15.3.0, 15.4.0, 15.5.0, 15.5.1, 15.5.2, 15.6.0, 16.0.0, 16.0.1, 17.0.0, 17.1.0, 17.2.0, 18.0.0, 18.1.0, 19.0.0, 19.1.0, 19.2.0, 19.3.0, 19.4.0, 19.5.0, 19.6.0
All unaffected versions: 19.7.0, 20.0.0, 20.0.1, 20.0.2, 20.1.0, 21.0.0, 21.0.1, 21.1.0, 21.2.0, 22.0.0, 23.0.0, 23.1.0, 23.1.1, 23.2.0, 23.3.0, 23.4.0, 23.5.0, 24.0.0, 24.1.0, 25.0.0, 25.1.0, 25.1.1, 26.0.0, 26.0.1, 26.1.0, 26.2.0, 27.0.0, 27.1.0, 27.2.0, 28.0.0, 28.1.0, 28.2.0, 29.0.0, 29.1.0, 30.0.0, 30.0.1, 30.1.0, 30.2.0, 30.3.0, 31.0.0, 31.1.0, 31.2.0, 31.3.0, 31.4.0, 31.5.0, 31.6.0, 31.6.1, 32.0.0, 32.1.0, 32.2.0, 32.3.0, 32.4.0, 33.0.0, 33.1.0, 34.0.0, 34.1.0, 34.2.0, 34.3.0, 34.3.1, 34.4.0, 34.5.0, 34.6.0, 34.7.0, 34.8.0, 34.9.0, 34.10.0, 34.11.1, 34.12.0, 34.13.0, 35.0.0, 35.1.0