Executive brief
The Matrix JavaScript SDK is a library used by chat applications to communicate with Matrix homeservers and manage encrypted messaging. A vulnerability in the sendSharedHistoryKeys feature allows malicious homeservers to intercept and receive historical message keys intended for invited users, giving attackers access to past messages without proper identity verification. Only applications using the legacy cryptography stack are affected; those using the newer Rust cryptography stack are protected.
Technical details
The vulnerability exists in the MatrixClient.sendSharedHistoryKeys method, which implements MSC3061 functionality to share historical message keys with newly invited users. The method fails to verify the cryptographic identity of invited devices before sending keys, allowing a malicious homeserver to inject its own fake devices into the invited user's device list to receive sensitive key material. The vulnerability is rooted in insufficient authentication (CWE-287) and exposure of sensitive information (CWE-200). Attack requires a compromised homeserver but no user interaction; the network-based attack exposes encryption keys without authentication checks. The vulnerability only affects the legacy crypto stack; clients using MatrixClient.initRustCrypto() instead of MatrixClient.initCrypto() raise an exception and are unaffected. The fix removes the vulnerable sendSharedHistoryKeys functionality entirely in version 34.8.0.
Affected products
- matrix-org matrix-js-sdk 9.11.0 through 34.7.0
Timeline
- 2024-10-15: disclosed
- 2024-10-15: patched: Fixed in version 34.8.0