CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-55558

CVE-2026-55558: STARTTLS Response Injection in aiosmtplib

Alon Barad
Alon Barad
Software Engineer

Aug 28, 2026·6 min read·2 visits

Executive Summary (TL;DR)

aiosmtplib does not clear its internal read buffer prior to executing a TLS handshake during STARTTLS negotiation. An attacker positioned on the network path can pipeline malicious plaintext responses that survive the transport upgrade, hijacking subsequent encrypted commands.

An input buffering vulnerability exists in the aiosmtplib asynchronous SMTP client library before version 5.1.2. When upgrading a plaintext connection to TLS via STARTTLS, the library processes buffered plaintext responses after transport negotiation has completed. This behavior allows a network-positioned attacker to inject spoofed server responses prior to negotiation, leading to command/response desynchronization, arbitrary capability injection, and potential credential theft.

Vulnerability Overview

The asynchronous SMTP client library aiosmtplib relies on Python's asyncio framework to manage network socket communication. During connection initialization over standard port 587 or 25, the protocol utilizes explicit negotiation to transition an insecure plaintext connection to an encrypted Transport Layer Security (TLS) tunnel via the STARTTLS command sequence.

This transition exposes a temporary state boundary where plaintext messages must cease, and encrypted handshaking must initiate. Under standard RFC 3207 specifications, both client and server must verify that no extra data is present on the wire during this transitional window. If either party fails to validate that transport streams are completely synchronized and empty of unauthenticated packets, the protocol is susceptible to injection techniques.

The vulnerability is classified under CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component) and represents a classic protocol-transition buffer injection. An attacker with active network placement can inject arbitrary SMTP command responses that are subsequently interpreted by the application as trusted, encrypted payload responses.

Root Cause Analysis

In Python asyncio, the asyncio.Protocol base class reads incoming bytes from the underlying TCP socket and appends them to a continuous application-level read buffer. The implementation of aiosmtplib manages this buffer through the SMTPProtocol._buffer attribute in src/aiosmtplib/protocol.py. During normal operation, the client reads a line of text, locates the carriage return and line feed indicators (\r\n), and extracts the command response.

When SMTPProtocol.start_tls is called, the library transmits the STARTTLS command and waits for the server's 220 Go ahead reply. When the server transmits this reply, it may be combined into a single TCP segment with other data due to standard network framing or TCP pipelining. The aiosmtplib client parses only the initial 220 response from the read buffer but neglects to verify whether further, unparsed data remains in SMTPProtocol._buffer prior to executing the handshake.

Immediately after parsing the 220 code, the client invokes self._loop.start_tls(), which substitutes the plaintext transport with a new ssl.SSLSocket-backed transport. Crucially, the high-level SMTPProtocol instance and its associated _buffer remain unchanged during this transport swap. Because the existing bytes inside the buffer are not purged, any plaintext data residing there is preserved. When the next secure application command is issued, the client reads from its local _buffer first, consuming unencrypted, attacker-supplied data as though it was authenticated ciphertext from the newly established TLS session.

Code-Level Walkthrough and Patch Analysis

An inspection of the fix implemented in version 5.1.2 highlights the specific buffer-handling deficiency. In previous releases, the function initiated the TLS upgrade with the buffer unchecked, leaving any pre-loaded bytes accessible to the application engine. The patch directly resolves this by clearing the internal list object.

Below is the patch implemented in src/aiosmtplib/protocol.py inside the start_tls method:

