CVE-2021-32622 File upload local preview can run embedded scripts after user interaction

Medium 4.2 Published Updated

Local file previews in Matrix React SDK can execute embedded scripts after user interaction, allowing local code execution during upload.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2021-32622?

CVE-2021-32622 is a medium-severity cross-site scripting vulnerability in matrix-org matrix-react-sdk, published on 17 May 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

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.

Weakness: CWE-434, CWE-74

Which versions are affected by CVE-2021-32622?

4 open source packages ship an affected version, including matrix-react-sdk. It affects 1 product.

PackageAffectedFixed in
matrix-react-sdk npmAll versions3.21.0
matrix-react-sdk npmAll versions3.21.0
matrix-react-sdk npmAll versions3.21.0
matrix-react-sdk npmAll versions3.21.0

Products include Matrix-React-Sdk Project Matrix-React-Sdk.

How do I fix CVE-2021-32622?

Upgrade matrix-react-sdk to 3.21.0 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2021-32622 being exploited?

There is no known exploitation of CVE-2021-32622 in the wild and no public exploit code.

Sources

Also known as GHSA-8796-gc9j-63rv, GHSA-cg57-p69r-3m7p.

Is CVE-2021-32622 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free