mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-35746: Fix segfault in ssl's cert parser (GH-11569)
Fix a NULL pointer deref in ssl module. The cert parser did not handle CRL distribution points with empty DP or URI correctly. A malicious or buggy certificate can result into segfault. Signed-off-by: Christian Heimes <christian@python.org> https://bugs.python.org/issue35746
This commit is contained in:
parent
c9f872b0bd
commit
a37f52436f
4 changed files with 51 additions and 0 deletions
|
@ -115,6 +115,7 @@ NONEXISTINGCERT = data_file("XXXnonexisting.pem")
|
|||
BADKEY = data_file("badkey.pem")
|
||||
NOKIACERT = data_file("nokia.pem")
|
||||
NULLBYTECERT = data_file("nullbytecert.pem")
|
||||
TALOS_INVALID_CRLDP = data_file("talos-2019-0758.pem")
|
||||
|
||||
DHFILE = data_file("ffdh3072.pem")
|
||||
BYTES_DHFILE = os.fsencode(DHFILE)
|
||||
|
@ -348,6 +349,27 @@ class BasicSocketTests(unittest.TestCase):
|
|||
self.assertEqual(p['crlDistributionPoints'],
|
||||
('http://SVRIntl-G3-crl.verisign.com/SVRIntlG3.crl',))
|
||||
|
||||
def test_parse_cert_CVE_2019_5010(self):
|
||||
p = ssl._ssl._test_decode_cert(TALOS_INVALID_CRLDP)
|
||||
if support.verbose:
|
||||
sys.stdout.write("\n" + pprint.pformat(p) + "\n")
|
||||
self.assertEqual(
|
||||
p,
|
||||
{
|
||||
'issuer': (
|
||||
(('countryName', 'UK'),), (('commonName', 'cody-ca'),)),
|
||||
'notAfter': 'Jun 14 18:00:58 2028 GMT',
|
||||
'notBefore': 'Jun 18 18:00:58 2018 GMT',
|
||||
'serialNumber': '02',
|
||||
'subject': ((('countryName', 'UK'),),
|
||||
(('commonName',
|
||||
'codenomicon-vm-2.test.lal.cisco.com'),)),
|
||||
'subjectAltName': (
|
||||
('DNS', 'codenomicon-vm-2.test.lal.cisco.com'),),
|
||||
'version': 3
|
||||
}
|
||||
)
|
||||
|
||||
def test_parse_cert_CVE_2013_4238(self):
|
||||
p = ssl._ssl._test_decode_cert(NULLBYTECERT)
|
||||
if support.verbose:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue