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·16 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

•27 minutes ago•CVE-2026-126295
7.1

CVE-2026-126295: Path Traversal and Unconfined File Access in NLTK BllipParser

CVE-2026-126295 (also tracked as GHSA-fg9w-wfp5-j933) is a path confinement bypass vulnerability in the Natural Language Toolkit (NLTK) affecting versions 3.10.0 prior to 3.10.4. The flaw resides in nltk/parse/bllip.py within the BllipParser class and its factory method BllipParser.from_unified_model_dir(). Unlike sibling tool wrappers in NLTK that enforce data-root confinement via the nltk.pathsec module, BllipParser passes caller-supplied filesystem paths directly into the third-party bllipparser native C extension without validation. When an application passes untrusted input as model paths or directories to BllipParser, an attacker can force the native extension to open arbitrary files on the local filesystem. This leads to information disclosure through parser diagnostic oracles, local model tampering via shared directories, and denial of service by hanging worker threads on blocking special files (such as FIFOs or device nodes) or exhausting memory via oversized files.

Amit Schendel
Amit Schendel
1 views•11 min read
•about 1 hour ago•CVE-2026-126300
5.3

CVE-2026-126300: Algorithmic Complexity Denial of Service in NLTK TreebankWordTokenizer.span_tokenize

CVE-2026-126300 (GHSA-ffr9-mgrr-wcvr) is an inefficient algorithmic complexity vulnerability (CWE-407) in the Natural Language Toolkit (NLTK) Python library affecting versions 3.2.5 prior to 3.10.4. The flaw resides in the quote-restoration routine of TreebankWordTokenizer.span_tokenize and NLTKWordTokenizer.span_tokenize, where repeated calls to list.pop(0) over matched quote tokens introduce quadratic O(n^2) time complexity. An unauthenticated remote attacker who supplies input containing long sequences of double-quote characters can exhaust CPU resources and degrade service availability.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 2 hours ago•GHSA-GPWC-27CW-RH9R
5.3

CVE-2026-126301: Quadratic CPU Exhaustion in NLTK LegalitySyllableTokenizer

The Natural Language Toolkit (NLTK) versions 3.6 through 3.10.3 contain an algorithmic complexity vulnerability in the LegalitySyllableTokenizer.tokenize method. When processing tokens composed of continuous runs of vowels, an unguarded string reversal and set membership lookup loop executes in quadratic time relative to the input token length. Remote attackers capable of submitting arbitrary text to applications utilizing this tokenizer can trigger sustained single-core CPU exhaustion and application-level denial of service.

Amit Schendel
Amit Schendel
4 views•10 min read
•about 3 hours ago•CVE-2026-126304
8.7

CVE-2026-126304: Symlink Path Traversal in NLTK YCOECorpusReader

CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.

Amit Schendel
Amit Schendel
5 views•9 min read
•about 4 hours ago•CVE-2026-128077
6.5

CVE-2026-128077: Authorization Bypass via Request Path Desynchronization in Nuxt and @nuxt/nitro-server

CVE-2026-128077 (GHSA-r99w-jh2x-3mg9) is an authorization bypass and interpretation conflict vulnerability affecting Nuxt and its underlying @nuxt/nitro-server package in versions 4.6.0 through 4.6.3. When an incoming HTTP request path begins with a double forward slash (e.g., //x/admin), the WHATWG URL parser within the Nuxt server-side page renderer interprets the initial segment as a network host/authority and resolves the remaining path (/admin) against the application's page router. Because Nitro server middleware, route-scoped serverHandlers, and Nitro routeRules evaluate the unparsed request path (//x/admin), path-based access controls, redirects, and security header policies configured for /admin fail to match and are bypassed.

Amit Schendel
Amit Schendel
5 views•10 min read
•about 5 hours ago•CVE-2026-128084
4.8

CVE-2026-128084: Integer Truncation and SQL Query Truncation in sqlite3-ruby

Prior to version 2.10.2, the sqlite3-ruby gem explicitly cast 64-bit Ruby string lengths (long) to 32-bit signed integers (int) when invoking the underlying SQLite C API. On 64-bit platforms, providing a string of 4 GiB (2^32 bytes) or larger causes integer truncation, instructing SQLite to process only a prefix of the string. This flaw affects SQL query preparation, bound parameter values, and return values from custom Ruby-defined SQL functions and aggregates, allowing trailing SQL clauses such as WHERE restrictions to be silently dropped under specific conditions.

Alon Barad
Alon Barad
5 views•11 min read