llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · matrix-sydent

GHSA-P6HW-WM59-3G5G

Sydent does not verify email server certificates

Parche disponible
Descargar PNG JSON
CVSS
—
critical
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición1.208 dDesde la divulgación, 31 jul 2023, 5:03 p. m.
Detección1.204 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Parche 2.5.6
Monitoreo
Detectada
31 jul 23
10 sept 26
17 nov 26
21 nov 26
31 jul 23
28 may 24
26 mar 25
23 ene 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-P6HW-WM59-3G5G divulgada
Remediación Parche 2.5.6 matrix-sydent · 0 d desde divulgación
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

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 https://en.wikipedia.org/wiki/Man-in-the-middle_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 https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=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&version=3.1

_Reported by Martin Schobert, Pentagrid AG https://pentagrid.ch/._

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 https://en.wikipedia.org/wiki/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

  1. Intercept room invitations sent to an email address. The invitation includes
  2. the room ID and its avatar, and
  3. the inviter's username, displayname and their avatar, and
  4. credentials for a guest Matrix account on the inviter's homeserver.
  5. 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.
Patches

This is patched in Sydent 2.5.6 https://github.com/matrix-org/sydent/releases/tag/v2.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.

Workarounds

One can ensure Sydent's emails fail to send by setting the configured SMTP server to a loopback or non-routable https://datatracker.ietf.org/doc/html/rfc1918#section-3 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 `smtp` module 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 [security@matrix.org](mailto:security@matrix.org).

Versiones

Rangos afectados

Afectada Corregida Última
matrix-sydent< 2.5.6
2.5.6
2.6.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypimatrix-sydent
Corregida 2.5.6 0 d 2.6.1 no afectada
Versiones corregidas2.5.6
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2023-38686
Otrahttps://github.com/matrix-org/sydent/security/advisories/GHSA-p6hw-wm59-3g5g
Otrahttps://github.com/python/cpython/issues/91826
Otrahttps://github.com/matrix-org/sydent/pull/574
Otrahttps://github.com/matrix-org/sydent/commit/1cd748307c6b168b66154e6c4db715d4b9551261
Otrahttps://docs.python.org/3/library/ssl.html?highlight=ssl#security-considerations
Otrahttps://github.com/matrix-org/sydent
Otrahttps://github.com/matrix-org/sydent/releases/tag/v2.5.6
Otrahttps://github.com/pypa/advisory-database/tree/main/vulns/matrix-sydent/PYSEC-2023-139.yaml
Otrahttps://peps.python.org/pep-0476

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.