# File: src/aiosmtplib/protocol.py
@@ -379,6 +379,13 @@ async def start_tls(
             if self.transport is None or self.transport.is_closing():
                 raise SMTPServerDisconnected("Connection lost")
 
+            # STARTTLS injection defense (RFC 3207 section 4.2): a compliant
+            # server sends nothing after its 220 reply until TLS is negotiated.
+            # Any bytes still buffered here are plaintext a MITM may have
+            # injected; discard them so they cannot be misread as part of the
+            # encrypted session once the handshake completes.
+            del self._buffer[:]
+
             try:
                 tls_transport = await self._loop.start_tls(
                     cast(asyncio.WriteTransport, self.transport),

The introduction of del self._buffer[:] explicitly truncates the dynamic array. Because the deletion occurs after the verification of the transport state but before invoking the start_tls asynchronous hook of the loop, there is no window where a secondary read can occur. Any data sent by a server or injected by an intermediate node prior to the TLS handshake execution is discarded. If the adversary sends extra bytes during the actual TLS handshake, those bytes will be processed by the OpenSSL state machine, causing a hard handshake failure rather than application-layer processing.

Exploitation and Attack Methodology

To exploit this vulnerability, an attacker must have Adversary-in-the-Middle capabilities on the network path. This position can be achieved through ARP poisoning, DNS redirection, or control of an intermediary network appliance. The attacker monitors TCP traffic on standard SMTP port 587 or 25 and waits for a STARTTLS request.

When the client transmits the STARTTLS command, the attacker permits the command to reach the real server. Once the server returns the 220 Go ahead status code, the attacker intercepts this packet and modifies the payload before forwarding it to the client. The attacker appends malicious SMTP capability lists or spoofed responses directly behind the 220 code.

Once the TLS handshake finishes, the client immediately issues its EHLO command to negotiate capabilities. The client's line parser then retrieves the injected bytes from self._buffer and treats them as the response to the EHLO query. The attacker can structure these responses to spoof the supported authentication mechanisms, force authentication down to plaintext (AUTH PLAIN), or simulate authentication failures to capture user credentials.

Impact Assessment

The security implications of CVE-2026-55558 are significant for environments relying on opportunistic or explicit STARTTLS. If an organization transmits transactional or administrative emails using vulnerable client configurations, credentials can be intercepted. An attacker can inject an AUTH promotion response that prompts the client to transmit base64-encoded login strings, resulting in credential harvesting.

Furthermore, the attacker can use this session desynchronization to silently hijack the email transaction. By manipulating the server's advertised capabilities, the attacker can block transport-layer integrity checks or alter command flows to force the client to transmit email payloads to alternative recipients. Because this injection happens prior to the secure negotiation phase, standard application loggers often record a successful TLS connection, hiding the execution of the injection.

The CVSS v3.1 base score of 5.9 reflects High complexity because it requires the attacker to have network path access and manage timing precisely to align the injected packets. Despite this high complexity, the impact to confidentiality and integrity is significant, prompting recommended remediation.

Remediation and Mitigation Strategies

The primary remediation for this vulnerability is upgrading aiosmtplib to version 5.1.2 or higher, which includes the buffer clearance mechanism. Security teams should scan PyPI dependency locks, requirements files, and containerized Python runtimes to ensure compliance.

If immediate patching is not possible due to dependency constraints, organizations can configure explicit connection rules. Forcing the connection configuration parameter use_tls=True bypasses the STARTTLS sequence. This parameter establishes an implicit TLS session on port 465 from the first packet, negating the plaintext protocol negotiation window.

Additionally, implementing strict DNSSEC and routing infrastructure access lists minimizes the probability of an adversary gaining the required network positioning to perform the injection.

Fix Analysis (1)

Technical Appendix

CVSS Score
5.9/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
EPSS Probability
0.26%
Top 83% most exploited

Affected Systems

Python asynchronous applications utilizing aiosmtplib for SMTP transport

Affected Versions Detail

Product
Affected Versions
Fixed Version
aiosmtplib
cole
< 5.1.25.1.2
AttributeDetail
CWE IDCWE-74
Attack VectorNetwork
CVSS v3.1 Score5.9 (Medium)
EPSS Score0.00261
ImpactIntegrity Loss / Session Desynchronization
Exploit StatusProof of Concept (PoC) documented in patch unit tests
KEV StatusNot listed in CISA KEV

MITRE ATT&CK Mapping

T1557Adversary-in-the-Middle
Credential Access
T1557.002ARP Spoofing
Credential Access
T1114Email Collection
Collection
CWE-74
Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

Vulnerability Timeline

Vulnerability identified and patch committed by author
2026-06-13
aiosmtplib version 5.1.2 officially tagged and released
2026-06-20
CVE-2026-55558 / GHSA-vxj7-4xrp-5vr4 advisory published
2026-08-20

References & Sources

  • [1]GitHub Security Advisory GHSA-vxj7-4xrp-5vr4
  • [2]Official Security Patch Commit
  • [3]aiosmtplib v5.1.2 Release Notes
  • [4]National Vulnerability Database (NVD) Entry
  • [5]CVE.org Authority Record
  • [6]Wiz Vulnerability Database Details

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 2 hours ago•CVE-2026-54770
6.1

CVE-2026-54770: Open Redirect via Parser Differential in WebOb

An open redirect vulnerability exists in WebOb before version 1.8.11 due to a parser differential between WebOb's validation logic and Python's standard urllib.parse.urljoin() function. Under Python 3.10+, the urljoin function strips leading and trailing space characters and C0 control characters, which allowed specially crafted inputs to bypass WebOb's prefix checks while still resolving as off-host redirects.

Amit Schendel
Amit Schendel
2 views•7 min read
•about 3 hours ago•CVE-2026-54687
6.1

CVE-2026-54687: Path Traversal via User-Controlled Database File Path in n8n-nodes-sqlite3

Prior to version 1.0.0, the n8n-nodes-sqlite3 integration exposed the db_path parameter as an unrestricted node parameter. By default, n8n node parameters allow the evaluation of dynamic data expressions, meaning untrusted external input could be mapped to the database path. This vulnerability allows an external attacker to control which SQLite database file the n8n backend process attempts to open, leading to directory traversal outside of the intended directory context.

Amit Schendel
Amit Schendel
4 views•5 min read
•about 4 hours ago•CVE-2026-42350
5.1

CVE-2026-42350: Client-Side Open Redirect in Kargo UI OIDC Authentication Flow

A client-side open redirect vulnerability has been identified in the Kargo user interface. The flaw resides in the handling of OpenID Connect (OIDC) login and token renewal flows, where the application extracts an unvalidated destination path from the redirectTo query parameter. Attackers can exploit this to redirect authenticated users to arbitrary external domains.

Alon Barad
Alon Barad
3 views•6 min read
•about 5 hours ago•CVE-2026-54718
7.2

CVE-2026-54718: Remote Code Execution via Advanced Workflow Email Template in Silverstripe

A Server-Side Template Injection (SSTI) vulnerability in the Silverstripe Advanced Workflow module allows authenticated attackers with workflow authoring permissions to achieve arbitrary code execution. By manipulating the NotifyUsersWorkflowAction.EmailTemplate field, attackers can inject template code that dynamically executes arbitrary PHP commands via the core translation helper interpolation path.

Amit Schendel
Amit Schendel
8 views•4 min read
•about 6 hours ago•CVE-2026-54732
6.5

CVE-2026-54732: Arbitrary File Write via Path Traversal in libreoffice-convert

A path traversal and arbitrary file write vulnerability exists in the libreoffice-convert Node.js package in all versions prior to 1.8.2. The convertWithOptions function fails to validate or sanitize the caller-controlled options.fileName parameter, allowing directory traversal sequences to write files outside the temporary directory.

Amit Schendel
Amit Schendel
5 views•6 min read
•about 7 hours ago•GHSA-MF7Q-R4RV-JV94
8.2

GHSA-MF7Q-R4RV-JV94: Time-of-Check to Time-of-Use (TOCTOU) Signature Verification Bypass in Crossplane Runtime

Crossplane's runtime package manager engine contains a Time-of-Check to Time-of-Use (TOCTOU) race condition in its container signature verification pipeline. When Crossplane parses package definitions using dynamic tag-based references, it resolves the tag on the remote OCI registry twice: once during the signature verification step (the 'Check' phase) and once during the fetch and install step (the 'Use' phase). An attacker controlling the destination OCI registry can exploit this vulnerability by serving a validly signed benign image for the verification phase, and then dynamically swapping the tag to point to an unsigned, malicious package during the fetch phase.

Alon Barad
Alon Barad
4 views•7 min read