CVE-2023-28427: Matrix js sdk Prototype Pollution Vulnerability

HIGH
Advisory Identifier: GHSA-mwq8-fjpf-c2gr
CVSS 8.2
CWE-1321
Published
Advisory Summary

CVE-2023-28427 is a HIGH (CVSS 8.2) prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Matrix js sdk libraries in the npm ecosystem. The issue involves prototype pollution in matrix-js-sdk (part 2). Remediation is available by upgrading affected packages to version 24.0.0.

CVE-2023-28427 at a Glance

CVE Identifier CVE-2023-28427
GHSA Identifier GHSA-mwq8-fjpf-c2gr
Severity HIGH
CVSS v3.1 Base Score 8.2
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Matrix js sdk
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.2

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:L/A:H).

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 Low (I:L)
Availability High (A:H)

How to Fix CVE-2023-28427

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: 24.0.0
npm install matrix-js-sdk@24.0.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-2023-28427, 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 24.0.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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. 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 In certain configurations, data sent by remote servers containing special strings in key locations could cause modifications of the `Object.prototype`, disrupting matrix-js-sdk functionality, causing denial of service and potentially affecting program logic. (This is part 2, where [CVE-2022-36059](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36059) / [GHSA-rfv9-x7hh-xc32](https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-rfv9-x7hh-xc32) is part 1. Part 2 covers remaining vectors not covered by part 1, found in a codebase audit scheduled after part 1.) ### Patches The issue has been patched in matrix-js-sdk 24.0.0. ### Workarounds None. ### References - [Release blog post](https://matrix.org/blog/2023/03/28/security-releases-matrix-js-sdk-24-0-0-and-matrix-react-sdk-3-69-0) - The advisory [GHSA-rfv9-x7hh-xc32](https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-rfv9-x7hh-xc32) ([CVE-2022-36059](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36059)) refers to an initial set of vulnerable locations discovered and patched in matrix-js-sdk 19.4.0. We opted not to disclose that advisory while we performed an audit of the codebase and are now disclosing it jointly with this one. ### For more information If you have any questions or comments about this advisory please email us at [security at matrix.org](mailto:security@matrix.org).

CVE-2023-28427 Affected Matrix js sdk Versions

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

References

Frequently Asked Questions

What is CVE-2023-28427?
CVE-2023-28427 is a security vulnerability in Matrix js sdk involving Prototype pollution in matrix-js-sdk (part 2) under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Matrix js sdk versions are affected?
Affected versions include releases prior to 24.0.0 across affected packages: matrix-js-sdk.
What version fixes CVE-2023-28427?
Upgrading to 24.0.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 24.0.0. Upgrade your dependency to 24.0.0 or later.
What is the CVSS score of CVE-2023-28427?
CVE-2023-28427 has a CVSS v3.1 base score of 8.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H.
What CWE is associated with CVE-2023-28427?
CVE-2023-28427 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2023-28427?
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-mwq8-fjpf-c2gr",
  "modified" : "2023-03-30T20:19:18Z",
  "published" : "2023-03-30T20:19:18Z",
  "aliases" : [ "CVE-2023-28427" ],
  "summary" : "Prototype pollution in matrix-js-sdk (part 2)",
  "details" : "### Impact\n\nIn certain configurations, data sent by remote servers containing special strings in key locations could cause modifications of the `Object.prototype`, disrupting matrix-js-sdk functionality, causing denial of service and potentially affecting program logic.\n\n(This is part 2, where [CVE-2022-36059](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36059) / [GHSA-rfv9-x7hh-xc32](https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-rfv9-x7hh-xc32) is part 1. Part 2 covers remaining vectors not covered by part 1, found in a codebase audit scheduled after part 1.)\n\n### Patches\nThe issue has been patched in matrix-js-sdk 24.0.0.\n\n### Workarounds\nNone.\n\n### References\n\n- [Release blog post](https://matrix.org/blog/2023/03/28/security-releases-matrix-js-sdk-24-0-0-and-matrix-react-sdk-3-69-0)\n- The advisory [GHSA-rfv9-x7hh-xc32](https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-rfv9-x7hh-xc32) ([CVE-2022-36059](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-36059)) refers to an initial set of vulnerable locations discovered and patched in matrix-js-sdk 19.4.0. We opted not to disclose that advisory while we performed an audit of the codebase and are now disclosing it jointly with this one.\n\n### For more information\nIf you have any questions or comments about this advisory please email us 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:L/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-js-sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "24.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-mwq8-fjpf-c2gr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-js-sdk/security/advisories/GHSA-rfv9-x7hh-xc32"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-28427"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-js-sdk"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/04/msg00027.html"
  }, {
    "type" : "WEB",
    "url" : "https://matrix.org/blog/2023/03/28/security-releases-matrix-js-sdk-24-0-0-and-matrix-react-sdk-3-69-0"
  }, {
    "type" : "WEB",
    "url" : "https://security.gentoo.org/glsa/202305-36"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2023/dsa-5392"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-03-30T20:19:18Z",
    "nvd_published_at" : "2023-03-28T21:15:00Z"
  }
}