GHSA-8796-gc9j-63rv: Matrix react sdk File Upload Local Preview Can Vulnerability

MODERATE
CVSS 4.2
CWE-74
Published
Advisory Summary

GHSA-8796-gc9j-63rv is a MODERATE (CVSS 4.2) file upload local preview can vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Matrix react sdk libraries in the npm ecosystem. The issue involves file upload local preview can run embedded scripts after user interaction. Remediation is available by upgrading affected packages to version 3.21.0.

GHSA-8796-gc9j-63rv at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-8796-gc9j-63rv
Severity MODERATE
CVSS v3.1 Base Score 4.2
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Matrix react sdk
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.2

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

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix GHSA-8796-gc9j-63rv

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.21.0
npm install matrix-react-sdk@3.21.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 GHSA-8796-gc9j-63rv, 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.21.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-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. 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 When uploading a file, the local file preview can lead to execution of scripts embedded in the uploaded file, but only after several user interactions to open the preview in a separate tab. This only impacts the local user while in the process of uploading. It cannot be exploited remotely or by other users. ### Patches This has been fixed by https://github.com/matrix-org/matrix-react-sdk/pull/5981, which is included in 3.21.0. ### Workarounds There are no known workarounds.

GHSA-8796-gc9j-63rv Affected Matrix react sdk Versions

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

References

Frequently Asked Questions

What is GHSA-8796-gc9j-63rv?
GHSA-8796-gc9j-63rv is a security vulnerability in Matrix react sdk involving File upload local preview can run embedded scripts after user interaction under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Matrix react sdk versions are affected?
Affected versions include releases prior to 3.21.0 across affected packages: matrix-react-sdk.
What version fixes GHSA-8796-gc9j-63rv?
Upgrading to 3.21.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.21.0. Upgrade your dependency to 3.21.0 or later.
What is the CVSS score of GHSA-8796-gc9j-63rv?
GHSA-8796-gc9j-63rv has a CVSS v3.1 base score of 4.2 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L.
What CWE is associated with GHSA-8796-gc9j-63rv?
GHSA-8796-gc9j-63rv is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check npm dependencies for GHSA-8796-gc9j-63rv?
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-8796-gc9j-63rv",
  "modified" : "2021-10-05T16:31:48Z",
  "published" : "2021-05-17T20:51:16Z",
  "aliases" : [ ],
  "summary" : "File upload local preview can run embedded scripts after user interaction",
  "details" : "### Impact\n\nWhen uploading a file, the local file preview can lead to execution of scripts embedded in the uploaded file, but only after several user interactions to open the preview in a separate tab. This only impacts the local user while in the process of uploading. It cannot be exploited remotely or by other users.\n\n### Patches\n\nThis has been fixed by https://github.com/matrix-org/matrix-react-sdk/pull/5981, which is included in 3.21.0.\n\n### Workarounds\n\nThere are no known workarounds.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "matrix-react-sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.21.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/matrix-org/matrix-react-sdk/security/advisories/GHSA-8796-gc9j-63rv"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/matrix-org/matrix-react-sdk"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-17T16:51:38Z",
    "nvd_published_at" : null
  }
}