CVE-2021-32622: Matrix react sdk Improper File Handling Vulnerability
MODERATECVE-2021-32622 is a MODERATE (CVSS 4.2) improper file handling vulnerability (CWE-434: Unrestricted Upload of File with Dangerous Type) affecting Matrix react sdk libraries in the npm ecosystem. The issue involves improper file handling in matrix-react-sdk. Remediation is available by upgrading affected packages to version 3.21.0.
CVE-2021-32622 at a Glance
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).
How to Fix CVE-2021-32622
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.
npm install matrix-react-sdk@3.21.0
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-2021-32622, 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-434: Unrestricted Upload of File with Dangerous Type, where the product allows the upload or transfer of dangerous file types that are automatically processed within its environment. 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
CVE-2021-32622 Affected Matrix react sdk Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
matrix-react-sdk
|
npm |
< 3.21.0
|
3.21.0
|
References
Frequently Asked Questions
What is CVE-2021-32622?
Which Matrix react sdk versions are affected?
What version fixes CVE-2021-32622?
Is matrix-react-sdk affected?
What is the CVSS score of CVE-2021-32622?
What CWE is associated with CVE-2021-32622?
How can I check npm dependencies for CVE-2021-32622?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cg57-p69r-3m7p",
"modified" : "2021-05-19T17:48:44Z",
"published" : "2022-02-10T23:46:51Z",
"aliases" : [ "CVE-2021-32622" ],
"summary" : "Improper file handling in matrix-react-sdk",
"details" : "Matrix-React-SDK is a react-based SDK for inserting a Matrix chat/voip client into a web page. Before version 3.21.0, when uploading a file, the local file preview can lead to execution of scripts embedded in the uploaded file. This can only occur 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. This vulnerability is patched in version 3.21.0.",
"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" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32622"
}, {
"type" : "WEB",
"url" : "https://github.com/matrix-org/matrix-react-sdk/pull/5981"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/matrix-react-sdk"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-434", "CWE-74" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-19T17:48:44Z",
"nvd_published_at" : "2021-05-17T20:15:00Z"
}
}