CVE-2023-40217 Security feature bypass in n/a

Medium 5.3 Published Updated

Attackers can bypass TLS client certificate authentication on Python servers by exploiting a race condition in socket closure, allowing unauthenticated data access.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2023-40217?

CVE-2023-40217 is a medium-severity vulnerability in Python Python, published on 25 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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.)

Which versions are affected by CVE-2023-40217?

3 open source packages ship an affected version, including libpython, python and python-min. It affects 1 product.

PackageAffectedFixed in
libpython BitnamiAll versions3.8.18, 3.9.18, 3.10.13, 3.11.5
python BitnamiAll versions3.8.18, 3.9.18, 3.10.13, 3.11.5
python-min BitnamiAll versions3.8.18, 3.9.18, 3.10.13, 3.11.5
Linux distribution packages (37)
babel AlmaLinux:8All versions2.5.1-10.module_el8.6.0+2781+fed64c13
platform-python AlmaLinux:8All versions3.6.8-51.el8_8.2.alma.1
platform-python-debug AlmaLinux:8All versions3.6.8-51.el8_8.2.alma.1
platform-python-devel AlmaLinux:8All versions3.6.8-51.el8_8.2.alma.1
python-nose-docs AlmaLinux:8All versions1.3.7-31.module_el8.6.0+2781+fed64c13
python-psycopg2-doc AlmaLinux:8All versions2.7.5-7.module_el8.6.0+2781+fed64c13
python-psycopg2-doc AlmaLinux:8All versions2.7.5-7.module_el8.6.0+3162+01a09e5a
python-sqlalchemy-doc AlmaLinux:8All versions1.3.2-2.module_el8.6.0+2781+fed64c13
python2 AlmaLinux:8All versions2.7.18-13.module_el8.8.0+3663+627ce7bb.2.alma.1
python2-Cython AlmaLinux:8All versions0.28.1-7.module_el8.6.0+2781+fed64c13
python2-Cython AlmaLinux:8All versions0.28.1-7.module_el8.6.0+3162+01a09e5a
python2-PyMySQL AlmaLinux:8All versions0.8.0-10.module_el8.6.0+2781+fed64c13
python2-attrs AlmaLinux:8All versions17.4.0-10.module_el8.6.0+2781+fed64c13
python2-babel AlmaLinux:8All versions2.5.1-10.module_el8.6.0+2781+fed64c13
python2-backports AlmaLinux:8All versions1.0-16.module_el8.6.0+2781+fed64c13
python2-backports AlmaLinux:8All versions1.0-16.module_el8.6.0+3162+01a09e5a
python2-backports-ssl_match_hostname AlmaLinux:8All versions3.5.0.1-12.module_el8.6.0+2781+fed64c13
python2-bson AlmaLinux:8All versions3.7.0-1.module_el8.6.0+2781+fed64c13
python2-bson AlmaLinux:8All versions3.7.0-1.module_el8.6.0+3162+01a09e5a
python2-chardet AlmaLinux:8All versions3.0.4-10.module_el8.6.0+2781+fed64c13
python2-coverage AlmaLinux:8All versions4.5.1-4.module_el8.6.0+2781+fed64c13
python2-coverage AlmaLinux:8All versions4.5.1-4.module_el8.6.0+3162+01a09e5a
python2-debug AlmaLinux:8All versions2.7.18-13.module_el8.8.0+3663+627ce7bb.2.alma.1
python2-devel AlmaLinux:8All versions2.7.18-13.module_el8.8.0+3663+627ce7bb.2.alma.1
python2-dns AlmaLinux:8All versions1.15.0-10.module_el8.6.0+2781+fed64c13
python2-docs AlmaLinux:8All versions2.7.16-2.module_el8.6.0+2781+fed64c13
python2-docs-info AlmaLinux:8All versions2.7.16-2.module_el8.6.0+2781+fed64c13
python2-docutils AlmaLinux:8All versions0.14-12.module_el8.6.0+2781+fed64c13
python2-funcsigs AlmaLinux:8All versions1.0.2-13.module_el8.6.0+2781+fed64c13
python2-idna AlmaLinux:8All versions2.5-7.module_el8.6.0+2781+fed64c13
python2-ipaddress AlmaLinux:8All versions1.0.18-6.module_el8.6.0+2781+fed64c13
python2-jinja2 AlmaLinux:8All versions2.10-9.module_el8.6.0+2781+fed64c13
python2-libs AlmaLinux:8All versions2.7.18-13.module_el8.8.0+3663+627ce7bb.2.alma.1
python2-lxml AlmaLinux:8All versions4.2.3-6.module_el8.6.0+2781+fed64c13
python2-lxml AlmaLinux:8All versions4.2.3-6.module_el8.6.0+3162+01a09e5a
python2-markupsafe AlmaLinux:8All versions0.23-19.module_el8.6.0+2781+fed64c13
python2-markupsafe AlmaLinux:8All versions0.23-19.module_el8.6.0+3162+01a09e5a

Products include Python Python.

How do I fix CVE-2023-40217?

Upgrade libpython to a fixed version for your release line: 3.8.18, 3.9.18, 3.10.13 or 3.11.5.

Is CVE-2023-40217 being exploited?

There is no known exploitation of CVE-2023-40217 in the wild and no public exploit code.

All Python Python vulnerabilities

Sources

Also known as ALPINE-CVE-2023-40217, ALSA-2023:5456, ALSA-2023:5462, ALSA-2023:5463, ALSA-2023:5994, ALSA-2023:5997 and 58 more.

Is CVE-2023-40217 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free