CVE-2021-21333
JSON

6.1medium

HTML injection in email and account expiry notifications

Severity
6.1medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.35% (higher than 72% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-c5f8-35qr-q4fmPYSEC-2021-134

Description

Synapse is a Matrix reference homeserver written in python (pypi package matrix-synapse). Matrix is an ecosystem for open federated Instant Messaging and VoIP. In Synapse before version 1.27.0, the notification emails sent for notifications for missed messages or for an expiring account are subject to HTML injection. In the case of the notification for missed messages, this could allow an attacker to insert forged content into the email. The account expiry feature is not enabled by default and the HTML injection is not controllable by an attacker. This is fixed in version 1.27.0.

Affected

Product or packageVersionsReported by
matrix-org synapse< 1.27.0CVE List
matrix-synapse (PyPI)before 1.27.0, before e54746bdf7d5c831eabe4dcea76a7626f1de73dfGitHub Advisory Database, PyPA Advisory Database
matrix synapsebefore 1.27.0NVD
fedoraproject fedora34NVD

All scores

GitHub_M6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N
GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:N/SI:H/SA:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N
NVD2.6low CVSS:2.0AV:N/AC:H/Au:N/C:N/I:P/A:N

Classification

What each source says

CVE List

Synapse is a Matrix reference homeserver written in python (pypi package matrix-synapse). Matrix is an ecosystem for open federated Instant Messaging and VoIP. In Synapse before version 1.27.0, the notification emails sent for notifications for missed messages or for an expiring account are subject to HTML injection. In the case of the notification for missed messages, this could allow an attacker to insert forged content into the email. The account expiry feature is not enabled by default and the HTML injection is not controllable by an attacker. This is fixed in version 1.27.0.

GitHub Advisory Database
Impact

The notification emails sent for notifications for missed messages or for an expiring account are subject to HTML injection. In the case of the notification for missed messages, this could allow an attacker to insert forged content into the email.

The account expiry feature is not enabled by default and the HTML injection is not controllable by an attacker.

Patches

This issue is fixed in #9200.

Workarounds

For the missed messages notifications:

The notif.html, notif_mail.html, and room.html templates can be overridden with custom templates that manually escapes the variables using JInja2's escape filter. See the email.template_dir setting.

For the account expiry notifications:

  1. Account expiry can be disabled via the account_validity.enabled setting.

  2. The notice_expiry.html template can be overridden with a custom template that manually escapes the variables using JInja2's escape filter. See the email.template_dir setting.

NVD (es)

Synapse es un servidor doméstico de referencia de Matrix escrito en python (paquete pypi matrix-synapse).&#xa0;Matrix es un ecosistema para VoIP y mensajería instantánea federada abierta.&#xa0;En Synapse versiones anteriores a 1.27.0, los correos electrónicos de notificación enviados para notificaciones de mensajes perdidos o para una cuenta que vence están sujetos a una inyección de HTML.&#xa0;En el caso de la notificación de mensajes perdidos, esto podría permitir a un atacante insertar contenido forjado en el correo electrónico.&#xa0;La funcionalidad expiry de la cuenta no está habilitada por defecto y la inyección de HTML por un atacante no es controlable .&#xa0;Esto es corregido en la versión 1.27.0.

References

https://github.com/matrix-org/synapse/releases/tag/v1.27.0third-party-advisory, web
https://github.com/matrix-org/synapse/pull/9200patch, third-party-advisory, web
https://github.com/matrix-org/synapse/commit/e54746bdf7d5c831eabe4dcea76a7626f1de73dffix, patch, third-party-advisory, web
https://github.com/matrix-org/synapse/security/advisories/GHSA-c5f8-35qr-q4fmadvisory, patch, third-party-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TNNAJOZNMVMXM6AS7RFFKB4QLUJ4IFEY/vendor-advisory
https://nvd.nist.gov/vuln/detail/CVE-2021-21333advisory
https://github.com/matrix-org/synapsepackage
https://github.com/pypa/advisory-database/tree/main/vulns/matrix-synapse/PYSEC-2021-134.yamlweb
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TNNAJOZNMVMXM6AS7RFFKB4QLUJ4IFEYweb

Sources

SourceRecordLicence
CVE ListCVE-2021-21333 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-c5f8-35qr-q4fm changed 2026-07-08CC-BY-4.0
NVDCVE-2021-21333 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2021-134 changed 2023-11-08CC-BY-4.0