Summary
Sydent does not verify email server certificates
Details
Sydent can be configured to send emails over a TLS-encrypted socket by setting
email:
tlsmode: "TLS" # or the legacy value "SSL"
in its config file. Alternatively it can be configured to use Opportunistic TLS by setting
email:
tlsmode: "STARTTLS"
In both situations, Sydent will encrypt its communication with the SMTP server when sending emails. In affected versions, Sydent will not verify the destination server's certificate.
Vulnerability
Sydent sends email for two purposes:
- to inform a third party that they have been invited to a Matrix room by their email address; and
- to verify that a given Matrix user controls an email address.
Therefore, attackers capable of running a MITM attack can
- Intercept room invitations sent to an email address. The invitation includes
- the room ID and its avatar, and
- the inviter's username, displayname and their avatar, and
- credentials for a guest Matrix account on the inviter's homeserver.
- Intercept address ownership confirmation emails. This would allow the attacker to falsely claim ownership of the indented recipient's Matrix account, if that account was permitted to log in using an email address and no other authentication factors.
Workarounds
One can ensure Sydent's emails fail to send by setting the configured SMTP server to a loopback or non-routable address under your control which does not have a listening SMTP server. For example:
email:
smtphost: "localhost" # Assuming there is no SMTP server listening on localhost
References
- https://github.com/matrix-org/sydent/pull/574 implements the fix.
- https://github.com/matrix-org/sydent/releases/tag/v2.5.6 is the release including this fix.
- https://docs.python.org/3/library/ssl.html?highlight=ssl#security-considerations details the best-practice advice on how to use the standard library
smtpmodule safely. - https://peps.python.org/pep-0476/ (accepted) proposed enabling TLS certificate verification by default in standard library HTTP clients.
- https://github.com/python/cpython/issues/91826 discusses enabling TLS certificate verification by default in the Python standard library, for SMTP and other protocols.
For more information
If you have any questions or comments about this advisory, e-mail us at [email protected].
Impact
If configured to send emails using TLS, Sydent does not verify SMTP servers' certificates. This makes Sydent's emails vulnerable to interception via a man-in-the-middle (MITM) attack. Attackers with privileged access to the network can intercept room invitations and address confirmation emails.
CVSS 3.1 overall score: 3.3 - AV:A/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N/CR:L/IR:L/AR:X/MAV:A/MAC:H/MPR:N/MUI:N/MS:C/MC:L/MI:L/MA:N
Reported by Martin Schobert, Pentagrid AG.
CVE-2023-38686 has a CVSS score of 9.3 (Critical). The vector is reachable from an adjacent network, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.5.6); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
This is patched in Sydent 2.5.6, see PR https://github.com/matrix-org/sydent/pull/574.
When patching, make sure that Sydent trusts the certificate of the server it is connecting to. This should happen automatically when using properly issued certificates. If you are using self-signed certificates, make sure to copy your Certification Authority certificate, or your self signed certificate if using only one, to the trust store of your operating system.
Frequently Asked Questions
- What is CVE-2023-38686? CVE-2023-38686 is a critical-severity security vulnerability in matrix-sydent (pip), affecting versions < 2.5.6. It is fixed in 2.5.6.
- How severe is CVE-2023-38686? CVE-2023-38686 has a CVSS score of 9.3 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of matrix-sydent are affected by CVE-2023-38686? matrix-sydent (pip) versions < 2.5.6 is affected.
- Is there a fix for CVE-2023-38686? Yes. CVE-2023-38686 is fixed in 2.5.6. Upgrade to this version or later.
- Is CVE-2023-38686 exploitable, and should I be worried? Whether CVE-2023-38686 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2023-38686 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2023-38686? Upgrade
matrix-sydentto 2.5.6 or later.