{"id":"CVE-2021-21333","aliases":["CVE-2021-21333","GHSA-c5f8-35qr-q4fm","PYSEC-2021-134"],"related":[],"kind":"vulnerability","state":"published","title":"HTML injection in email and account expiry notifications","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\nThe 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.\n\nThe account expiry feature is not enabled by default and the HTML injection is not controllable by an attacker.\n\n### Patches\nThis issue is fixed in #9200.\n\n### Workarounds\nFor the missed messages notifications:\n\nThe `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](https://jinja.palletsprojects.com/en/2.11.x/templates/#escape). See the `email.template_dir` setting.\n\nFor the account expiry notifications:\n\n1. Account expiry can be disabled via the `account_validity.enabled` setting.\n\n2. The `notice_expiry.html` template can be overridden with a custom template that manually escapes the variables using [JInja2's `escape` filter](https://jinja.palletsprojects.com/en/2.11.x/templates/#escape). See the `email.template_dir` setting.","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2021-03-26T19:53:04.000Z","modified":"2026-07-08T06:27:41.174Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:H/Au:N/C:N/I:P/A:N","score":2.6,"rating":"LOW"}],"cwes":["CWE-74","CWE-79"],"affected":[{"ranges":[{"version":"< 1.27.0","status":"affected"}],"vendor":"matrix-org","product":"synapse","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.27.0"}],"ecosystem":"PyPI","package":"matrix-synapse","purl":"pkg:pypi/matrix-synapse","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.27.0"}],"vendor":"matrix","product":"synapse","cpe":"cpe:2.3:a:matrix:synapse:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"34"}],"vendor":"fedoraproject","product":"fedora","cpe":"cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"e54746bdf7d5c831eabe4dcea76a7626f1de73df"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.27.0"}],"ecosystem":"PyPI","package":"matrix-synapse","purl":"pkg:pypi/matrix-synapse","repo":"https://github.com/matrix-org/synapse","source":"pysec"}],"references":[{"url":"https://github.com/matrix-org/synapse/releases/tag/v1.27.0","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/matrix-org/synapse/pull/9200","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/matrix-org/synapse/commit/e54746bdf7d5c831eabe4dcea76a7626f1de73df","tags":["fix","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/matrix-org/synapse/security/advisories/GHSA-c5f8-35qr-q4fm","tags":["advisory","patch","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TNNAJOZNMVMXM6AS7RFFKB4QLUJ4IFEY/","tags":["vendor-advisory","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21333","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/matrix-org/synapse","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/matrix-synapse/PYSEC-2021-134.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TNNAJOZNMVMXM6AS7RFFKB4QLUJ4IFEY","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-21333","url":"https://www.cve.org/CVERecord?id=CVE-2021-21333","licence":"CVE Terms of Use","modified":"2024-08-03T18:09:15.578Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c5f8-35qr-q4fm","url":"https://github.com/advisories/GHSA-c5f8-35qr-q4fm","licence":"CC-BY-4.0","modified":"2026-07-08T06:27:41.174Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-21333","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21333","licence":"Public domain","modified":"2026-06-17T03:35:19.060Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-134","url":"https://osv.dev/vulnerability/PYSEC-2021-134","licence":"CC-BY-4.0","modified":"2023-11-08T04:04:41.701Z"}],"updatedAt":"2026-11-25T22:58:00.469Z","epss":{"score":0.01354,"percentile":0.72414,"date":"2026-12-01T12:00:22.000Z"}}