CVE-2021-21332: Cross-site scripting (XSS) vulnerability in matrix-synapse

matrix-synapse Updated 02 Oct 2025

Summary

26/03/2021
Yes i
Moderate
6.9

CVE-2021-21332: Cross-site scripting (XSS) vulnerability in the password reset endpoint. Affects matrix-synapse versions < 1.27.0. Fixed in 1.27.0. How to fix ↓

Also tracked for

The same CVE-2021-21332 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Matrix Synapse is an open-source messaging protocol and server implementation that enables secure communication and collaboration. It is widely used for decentralized communication platforms. The vulnerability identified as CVE-2021-21332 is a cross-site scripting (XSS) vulnerability in the password reset endpoint of Matrix Synapse.

Vulnerability Detail

The password reset endpoint served via Synapse was vulnerable to cross-site scripting (XSS) attacks. This type of vulnerability allows an attacker to inject malicious scripts into web pages viewed by users. In the case of this vulnerability, an attacker could exploit it to access cookies and other browser data, perform CSRF attacks, and gain unauthorized access to resources served on the same domain or parent domains. The impact of the vulnerability depends on the configuration of the domain where Synapse is deployed.

How To Fix

Latest published version: 1.163.0 as of 22 Oct 2026

pip install --upgrade "matrix-synapse==1.163.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.27.0

This is the first release that contains the fix.

pip install --upgrade "matrix-synapse==1.27.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

Depending on the needs and configuration of the homeserver, there are a few options available:

  1. Disable password resets by delegating email to a third-party service or by not configuring the email setting.
  2. If the homeserver does not use passwords, the affected endpoint can be blocked at a reverse proxy.
  3. Override the 'password_reset_confirmation.html' template with a custom template that manually escapes the variables using Jinja2's 'escape' filter.

Conclusion

The cross-site scripting (XSS) vulnerability in Matrix Synapse's password reset endpoint can have serious security implications. It is crucial to update to version 1.27.0 or later to fix this vulnerability. Additionally, implementing the recommended workarounds can provide further protection. For more information and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for matrix-synapse →

Share this vulnerability

FAQ

The impact depends on the configuration of the domain where Synapse is deployed. It may allow access to cookies and other browser data, CSRF vulnerabilities, and access to other resources served on the same domain or parent domains.

Update Matrix Synapse to version 1.27.0 or later.

Yes, depending on the configuration, you can disable password resets, block the affected endpoint at a reverse proxy, or override the template with a custom one.

Yes, by delegating email to a third-party service, you can disable password resets and mitigate this vulnerability.

Yes, you can override the 'password_reset_confirmation.html' template with a custom template that manually escapes the variables using Jinja2's 'escape' filter.

Related vulnerabilities

Recent vulnerabilities recorded for matrix-synapse.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 1.163.0 as of 22 Oct 2026

pip install --upgrade "matrix-synapse==1.163.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.27.0

This is the first release that contains the fix.

pip install --upgrade "matrix-synapse==1.27.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback