CVE-2025-59160: Matrix js sdk Matrix-js-sdk Has Insufficient Validation When Vulnerability
MODERATECVE-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
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.
npm install matrix-js-sdk@38.2.0
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
CVE-2025-59160 Affected Matrix js sdk Versions
1 component(s)| 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?
Which Matrix js sdk versions are affected?
What version fixes CVE-2025-59160?
Is matrix-js-sdk affected?
What CWE is associated with CVE-2025-59160?
How can I check npm dependencies for CVE-2025-59160?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}