CVE-2021-21333
HTML injection in email and account expiry notifications
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- None
- Integrity
- High
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
6.1
HTML injection in email and account expiry notifications
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.
- Record
CVE-2021-21333- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - Weakness
- CWE-74
- Updated
- 2026-11-02
EUVDEUVD-2021-0126
6.1
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.
- Record
EUVD-2021-0126- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-c5f8-35qr-q4fm
4.9
HTML injection in email and account expiry notifications
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:
-
Account expiry can be disabled via the
account_validity.enabledsetting. -
The
notice_expiry.htmltemplate can be overridden with a custom template that manually escapes the variables using JInja2'sescapefilter. See theemail.template_dirsetting.
- Record
GHSA-c5f8-35qr-q4fm- CVSS 4.0
- 4.9 Medium
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:N/SI:H/SA:N - CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - Weakness
- CWE-74, CWE-79
- Updated
- 2026-11-02
NVD
6.1
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.
- Record
CVE-2021-21333- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - CVSS 2.0
- 2.6 Low
AV:N/AC:H/Au:N/C:N/I:P/A:N - Weakness
- CWE-74, CWE-79
- Updated
- 2026-11-02
OSV
6.1
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.
- Record
CVE-2021-21333- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-21333
6.1
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.
- Record
DEBIAN-CVE-2021-21333- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - Updated
- 2026-11-02
OSVGHSA-c5f8-35qr-q4fm
4.9
HTML injection in email and account expiry notifications
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:
-
Account expiry can be disabled via the
account_validity.enabledsetting. -
The
notice_expiry.htmltemplate can be overridden with a custom template that manually escapes the variables using JInja2'sescapefilter. See theemail.template_dirsetting.
- Record
GHSA-c5f8-35qr-q4fm- CVSS 4.0
- 4.9 Medium
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:N/SI:H/SA:N - CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - Weakness
- CWE-74, CWE-79
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-21333
6.1
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.
- Record
UBUNTU-CVE-2021-21333- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N - Updated
- 2026-11-02
OSVPYSEC-2021-134 No score
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.
- Record
PYSEC-2021-134- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
matrix-synapsePyPI |
before 1.27.0 | 1.27.0 |
matrix-synapsePyPI |
before 1.27.0, plus listed versions 0.33.50.33.5.10.33.60.33.6rc10.33.7 Show 45 moreShow less0.33.7rc10.33.7rc20.33.80.33.8rc20.33.90.34.00.34.0.10.34.0rc10.34.0rc20.34.1.10.99.00.99.0rc10.99.0rc20.99.0rc30.99.0rc40.99.10.99.1.10.99.1rc10.99.1rc20.99.20.99.2rc10.99.30.99.3.10.99.3.20.99.3rc10.99.40.99.4rc10.99.50.99.5.10.99.5.20.99.5rc11.0.01.0.0rc11.0.0rc21.0.0rc31.1.01.1.0rc11.1.0rc21.10.01.10.0rc11.10.0rc21.10.0rc31.10.0rc51.10.11.11.0 |
1.27.0 |
matrix-synapseUbuntu:Pro:18.04:LTS |
All versions, plus listed versions 0.19.2+dfsg-60.24.0+dfsg-10.24.0+dfsg-1ubuntu0.1~esm10.24.0+dfsg-1ubuntu0.1~esm4 |
None known |
matrix-synapseUbuntu:Pro:20.04:LTS |
All versions, plus listed versions 1.3.0-11.4.0-11.5.0-11.5.1-11.6.0-1 Show 12 moreShow less1.6.1-11.7.0-21.7.1-11.7.2-11.7.3-11.8.0-11.9.0-11.9.1-11.10.0-11.10.0-21.11.0-11.11.0-1ubuntu0.1~esm2 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected | ||
| aliases, products | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-21333 is a medium vulnerability (CVSS 6.1) in Element-hq Synapse, published March 26, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.35%, the 71st percentile. Fixed in matrix-synapse 1.27.0.
References
github.com/matrix-org/synapse/releases/tag/v1.27.0
github.com/matrix-org/synapse/pull/9200
github.com/matrix-org/synapse/commit/e54746bdf7d5c831eabe4dcea76a7626f1de73df
github.com/matrix-org/synapse/security/advisories/GHSA-c5f8-35qr-q4fm
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TNNAJOZNMVMXM6AS7RFFKB4QLUJ4IFEY
nvd.nist.gov/vuln/detail/CVE-2021-21333
Show 7 moreShow less
github.com/pypa/advisory-database/tree/main/vulns/matrix-synapse/PYSEC-2021-134.yaml
lists.fedoraproject.org/archives/list/[email protected]/message/TNNAJOZNMVMXM6AS7RFFKB4QLUJ4IFEY
github.com/advisories/GHSA-c5f8-35qr-q4fm
security-tracker.debian.org/tracker/CVE-2021-21333
github.com/matrix-org/synapse
ubuntu.com/security/CVE-2021-21333
cve.org/CVERecord?id=CVE-2021-21333
Left out here: 99 versions. The JSON record has them.