VAITP Dataset

← Back to the dataset

CVE-2023-38686

Sydent SMTP TLS certificate verification vulnerability

  • CVSS 5.3
  • CWE-295 Improper Certificate Validation
  • Cryptographic
  • Remote

Sydent is an identity server for the Matrix communications protocol. Prior to version 2.5.6, 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. This is patched in Sydent 2.5.6. 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. Those who use self-signed certificates should make sure to copy their Certification Authority certificate, or their self signed certificate if using only one, to the trust store of your operating system. As a workaround, one can ensure Sydent's emails fail to send by setting the configured SMTP server to a loopback or non-routable address under one's control which does not have a listening SMTP server.

CVSS base score
5.3
Published
2023-08-04
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Cryptographic
Subcategory
Improper SSL/TLS Certificate Validation
Accessibility scope
Remote
Impact
Information Disclosure
Fixed by upgrading
Yes

Solution

Update to Sydent version 2.5.6 or higher.

Vulnerable code sample

import smtplib

def send_email(smtp_server, port, sender_email, receiver_email, message, use_tls=True):
    server = smtplib.SMTP(smtp_server, port)
    
    if use_tls:
        server.starttls()
    
    server.login(sender_email, 'your_password')
    server.sendmail(sender_email, receiver_email, message)
    server.quit()

Patched code sample

import smtplib
import ssl

def send_email(smtp_server, port, sender_email, receiver_email, message, use_tls=True):
    context = ssl.create_default_context()
    
    with smtplib.SMTP(smtp_server, port) as server:
        if use_tls:
            server.starttls(context=context)
        server.login(sender_email, 'your_password')
        server.sendmail(sender_email, receiver_email, message)

Cite this entry

@misc{vaitp:cve202338686,
  title        = {{Sydent SMTP TLS certificate verification vulnerability}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2023},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2023-38686},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-38686/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::