Vulnerabilities in pkg:npm/matrix-react-sdk

PACKAGE
Advisory Identifier: GHSA-qcvh-p9jq-wp8v
Advisory Summary

CVE-2024-47824 is a HIGH (CVSS 0.0) malicious homeservers can steal message vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Matrix react sdk libraries in the npm ecosystem. The issue involves malicious homeservers can steal message keys when the matrix-react-sdk user invites another user to a room. Remediation is available by upgrading affected packages to version 3.102.0.

9 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/matrix-react-sdk

9 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/matrix-react-sdk. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-qcvh-p9jq-wp8v CVE-2024-47824 HIGH Malicious homeservers can steal message keys when the matrix-react-sdk user invites another user to a room
GHSA-f83w-wqhc-cfp4 CVE-2024-42347 MODERATE Matrix SDK for React's URL preview setting for a room is controllable by the homeserver
GHSA-xv83-x443-7rmw CVE-2023-30609 HIGH HTML injection in search results via plaintext message highlighting
GHSA-c9vx-2g7w-rp65 CVE-2023-37259 MODERATE matrix-react-sdk vulnerable to XSS in Export Chat feature
GHSA-6g43-88cp-w5gv CVE-2023-28103 HIGH Prototype pollution in matrix-react-sdk
GHSA-2x9c-qwgf-94xr CVE-2022-36060 HIGH matrix-react-sdk Prototype pollution vulnerability
GHSA-8796-gc9j-63rv - MODERATE File upload local preview can run embedded scripts after user interaction
GHSA-cg57-p69r-3m7p CVE-2021-32622 MODERATE Improper file handling in matrix-react-sdk
GHSA-52mq-6jcv-j79x CVE-2021-21320 LOW User content sandbox can be confused into opening arbitrary documents

CVE-2024-47824 at a Glance

CVE Identifier CVE-2024-47824
GHSA Identifier GHSA-qcvh-p9jq-wp8v
Severity HIGH
CVSS v3.1 Base Score 0.0
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Matrix react sdk
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 0.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-47824

To remediate this vulnerability, upgrade all affected Matrix react sdk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

matrix-react-sdk fixed: 3.102.0
npm install matrix-react-sdk@3.102.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls matrix-react-sdk

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-47824, inspect your project dependencies using npm:

npm ls matrix-react-sdk

Analyze the terminal output to locate any version of Matrix react sdk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.102.0), your application is affected.

Note: The npm ls matrix-react-sdk command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Matrix react sdk, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact matrix-react-sdk before 3.102.0 allows a malicious homeserver to potentially steal message keys for a room when a user invites another user to that room, via injection of a malicious device controlled by the homeserver. This is possible because matrix-react-sdk before 3.102.0 shared historical message keys on invite. ### Patches matrix-react-sdk 3.102.0 [disables sharing message keys on invite](https://github.com/matrix-org/matrix-react-sdk/pull/12618) by removing calls to the vulnerable functionality. ### Workarounds None. ### References The vulnerability in matrix-react-sdk is caused by calling `MatrixClient.sendSharedHistoryKeys` in matrix-js-sdk, which is inherently vulnerable to this sort of attack. This matrix-js-sdk vulnerability is tracked as CVE-2024-47080 / [GHSA-4jf8-g8wp-cx7c](https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-4jf8-g8wp-cx7c). Given that this functionality is not specific to sharing message keys on *invite*, is optional, has to be explicitly called by the caller and has been independently patched in matrix-react-sdk by removing the offending calls, we believe it is proper to treat the matrix-react-sdk vulnerability as a separate one, with its own advisory and CVE. The matrix-org/matrix-react-sdk repository has recently been archived and the project was moved to [element-hq/matrix-react-sdk](https://github.com/element-hq/matrix-react-sdk). Given that this happened *after* the first patched release, no releases of the project on [element-hq/matrix-react-sdk](https://github.com/element-hq/matrix-react-sdk) were ever vulnerable to this vulnerability. Patching pull request: https://github.com/matrix-org/matrix-react-sdk/pull/12618. ### For more information If you have any questions or comments about this advisory, please email us at security at [security at matrix.org](mailto:security@matrix.org).

