Cloudanix VulnDB

CVE-2024-47080

None

CVSS

—

EPSS

0.7%

Published

Oct 15, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in certain Matrix chat software can let a malicious server steal old encrypted messages by sending their keys to fake devices without proper checks.

Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
Low
Impact
Data Exposure
Component
Library
Class
Cryptographic Weakness
Remediation
Upgrade
Effort
Low
Patch risk
Low

What it actually does

The sendSharedHistoryKeys method in the legacy crypto stack unconditionally transmits historical message keys to all devices of an invited user without verifying cryptographic identity or device signatures, enabling a malicious homeserver to inject devices and obtain those keys.

Why it matters to the business

Organizations relying on end-to-end encrypted Matrix rooms for sensitive communications risk exposure of past message history to unauthorized parties when a compromised or malicious homeserver is present, potentially violating confidentiality requirements for internal or regulated data.

How an attack unfolds

An attacker who controls or influences a Matrix homeserver waits for a legitimate invite to a room using shared history, then intercepts the unconditional key transmission performed by sendSharedHistoryKeys and registers additional devices under the invited identity to receive the historical decryption keys.

How to fix it

Upgrade matrix-js-sdk to version 34.8.0 or later (commit c9b43ab25120c0174e456639f2e3bccaedaded2d) which removes the vulnerable functionality; alternatively migrate clients to the Rust cryptography stack by calling initRustCrypto() instead of initCrypto().

How to confirm the fix worked

Inspect client initialization code for calls to initRustCrypto(), verify the installed matrix-js-sdk version is 34.8.0 or newer, and confirm that sendSharedHistoryKeys is no longer reachable in the application.

Typical attack path

  1. Gain control of or compromise a Matrix homeserver
  2. Trigger or observe an invite that uses shared history keys
  3. Intercept the sendSharedHistoryKeys transmission
  4. Inject attacker-controlled devices to receive the historical keys

How to detect it

Review application logs and network traffic for invocations of sendSharedHistoryKeys, unexpected device registrations during room invites, and any use of the legacy crypto initialization path.

  • sendSharedHistoryKeys
  • initCrypto()

What your security team should do

  • Prioritize upgrade to matrix-js-sdk 34.8.0 or migration to the Rust crypto stack for all affected clients
  • Audit codebases for any direct or indirect usage of sendSharedHistoryKeys and remove or replace it
  • Monitor upstream Matrix ecosystem announcements for related client updates

The record

matrix-js-sdk is the Matrix Client-Server SDK for JavaScript and TypeScript. In matrix-js-sdk versions versions 9.11.0 through 34.7.0, the method `MatrixClient.sendSharedHistoryKeys` is vulnerable to interception by malicious homeservers. The method was introduced by MSC3061) and is commonly used to share historical message keys with newly invited users, granting them access to past messages in the room. However, it unconditionally sends these "shared" keys to all of the invited user's devices, regardless of whether the user's cryptographic identity is verified or whether the user's devices are signed by that identity. This allows the attacker to potentially inject its own devices to receive sensitive historical keys without proper security checks. Note that this only affects clients running the SDK with the legacy crypto stack. Clients using the new Rust cryptography stack (i.e. those that call `MatrixClient.initRustCrypto()` instead of `MatrixClient.initCrypto()`) are unaffected by this vulnerability, because `MatrixClient.sendSharedHistoryKeys()` raises an exception in such environments. The vulnerability was fixed in matrix-js-sdk 34.8.0 by removing the vulnerable functionality. As a workaround, remove use of affected functionality from clients.

Affected packages

Ecosystem Package Introduced Fixed
npm matrix-js-sdk 9.11.0 34.8.0
Debian:11 node-matrix-js-sdk 0 No fix
Ubuntu:20.04:LTS node-matrix-js-sdk 0 No fix
Ubuntu:22.04:LTS node-matrix-js-sdk 0 No fix
Ubuntu:24.04:LTS node-matrix-js-sdk 0 No fix
Ubuntu:24.10 node-matrix-js-sdk 0 No fix
Ubuntu:Pro:20.04:LTS node-matrix-js-sdk 0 No fix

Related vulnerabilities