CVE-2021-32622: Improper file handling in matrix-react-sdk

CVE-2021-32622 · Severity: low · CVSS 3.1 · Published 2022-02-10

Matrix React SDK is a JavaScript library that powers the user interface of Matrix chat applications. When users upload files, the local preview feature can execute malicious scripts embedded in those files, but only after the user explicitly opens the preview in a separate tab. This allows an attacker to run unauthorized code on the uploading user's machine during the file upload process, potentially stealing session tokens or local data.

Technologies: Matrix.org React SDK, matrix-react-sdk (npm). Vendors: Matrix.org, npm.

Quick answers

Is CVE-2021-32622 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2021-32622 being exploited in the wild.
How severe is CVE-2021-32622?
Low severity, with a CVSS score of 3.1, published 10 February 2022.
Which products and versions are affected?
Matrix.org React SDK < 3.21.0; matrix-react-sdk (npm) SEMVER:introduced=0,fixed=3.21.0.
Is there a fix for CVE-2021-32622?
Yes. matrix-react-sdk (npm): upgrade to 3.21.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2021-32622 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2021-32622?
Check whether you run Matrix.org React SDK or matrix-react-sdk (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • matrix-react-sdk (npm): upgrade to 3.21.0 or later
    npm install matrix-react-sdk@3.21.0

Technical details

The vulnerability is a cross-site scripting (XSS) issue in the file upload local preview functionality of matrix-react-sdk (CWE-74). Malicious scripts embedded in uploaded files can be executed in the browser context, but exploitation requires multiple user interactions: the attacker must craft a malicious file, the user must upload it, and then the user must explicitly open the preview in a separate browser tab. The attack is limited to the local uploading user's session and cannot be exploited remotely or affect other users. The vulnerability was fixed in version 3.21.0 by pull request #5981.

Affected products

  • Matrix.org React SDK < 3.21.0

Identifiers

  • CVE-2021-32622
  • GHSA-8796-gc9j-63rv
  • GHSA-cg57-p69r-3m7p

Timeline

  • 2021-05-17: disclosed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.