CVE-2026-55558: aiosmtplib STARTTLS response injection

CVE-2026-55558 · Severity: medium · CVSS 5.9 · Published 2026-08-20

aiosmtplib is a Python library for sending emails via SMTP. When upgrading a plaintext connection to encrypted (STARTTLS), the library fails to discard buffered data from before the encryption handshake, allowing an attacker on the network to inject forged server responses that appear to come from inside the encrypted session. This could enable an attacker to manipulate email commands and deceive the application about server capabilities or authentication status.

Technologies: aiosmtplib (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-55558 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-55558 being exploited in the wild.
How severe is CVE-2026-55558?
Medium severity, with a CVSS score of 5.9, published 20 August 2026.
Which products and versions are affected?
aiosmtplib (PyPI) <= 5.1.1, ECOSYSTEM:introduced=0,fixed=5.1.2.
Is there a fix for CVE-2026-55558?
Yes. aiosmtplib (PyPI): upgrade to 5.1.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-55558 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-55558?
Check whether you run aiosmtplib (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • aiosmtplib (PyPI): upgrade to 5.1.2 or later
    pip install "aiosmtplib>=5.1.2"

Technical details

This is a protocol injection vulnerability (CWE-74) in aiosmtplib's STARTTLS handling. When the client sends a STARTTLS command to upgrade to TLS, the library reads the server's 220 acknowledgement reply, then immediately performs the TLS handshake while leaving any additional data in the receive buffer untouched. A network-positioned attacker can send the legitimate 220 reply followed by injected SMTP response lines (e.g., fake capabilities or authentication methods) in a single packet. The protocol object and its buffer persist across the plaintext-to-TLS boundary, so these pre-staged plaintext bytes are later parsed as if they arrived inside the encrypted session, desynchronizing all subsequent command/response pairs. The attack requires an active man-in-the-middle (network compromise); passive eavesdropping cannot exploit it. The fix, released in version 5.1.2, treats any buffered data after the 220 response and before the TLS handshake as a protocol violation per RFC 3207 §4.2.

Affected products

  • cole aiosmtplib <= 5.1.1

Identifiers

  • CVE-2026-55558
  • GHSA-vxj7-4xrp-5vr4
  • PYSEC-2026-3805

Timeline

  • 2026-06-20: disclosed: Advisory published by cole/aiosmtplib
  • 2026-06-20: patched: Fix released in version 5.1.2
  • 2026-08-27: advisory: Published to GitHub Advisory Database

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.