Vulnerabilities in pkg:pypi/aiosmtplib

PACKAGE
Advisory Identifier: GHSA-vxj7-4xrp-5vr4
Advisory Summary

CVE-2026-55558 is a MODERATE (CVSS 5.9) starttls response injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting aiosmtplib libraries in the PyPI ecosystem. The issue involves starttls response injection. Remediation is available by upgrading affected packages to version 5.1.2.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/aiosmtplib

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/aiosmtplib. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-vxj7-4xrp-5vr4 CVE-2026-55558 MODERATE aiosmtplib: STARTTLS response injection
GHSA-v3q9-hj7j-63hq CVE-2026-53533 MODERATE aiosmtplib vulnerable to SMTP command injection via CR/LF in sender/recipient address

CVE-2026-55558 at a Glance

CVE Identifier CVE-2026-55558
GHSA Identifier GHSA-vxj7-4xrp-5vr4
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product aiosmtplib
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-55558

To remediate this vulnerability, upgrade all affected aiosmtplib dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

aiosmtplib fixed: 5.1.2
pip install aiosmtplib>=5.1.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show aiosmtplib

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-55558, inspect your installed packages using pip:

pip show aiosmtplib

Analyze the terminal output to locate any version of aiosmtplib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.1.2), your application is affected.

Note: The pip show aiosmtplib command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In aiosmtplib, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Impact When a connection is upgraded with STARTTLS, aiosmtplib reads the server's 220 go-ahead reply and immediately performs the TLS handshake without discarding any data still sitting in the receive buffer. Bytes the protocol read off the plaintext socket before the handshake survive across the plaintext→TLS boundary (the asyncio transport is swapped in place, so the protocol object and its buffer are reused), and are then parsed as though they had arrived inside the TLS session. Who is affected: Any caller that uses STARTTLS by passing `start_tls=True` or `start_tls=None` when the server advertises STARTTLS, and whose traffic can be intercepted by an active network attacker on the plaintext leg of the connection. A man in the middle can send, in a single segment immediately after the client's STARTTLS command, the 220 reply followed by attacker-chosen response lines (e.g. 220 Go ahead\r\n250-mx.evil\r\n250 AUTH LOGIN\r\n). aiosmtplib consumes only the 220, leaves the injected lines buffered, completes the handshake, and then parses the attacker's pre-staged plaintext as the first post-TLS server response. This also desynchronizes every subsequent command/response pair inside the "encrypted" session. Not affected: Connections using implicit/direct TLS (`use_tls=True`) have no plaintext phase and are not vulnerable. The attack requires an active man in the middle via network compromise; a passive eavesdropper cannot exploit it. # Patches A fix is available in aiosmtplib 5.1.2. All earlier versions that support STARTTLS are affected; upgrade to 5.1.2 or later. The fix treats any data buffered after the 220 STARTTLS reply and before the handshake as a protocol violation, per RFC 3207 §4.2 ("the client MUST discard any knowledge obtained from the server … which was not obtained from the TLS negotiation itself"). # Workarounds If you cannot upgrade immediately: - Use implicit TLS instead of STARTTLS. Connect with `use_tls=True`. This removes the plaintext phase entirely. - If STARTTLS is unavoidable, restrict connections to servers reached over a trusted network path.

CVE-2026-55558 Affected aiosmtplib Versions

1 component(s)
Fixed Versions:
5.1.2
Product / Package Ecosystem Affected Versions Fixed Version
aiosmtplib
PyPI
< 5.1.2
5.1.2

References

Frequently Asked Questions

What is CVE-2026-55558?
CVE-2026-55558 is a security vulnerability in aiosmtplib involving STARTTLS response injection under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which aiosmtplib versions are affected?
Affected versions include releases prior to 5.1.2 across affected packages: aiosmtplib.
What version fixes CVE-2026-55558?
Upgrading to 5.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is aiosmtplib affected?
Yes, aiosmtplib is affected in releases prior to 5.1.2. Upgrade your dependency to 5.1.2 or later.
What is the CVSS score of CVE-2026-55558?
CVE-2026-55558 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2026-55558?
CVE-2026-55558 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check PyPI dependencies for CVE-2026-55558?
Run the dependency tree command: 'pip show aiosmtplib'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vxj7-4xrp-5vr4",
  "modified" : "2026-08-27T23:32:22Z",
  "published" : "2026-08-27T23:32:22Z",
  "aliases" : [ "CVE-2026-55558" ],
  "summary" : "aiosmtplib: STARTTLS response injection",
  "details" : "## Impact\n\nWhen a connection is upgraded with STARTTLS, aiosmtplib reads the server's 220 go-ahead reply and immediately performs the TLS handshake without discarding any data still sitting in the receive buffer. Bytes the protocol read off the plaintext socket before the handshake survive across the plaintext→TLS boundary (the asyncio transport is swapped in place, so the protocol object and its buffer are reused), and are then parsed as though they had arrived inside the TLS session.\n\nWho is affected: Any caller that uses STARTTLS by passing `start_tls=True` or `start_tls=None` when the server advertises STARTTLS, and whose traffic can be intercepted by an active network attacker on the plaintext leg of the connection.\n\nA man in the middle can send, in a single segment immediately after the client's STARTTLS command, the 220 reply followed by attacker-chosen response lines (e.g. 220 Go ahead\\r\\n250-mx.evil\\r\\n250 AUTH LOGIN\\r\\n). aiosmtplib\n  consumes only the 220, leaves the injected lines buffered, completes the handshake, and then parses the attacker's pre-staged plaintext as the first post-TLS server response. This also desynchronizes every\n  subsequent command/response pair inside the \"encrypted\" session.\n\nNot affected: Connections using implicit/direct TLS (`use_tls=True`) have no plaintext phase and are not vulnerable. The attack requires an active man in the middle via network compromise; a passive eavesdropper cannot exploit it.\n\n\n# Patches\n\n  A fix is available in aiosmtplib 5.1.2. All earlier versions that support STARTTLS are affected; upgrade to 5.1.2 or\n  later.\n\n  The fix treats any data buffered after the 220 STARTTLS reply and before the handshake as a protocol violation, per RFC 3207 §4.2 (\"the client MUST discard any knowledge obtained from the server … which was not\n  obtained from the TLS negotiation itself\").\n\n# Workarounds\n\n  If you cannot upgrade immediately:\n\n  - Use implicit TLS instead of STARTTLS. Connect with `use_tls=True`. This removes the plaintext phase entirely.\n  - If STARTTLS is unavoidable, restrict connections to servers reached over a trusted network path.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "aiosmtplib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.1.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.1.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cole/aiosmtplib/security/advisories/GHSA-vxj7-4xrp-5vr4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-55558"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cole/aiosmtplib/commit/9fab7ba1361dbf7622ede1315a24be805cff09c9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cole/aiosmtplib"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cole/aiosmtplib/releases/tag/v5.1.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-27T23:32:22Z",
    "nvd_published_at" : "2026-08-20T15:17:31Z"
  }
}