CVE-2016-9015
Description
Versions 1.17 and 1.18 of the Python urllib3 library suffer from a vulnerability that can cause them, in certain configurations, to not correctly validate TLS certificates. This places users of the library with those configurations at risk of man-in-the-middle and information leakage attacks. This vulnerability affects users using versions 1.17 and 1.18 of the urllib3 library, who are using the optional PyOpenSSL support for TLS instead of the regular standard library TLS backend, and who are using OpenSSL 1.1.0 via PyOpenSSL. This is an extremely uncommon configuration, so the security impact of this vulnerability is low.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
urllib3PyPI | >= 1.17, < 1.18.1 | 1.18.1 |
Affected products
2cpe:2.3:a:python:urllib3:1.17:*:*:*:*:*:*:*+ 1 more
- cpe:2.3:a:python:urllib3:1.17:*:*:*:*:*:*:*
- cpe:2.3:a:python:urllib3:1.18:*:*:*:*:*:*:*
Patches
1c32cdbc16a96CVE-2016-9015: Correct set verify flags.
1 file changed · +9 −4
urllib3/contrib/pyopenssl.py+9 −4 modified@@ -88,12 +88,15 @@ except AttributeError: pass -_openssl_verify = { +_stdlib_to_openssl_verify = { ssl.CERT_NONE: OpenSSL.SSL.VERIFY_NONE, ssl.CERT_OPTIONAL: OpenSSL.SSL.VERIFY_PEER, ssl.CERT_REQUIRED: OpenSSL.SSL.VERIFY_PEER + OpenSSL.SSL.VERIFY_FAIL_IF_NO_PEER_CERT, } +_openssl_to_stdlib_verify = dict( + (v, k) for k, v in _stdlib_to_openssl_verify.items() +) #: The list of supported SSL/TLS cipher suites. DEFAULT_SSL_CIPHER_LIST = util.ssl_.DEFAULT_CIPHERS.encode('ascii') @@ -367,11 +370,13 @@ def options(self, value): @property def verify_mode(self): - return self._ctx.get_verify_mode() + return _openssl_to_stdlib_verify[self._ctx.get_verify_mode()] @verify_mode.setter def verify_mode(self, value): - self._ctx.set_verify(value, _verify_callback) + self._ctx.set_verify( + _stdlib_to_openssl_verify[value], _verify_callback + ) def set_default_verify_paths(self): self._ctx.set_default_verify_paths() @@ -440,7 +445,7 @@ def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, if keyfile: ctx.use_privatekey_file(keyfile) if cert_reqs != ssl.CERT_NONE: - ctx.set_verify(_openssl_verify[cert_reqs], _verify_callback) + ctx.set_verify(_stdlib_to_openssl_verify[cert_reqs], _verify_callback) if ca_certs or ca_cert_dir: try: ctx.load_verify_locations(ca_certs, ca_cert_dir)
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
7- www.securityfocus.com/bid/93941nvdThird Party AdvisoryVDB Entry
- github.com/advisories/GHSA-v4w5-p2hg-8fh6ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2016-9015ghsaADVISORY
- www.openwall.com/lists/oss-security/2016/10/27/6nvdMailing ListMitigationWEB
- github.com/pypa/advisory-database/tree/main/vulns/urllib3/PYSEC-2017-98.yamlghsaWEB
- github.com/urllib3/urllib3/commit/c32cdbc16a9634fa0f8c829d1270301570158715ghsaWEB
- web.archive.org/web/20210123184150/http://www.securityfocus.com/bid/93941ghsaWEB
News mentions
0No linked articles in our index yet.