]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw (...
authorŁukasz Langa <lukasz@langa.pl>
Tue, 22 Aug 2023 17:53:19 +0000 (19:53 +0200)
committerGitHub <noreply@github.com>
Tue, 22 Aug 2023 17:53:19 +0000 (19:53 +0200)
commit75a875e0df0530b75b1470d797942f90f4a718d3
tree59da3966b7baec4ba056d498a8c577ba0946fdf3
parent5be32d88182f956f423a56c6250ce4020e8cd53c
[3.11] gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw (#108317)

gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close 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>
Lib/ssl.py
Lib/test/test_ssl.py
Misc/NEWS.d/next/Security/2023-08-22-17-39-12.gh-issue-108310.fVM3sg.rst [new file with mode: 0644]