Intel

AIKIDO-2026-95892

aiosmtplib is vulnerable to STARTTLS Response Injection

CVE-2026-55558Published Jun 23, 2026
June 23, 2026

59

CVE Score

Medium

STARTTLS Response Injection

Are you affected? Scan for Free

TL;DR

When a connection is upgraded with STARTTLS, the client reads the server's 220 go-ahead reply and begins the TLS handshake without discarding bytes already sitting in the receive buffer. Because the asyncio transport is swapped in place while the protocol buffer is reused, plaintext read before the handshake survives into the encrypted session and is parsed as the first post-TLS server response. An active man-in-the-middle can pre-stage response lines right after the 220 reply to inject server responses and desynchronize every later command and response pair inside the supposedly encrypted session. The fix discards any data buffered after the 220 STARTTLS reply before performing the handshake, as required by RFC 3207.

How do I fix this?

Upgrade the aiosmtplib library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your connections upgrade from plaintext using STARTTLS.

Package

Versions

0.1 - 5.1.1

Fixed in 5.1.2

Background info

aiosmtplib is vulnerable to STARTTLS Response Injection in versions 0.1 - 5.1.1.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea