◐ Shell
clean mode source ↗

gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw by ambv · Pull Request #108315 · python/cpython

…ose flaw

Instances of `ssl.SSLSocket` were vulnerable to a bypass of the TLS handshake
and included protections (like certificate verification) and treating sent
unencrypted data as if it were post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is sent by the
malicious peer and stored in a buffer, and then the malicious peer closes the
socket within a small timing window before the other peers’ TLS handshake can
begin. After this sequence of events the closed socket will not immediately
attempt a TLS handshake due to not being connected but will also allow the
buffered data to be read as if a successful TLS handshake had occurred.

Co-Authored-By: Gregory P. Smith [Google LLC] <greg@krypto.org>

@bedevere-bot mentioned this pull request

Aug 22, 2023

2 tasks

@ambv ambv deleted the cve-2023-40217 branch

August 22, 2023 18:00

obfusk

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request

Sep 14, 2023

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 3, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Fixes: bsc#1214692
Fixes: gh#python#108315
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl pushed a commit to openSUSE-Python/cpython that referenced this pull request

Apr 4, 2024
Instances of `ssl.SSLSocket` were vulnerable to a bypass of
the TLS handshake and included protections (like certificate
verification) and treating sent unencrypted data as if it were
post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is
sent by the malicious peer and stored in a buffer, and then the
malicious peer closes the socket within a small timing window
before the other peers’ TLS handshake can begin. After this
sequence of events the closed socket will not immediately attempt
a TLS handshake due to not being connected but will also allow
the buffered data to be read as if a successful TLS handshake had
occurred.

Code is from gh#python/cpython@b4bcc06, it was released
upstream in 3.8.18.

Co-Authored-By: Gregory P. Smith [Google LLC] <greg@krypto.org>
Fixes: bsc#1214692
Fixes: gh#python#108315
Fixes: gh#python#108310
Patch: CVE-2023-40217-avoid-ssl-pre-close.patch

mcepl added a commit to openSUSE-Python/cpython that referenced this pull request

Jul 1, 2025