CVE-2023-40217: Race Condition

Published Aug 25, 2023
·
Updated

An issue was discovered in Python before 3.8.18, 3.9.x before 3.9.18, 3.10.x before 3.10.13, and 3.11.x before 3.11.5. It primarily affects servers (such as HTTP servers) that use TLS client authentication. If a TLS server-side socket is created, receives data into the socket buffer, and then is closed quickly, there is a brief window where the SSLSocket instance will detect the socket as "not connected" and won't initiate a handshake, but buffered data will still be readable from the socket buffer. This data will not be authenticated if the server-side TLS peer is expecting client certificate authentication, and is indistinguishable from valid TLS stream data. Data is limited in size to the amount that will fit in the buffer. (The TLS connection cannot directly be used for data exfiltration because the vulnerable code path requires that the connection be closed on initialization of the SSLSocket.)

Other sources

Python could allow a remote attacker to bypass security restrictions, caused by a race condition in the SSLSocket module. When the socket is closed before the TLS handshake is complete, the data is treated as if it had been encrypted by TLS. An attacker could exploit this vulnerability to bypass the TLS handshake and inject a malicious client certificate into the connection and gain access to the server’s resources without being authenticated.

IBM

Affected Software

18 affected componentsFixes available
redhat/Python<3.11.5
3.11.5
redhat/Python<3.10.13
3.10.13
redhat/Python<3.9.18
3.9.18
redhat/Python<3.8.18
3.8.18
F5 BIG-IP>=17.1.0<=17.1.1
F5 BIG-IP>=16.1.0<=16.1.4
F5 BIG-IP>=15.1.0<=15.1.10
F5 Traffix SDC=5.1.0
5.2.0
Python Python<3.8.18
Python Python>=3.9.0<3.9.18
Python Python>=3.10.0<3.10.13
Python Python>=3.11.0<3.11.5
debian/pypy3<=7.3.5+dfsg-2+deb11u2
7.3.5+dfsg-2+deb11u47.3.11+dfsg-2+deb12u37.3.19+dfsg-2
debian/python2.7
2.7.18-8+deb11u1
debian/python3.11
3.11.2-6+deb12u53.11.2-6+deb12u3
debian/python3.12
3.12.10-1
debian/python3.9<=3.9.2-1
3.9.2-1+deb11u3
IBM QRadar Network Packet Capture<=7.5.0 - 7.5.0 Update Package 7

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade F5 Traffix Systems Signaling Delivery Controller to a version that resolves this vulnerability.

    Fixed in 5.2.0
  2. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.5+dfsg-2+deb11u4Fixed in 7.3.11+dfsg-2+deb12u3Fixed in 7.3.19+dfsg-2
  3. Upgrade

    Upgrade debian/python2.7 to a version that resolves this vulnerability.

    Fixed in 2.7.18-8+deb11u1
  4. Upgrade

    Upgrade debian/python3.11 to a version that resolves this vulnerability.

    Fixed in 3.11.2-6+deb12u5Fixed in 3.11.2-6+deb12u3
  5. Upgrade

    Upgrade debian/python3.12 to a version that resolves this vulnerability.

    Fixed in 3.12.10-1
  6. Upgrade

    Upgrade debian/python3.9 to a version that resolves this vulnerability.

    Fixed in 3.9.2-1+deb11u3
  7. Upgrade

    Upgrade redhat/Python to a version that resolves this vulnerability.

    Fixed in 3.11.5
  8. Upgrade

    Upgrade redhat/Python to a version that resolves this vulnerability.

    Fixed in 3.10.13
  9. Upgrade

    Upgrade redhat/Python to a version that resolves this vulnerability.

    Fixed in 3.9.18
  10. Upgrade

    Upgrade redhat/Python to a version that resolves this vulnerability.

    Fixed in 3.8.18
  11. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.5+dfsg-2+deb11u4
  12. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.11+dfsg-2+deb12u3
  13. Upgrade

    Upgrade debian/pypy3 to a version that resolves this vulnerability.

    Fixed in 7.3.19+dfsg-2
  14. Upgrade

    Upgrade debian/python3.11 to a version that resolves this vulnerability.

    Fixed in 3.11.2-6+deb12u5
  15. Upgrade

    Upgrade debian/python3.11 to a version that resolves this vulnerability.

    Fixed in 3.11.2-6+deb12u3
  16. Upgrade

    Upgrade Python to a version that resolves this vulnerability.

    Fixed in 3.8.18
  17. Upgrade

    Upgrade Python to a version that resolves this vulnerability.

    Fixed in 3.9.18
  18. Upgrade

    Upgrade Python to a version that resolves this vulnerability.

    Fixed in 3.10.13
  19. Upgrade

    Upgrade Python to a version that resolves this vulnerability.

    Fixed in 3.11.5

Event History

Aug 25, 2023
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Data Sourced
via NVD·01:15 AM
DescriptionSeverityAffected Software
Aug 29, 2023
Data Sourced
via Red Hat·06:17 PM
DescriptionSeverityAffected Software
Jan 12, 2024
Data Sourced
via Launchpad·12:24 AM
Description
May 21, 2024
Advisory Published
via F5·04:33 PM
Jul 23, 2024
Data Sourced
via IBM·12:00 AM
DescriptionSeverityAffected Software
Jan 7, 2025
Data Sourced
via Ubuntu·01:17 PM
RemedyDescriptionSeverityAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2023-40217?

CVE-2023-40217 is a vulnerability discovered in Python versions before 3.8.18, 3.9.x before 3.9.18, 3.10.x before 3.10.13, and 3.11.x before 3.11.5.

2

Who is affected by CVE-2023-40217?

Servers (such as HTTP servers) that use TLS client authentication are primarily affected by CVE-2023-40217.

3

What is the severity of CVE-2023-40217?

CVE-2023-40217 has a severity level of 5.3 (medium).

4

How can I fix CVE-2023-40217?

To fix CVE-2023-40217, it is recommended to update Python to versions 3.8.18, 3.9.18, 3.10.13, or 3.11.5.

5

Where can I find more information about CVE-2023-40217?

You can find more information about CVE-2023-40217 on the following references: [Link 1](https://lists.debian.org/debian-lts-announce/2023/09/msg00022.html), [Link 2](https://mail.python.org/archives/list/security-announce@python.org/thread/PEPLII27KYHLF4AK3ZQGKYNCRERG4YXY/), [Link 3](https://www.python.org/dev/security/).

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203