CVE-2021-32622 is a high-severity (CVSS 7.8) CWE-74 vulnerability in matrix-react-sdk. A fix is available for matrix-react-sdk — see the affected versions and patch details below.
File upload local preview can run embedded scripts after user interaction
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
matrix-react-sdknpmDescription
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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | matrix-react-sdk | all versions | 3.21.0npm install matrix-react-sdk@3.21.0 |
Affected Products
matrix-react-sdkmatrix-react-sdk_projectDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for matrix-react-sdk, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update matrix-react-sdk to 3.21.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-32622 is resolved across your whole dependency graph.
Workarounds
Treat uploaded files as untrusted until proven otherwise: validate the actual content type rather than the supplied extension, store uploads outside the web root on a volume mounted without execute permission, and rename them to server-generated identifiers so an attacker cannot choose the path a request will later resolve.
Frequently Asked Questions
Is CVE-2021-32622 in your dependencies?
Find it across npm, including transitive dependencies.