CVE-2025-59160: Matrix js sdk Matrix-js-sdk Has Insufficient Validation When Vulnerability

MODERATE
Advisory Identifier: GHSA-mp7c-m3rh-r56v
CWE-20 CWE-345 CWE-862
Published
Advisory Summary

CVE-2025-59160 is a MODERATE matrix-js-sdk has insufficient validation when vulnerability (CWE-20: Improper Input Validation) affecting Matrix js sdk libraries in the npm ecosystem. The issue involves matrix-js-sdk has insufficient validation when considering a room to be upgraded by another. Remediation is available by upgrading affected packages to version 38.2.0.

CVE-2025-59160 at a Glance

CVE Identifier CVE-2025-59160
GHSA Identifier GHSA-mp7c-m3rh-r56v
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product Matrix js sdk
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-59160

To remediate this vulnerability, upgrade all affected Matrix js 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-js-sdk fixed: 38.2.0
npm install matrix-js-sdk@38.2.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-js-sdk

How to Check if You Are Affected

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

npm ls matrix-js-sdk

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

Note: The npm ls matrix-js-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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Matrix js 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-js-sdk before 38.2.0 has insufficient validation of room predecessor links in `MatrixClient::getJoinedRooms`, allowing a remote attacker to attempt to replace a tombstoned room with an unrelated attacker-supplied room. ### Patches The issue has been patched and users should upgrade to 38.2.0. ### Workarounds Avoid using `MatrixClient::getJoinedRooms` in favour of `getRooms()` and filtering upgraded rooms separately.

CVE-2025-59160 Affected Matrix js sdk Versions

1 component(s)
Fixed Versions:
38.2.0
Product / Package Ecosystem Affected Versions Fixed Version
matrix-js-sdk
npm
< 38.2.0
38.2.0

References

Frequently Asked Questions

What is CVE-2025-59160?
CVE-2025-59160 is a security vulnerability in Matrix js sdk involving matrix-js-sdk has insufficient validation when considering a room to be upgraded by another under CWE-20: Improper Input Validation.
Which Matrix js sdk versions are affected?
Affected versions include releases prior to 38.2.0 across affected packages: matrix-js-sdk.
What version fixes CVE-2025-59160?
Upgrading to 38.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is matrix-js-sdk affected?
Yes, matrix-js-sdk is affected in releases prior to 38.2.0. Upgrade your dependency to 38.2.0 or later.
What CWE is associated with CVE-2025-59160?
CVE-2025-59160 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2025-59160?
Run the dependency tree command: 'npm ls matrix-js-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-mp7c-m3rh-r56v",
  "modified" : "2025-09-22T22:59:23Z",
  "published" : "2025-09-16T20:18:57Z",
  "aliases" : [ "CVE-2025-59160" ],
  "summary" : "matrix-js-sdk has insufficient validation when considering a room to be upgraded by another",
  "details" : "### Impact\nmatrix-js-sdk before 38.2.0 has insufficient validation of room predecessor links in `MatrixClient::getJoinedRooms`, allowing a remote attacker to attempt to replace a tombstoned room with an unrelated attacker-supplied room.\n\n### Patches\nThe issue has been patched and users should upgrade to 38.2.0.\n\n### Workarounds\nAvoid using `MatrixClient::getJoinedRooms` in favour of `getRooms()` and filtering upgraded rooms separately.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-js-sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "38.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-mp7c-m3rh-r56v"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-59160"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-js-sdk/commit/43c72d5bf5e2d0a26b3b4f71092e7cb39d4137c4"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-js-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-js-sdk/releases/tag/v38.2.0"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/package/matrix-js-sdk/v/38.2.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-345", "CWE-862" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-16T20:18:57Z",
    "nvd_published_at" : "2025-09-16T17:15:41Z"
  }
}