CVE-2024-47824 Affected Matrix react sdk Versions

1 component(s)
Fixed Versions:
3.102.0
Product / Package Ecosystem Affected Versions Fixed Version
matrix-react-sdk
npm
≥ 3.18.0
< 3.102.0
3.102.0

References

Frequently Asked Questions

What is CVE-2024-47824?
CVE-2024-47824 is a security vulnerability in Matrix react sdk involving Malicious homeservers can steal message keys when the matrix-react-sdk user invites another user to a room under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Matrix react sdk versions are affected?
Affected versions include releases prior to 3.102.0 across affected packages: matrix-react-sdk.
What version fixes CVE-2024-47824?
Upgrading to 3.102.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is matrix-react-sdk affected?
Yes, matrix-react-sdk is affected in releases prior to 3.102.0. Upgrade your dependency to 3.102.0 or later.
What is the CVSS score of CVE-2024-47824?
CVE-2024-47824 has a CVSS v3.1 base score of 0.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N.
What CWE is associated with CVE-2024-47824?
CVE-2024-47824 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for CVE-2024-47824?
Run the dependency tree command: 'npm ls matrix-react-sdk'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qcvh-p9jq-wp8v",
  "modified" : "2024-10-15T19:56:05Z",
  "published" : "2024-10-15T18:11:51Z",
  "aliases" : [ "CVE-2024-47824" ],
  "summary" : "Malicious homeservers can steal message keys when the matrix-react-sdk user invites another user to a room",
  "details" : "### Impact\n\nmatrix-react-sdk before 3.102.0 allows a malicious homeserver to potentially steal message keys for a room when a user invites another user to that room, via injection of a malicious device controlled by the homeserver. This is possible because matrix-react-sdk before 3.102.0 shared historical message keys on invite.\n\n### Patches\n\nmatrix-react-sdk 3.102.0 [disables sharing message keys on invite](https://github.com/matrix-org/matrix-react-sdk/pull/12618) by removing calls to the vulnerable functionality.\n\n### Workarounds\n\nNone.\n\n### References\n\nThe vulnerability in matrix-react-sdk is caused by calling `MatrixClient.sendSharedHistoryKeys` in matrix-js-sdk, which is inherently vulnerable to this sort of attack. This matrix-js-sdk vulnerability is tracked as CVE-2024-47080 / [GHSA-4jf8-g8wp-cx7c](https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-4jf8-g8wp-cx7c). Given that this functionality is not specific to sharing message keys on *invite*, is optional, has to be explicitly called by the caller and has been independently patched in matrix-react-sdk by removing the offending calls, we believe it is proper to treat the matrix-react-sdk vulnerability as a separate one, with its own advisory and CVE.\n\nThe matrix-org/matrix-react-sdk repository has recently been archived and the project was moved to [element-hq/matrix-react-sdk](https://github.com/element-hq/matrix-react-sdk). Given that this happened *after* the first patched release, no releases of the project on [element-hq/matrix-react-sdk](https://github.com/element-hq/matrix-react-sdk) were ever vulnerable to this vulnerability.\n\nPatching pull request: https://github.com/matrix-org/matrix-react-sdk/pull/12618.\n\n### For more information\n\nIf you have any questions or comments about this advisory, please email us at security at [security at matrix.org](mailto:security@matrix.org).\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-react-sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.18.0"
      }, {
        "fixed" : "3.102.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-react-sdk/security/advisories/GHSA-qcvh-p9jq-wp8v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-47824"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-react-sdk/pull/12618"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-react-sdk/commit/6fc9d7641c51ca3db8225cf58b9d6e6fdd2d6556"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-react-sdk"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-15T18:11:51Z",
    "nvd_published_at" : "2024-10-15T16:15:05Z"
  }
}