+1. Thanks!<div><br></div><div>Which tests?<br><br>On Wednesday, April 4, 2018, Christian Heimes <<a href="mailto:christian@python.org">christian@python.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I like to share the story of a critical security bug with you. Contrary<br>
to other issues in TLS/SSL, it's a story with happy ending. Nobody was<br>
harmed. The bug was fixed before it affected the general population.<br>
<br>
<br>
Introduction<br>
------------<br>
<br>
Python's ssl.match_hostname() function was a source of several CVEs and<br>
other security bugs. After a long struggle, I decided to drop support<br>
for old OpenSSL releases and uses a new OpenSSL method to offload host<br>
name verification to OpenSSL. The improvement [1] eventually landed in<br>
Python 3.7. Nowadays OpenSSL verifies host name or IP address during the<br>
TLS/SSL handshake.<br>
<br>
Later I discovered that LibreSSL <= 2.6 did not have<br>
X509_VERIFY_PARAM_set1_host() [2]. We had to temporarily suspend support<br>
for LibreSSL. About two months later, LibreSSL caught up and released<br>
version 2.7.0 with support for the function.<br>
<br>
<br>
The bug<br>
-------<br>
<br>
One day after the release of LibreSSL 2.7.0, I started to port Python<br>
3.7 to LibreSSL. In matter of minutes I got the ssl module to compile<br>
and work with LibreSSL. All tests were passing -- except for negative<br>
the host name verification tests. LibreSSL was accepting all invalid<br>
host names as correct! Python's vigorous test suite had discovered a<br>
critical security bug in LibreSSL.<br>
<br>
It turned out that LibreSSL copied the implementation of<br>
X509_VERIFY_PARAM_set1_host(<wbr>param, name, namelen) from BoringSSL and the<br>
documentation from OpenSSL. BoringSSL's implementation didn't support<br>
the special case of 0 as namelen parammeter. OpenSSL supports namelen =<br>
0, which is interpreted as namelen=strlen(name). It is documented in<br>
OpenSSL's man page and was even recommended on OpenSSL's wiki as<br>
preferred way.<br>
<br>
<br>
Happy Ending<br>
------------<br>
<br>
So I got in contact with LibreSSL's security team and BoringSSL's<br>
security team [3]. Less than a day later, both libraries released fixes<br>
for the bug [4]. Mitre has assigned CVE-2018-8970 [5] to the bug.<br>
Disaster averted!<br>
<br>
BoringSSL's security issue [3] contains more information. Adam Langley<br>
lifted the restriction about an hour ago.<br>
<br>
I like to thank Bob Beck (LibreSSL), Adam Langley (Google) and David<br>
Benjamin (Google) for their assistance and cooperation.<br>
<br>
Regards,<br>
Christian<br>
<br>
[1] <a href="https://bugs.python.org/issue31399" target="_blank">https://bugs.python.org/<wbr>issue31399</a><br>
[2] <a href="https://github.com/libressl-portable/portable/issues/381" target="_blank">https://github.com/libressl-<wbr>portable/portable/issues/381</a><br>
[3] <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=824799" target="_blank">https://bugs.chromium.org/p/<wbr>chromium/issues/detail?id=<wbr>824799</a><br>
[4] <a href="https://www.libressl.org/releases.html" target="_blank">https://www.libressl.org/<wbr>releases.html</a><br>
[5] <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-8970" target="_blank">https://cve.mitre.org/cgi-bin/<wbr>cvename.cgi?name=CVE-2018-8970</a><br>
<br>
______________________________<wbr>_________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/wes.turner%40gmail.com" target="_blank">https://mail.python.org/<wbr>mailman/options/python-dev/<wbr>wes.turner%40gmail.com</a><br>
</blockquote></div>