Update dependency aiosmtplib to v5 [SECURITY] - autoclosed - #27
Closed
renovate[bot] wants to merge 1 commit into
Closed
Update dependency aiosmtplib to v5 [SECURITY] - autoclosed#27renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/pypi-aiosmtplib-vulnerability
branch
from
August 28, 2026 03:11
c30e559 to
2ae847e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==3.0.2→==5.1.2aiosmtplib vulnerable to SMTP command injection via CR/LF in sender/recipient address
CVE-2026-53533 / GHSA-v3q9-hj7j-63hq
More information
Details
Summary
aiosmtplib'sSMTP.mail(),SMTP.rcpt(),SMTP.vrfy()andSMTP.expn()send the caller-supplied email address to the server without rejecting embedded CR/LF (\r\n) bytes. An address that contains a CR/LF is written verbatim onto the SMTP control connection, so the bytes after the CRLF are framed by the server as one or more additional, standalone SMTP command lines. A caller that passes an attacker-influenced sender or recipient address intomail()/rcpt()(orvrfy()/expn()) therefore allows SMTP command injection (CWE-93 / CWE-77): the attacker can smuggle arbitrary SMTP verbs such asMAIL FROM,RCPT TO,RSET,DATA, orAUTHinto the session. Injected commands will cause theSMTPinstance to hang, but all commands required to complete the envelope could be sent in one address string.The
SMTP.sendmail()command will pass sender and recipient addresses verbatim through toSMTP.mail()&SMTP.rcpt(), and so is also vulnerable.SMTP.send_message()is not affected.Impact
Severity: medium. Type: SMTP protocol command injection (CWE-93 — Improper Neutralization of CRLF Sequences; CWE-77 — Command Injection).
When an application built on
aiosmtplibderives the envelope sender or any recipient from data an attacker can influence (a web form etc.) and passes it tomail()/rcpt()(directly, or viasendmail()/send()without aMessageobject), the attacker can:The address only needs to reach
mail()/rcpt()/vrfy()/expn(); no attacker control over the SMTP server is required.Vulnerable versions
Affected version:
aiosmtplib5.1.0 (latest at time of report) and all earlier releases.Credit
Reported by tonghuaroot.
Severity
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:H/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
aiosmtplib: STARTTLS response injection
CVE-2026-55558 / GHSA-vxj7-4xrp-5vr4
More information
Details
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=Trueorstart_tls=Nonewhen 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_tls=True. This removes the plaintext phase entirely.Severity
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
cole/aiosmtplib (aiosmtplib)
v5.1.2Compare Source
preventing a response-injection attack where a man-in-the-middle pre-stages
plaintext that would otherwise be read as part of the encrypted session.
More details: GHSA-vxj7-4xrp-5vr4
__repr__resultconnect()on an already-connected client now raisesSMTPExceptioninstead of deadlocking on the connection lockuse if a server streams data with no line ending or endless multiline
continuation lines
server response line exceeds the maximum length
desynced state, where a late server response could be mispaired with a
subsequent command
AUTH=extension advertisements; alladvertised methods are now kept (e.g. both PLAIN and LOGIN from
AUTH=PLAIN LOGIN)longer ignored
v5.1.1Compare Source
0x00-0x1Fand DEL0x7F, including CR, LF, and NUL) in SMTP command arguments, preventingcommand injection via input passed to
mail(),rcpt(),vrfy(),expn()orsendmail(). Such input now raisesValueErrorbeforeanything is written to the connection.
More details: GHSA-v3q9-hj7j-63hq
Thanks to @tonghuaroot for the report.
SMTP.quit()no longer hangs until the read timeout when thepeer drops the transport with an exception after
QUITis sent butbefore the 221 reply is parsed (e.g. AWS SES closing TLS without
close_notify).v5.1.0Compare Source
v5.0.0Compare Source
v4.0.2Compare Source
(thanks @oliverlambson)
v4.0.1Compare Source
v4.0.0Compare Source
socket.getfqdnin thread to avoid blocking event loopif
local_hostnamenot provided (thanks @Raidzin)hostnameanduse_tls=TrueConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.