Version in base suite: 3.7.3-2 Base version: python3.7_3.7.3-2 Target version: python3.7_3.7.3-2+deb10u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/p/python3.7/python3.7_3.7.3-2.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/p/python3.7/python3.7_3.7.3-2+deb10u1.dsc changelog | 11 ++ patches/CVE-2019-10160-1.diff | 59 +++++++++++++ patches/CVE-2019-10160-2.diff | 54 +++++++++++ patches/CVE-2019-16056.diff | 123 +++++++++++++++++++++++++++ patches/CVE-2019-16935.diff | 72 +++++++++++++++ patches/CVE-2019-9740_CVE-2019-9947.diff | 140 +++++++++++++++++++++++++++++++ patches/CVE-2019-9948.diff | 67 ++++++++++++++ patches/series | 6 + 8 files changed, 532 insertions(+) diff -Nru python3.7-3.7.3/debian/changelog python3.7-3.7.3/debian/changelog --- python3.7-3.7.3/debian/changelog 2019-04-03 05:39:12.000000000 +0000 +++ python3.7-3.7.3/debian/changelog 2019-12-20 17:01:46.000000000 +0000 @@ -1,3 +1,14 @@ +python3.7 (3.7.3-2+deb10u1) buster; urgency=medium + + * CVE-2019-9740 + * CVE-2019-9947 + * CVE-2019-9948 + * CVE-2019-10160 + * CVE-2019-16056 + * CVE-2019-16935 + + -- Moritz Mühlenhoff Fri, 20 Dec 2019 19:57:59 +0100 + python3.7 (3.7.3-2) unstable; urgency=medium * d/p/arm-alignment.diff: Don't allow unaligned memory accesses in the diff -Nru python3.7-3.7.3/debian/patches/CVE-2019-10160-1.diff python3.7-3.7.3/debian/patches/CVE-2019-10160-1.diff --- python3.7-3.7.3/debian/patches/CVE-2019-10160-1.diff 1970-01-01 00:00:00.000000000 +0000 +++ python3.7-3.7.3/debian/patches/CVE-2019-10160-1.diff 2019-12-20 16:57:53.000000000 +0000 @@ -0,0 +1,59 @@ +From 4d723e76e1ad17e9e7d5e828e59bb47e76f2174b Mon Sep 17 00:00:00 2001 +From: "Miss Islington (bot)" + <31488909+miss-islington@users.noreply.github.com> +Date: Tue, 30 Apr 2019 05:21:02 -0700 +Subject: [PATCH] bpo-36742: Fixes handling of pre-normalization characters in + urlsplit() (GH-13017) + +(cherry picked from commit d537ab0ff9767ef024f26246899728f0116b1ec3) + +Co-authored-by: Steve Dower +--- + Lib/test/test_urlparse.py | 6 ++++++ + Lib/urllib/parse.py | 11 +++++++---- + .../Security/2019-04-29-15-34-59.bpo-36742.QCUY0i.rst | 1 + + 3 files changed, 14 insertions(+), 4 deletions(-) + create mode 100644 Misc/NEWS.d/next/Security/2019-04-29-15-34-59.bpo-36742.QCUY0i.rst + +diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py +index e6638aee2244..c26235449461 100644 +--- a/Lib/test/test_urlparse.py ++++ b/Lib/test/test_urlparse.py +@@ -1001,6 +1001,12 @@ def test_urlsplit_normalization(self): + self.assertIn('\u2100', denorm_chars) + self.assertIn('\uFF03', denorm_chars) + ++ # bpo-36742: Verify port separators are ignored when they ++ # existed prior to decomposition ++ urllib.parse.urlsplit('http://\u30d5\u309a:80') ++ with self.assertRaises(ValueError): ++ urllib.parse.urlsplit('http://\u30d5\u309a\ufe1380') ++ + for scheme in ["http", "https", "ftp"]: + for c in denorm_chars: + url = "{}://netloc{}false.netloc/path".format(scheme, c) +diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py +index 1eec26e0f1f3..f5b3487ea9d6 100644 +--- a/Lib/urllib/parse.py ++++ b/Lib/urllib/parse.py +@@ -397,13 +397,16 @@ def _checknetloc(netloc): + # looking for characters like \u2100 that expand to 'a/c' + # IDNA uses NFKC equivalence, so normalize for this check + import unicodedata +- netloc2 = unicodedata.normalize('NFKC', netloc) +- if netloc == netloc2: ++ n = netloc.rpartition('@')[2] # ignore anything to the left of '@' ++ n = n.replace(':', '') # ignore characters already included ++ n = n.replace('#', '') # but not the surrounding text ++ n = n.replace('?', '') ++ netloc2 = unicodedata.normalize('NFKC', n) ++ if n == netloc2: + return +- _, _, netloc = netloc.rpartition('@') # anything to the left of '@' is okay + for c in '/?#@:': + if c in netloc2: +- raise ValueError("netloc '" + netloc2 + "' contains invalid " + ++ raise ValueError("netloc '" + netloc + "' contains invalid " + + "characters under NFKC normalization") + + def urlsplit(url, scheme='', allow_fragments=True): diff -Nru python3.7-3.7.3/debian/patches/CVE-2019-10160-2.diff python3.7-3.7.3/debian/patches/CVE-2019-10160-2.diff --- python3.7-3.7.3/debian/patches/CVE-2019-10160-2.diff 1970-01-01 00:00:00.000000000 +0000 +++ python3.7-3.7.3/debian/patches/CVE-2019-10160-2.diff 2019-12-20 16:57:53.000000000 +0000 @@ -0,0 +1,54 @@ +From 250b62acc59921d399f0db47db3b462cd6037e09 Mon Sep 17 00:00:00 2001 +From: "Miss Islington (bot)" + <31488909+miss-islington@users.noreply.github.com> +Date: Tue, 4 Jun 2019 09:15:13 -0700 +Subject: [PATCH] bpo-36742: Corrects fix to handle decomposition in usernames + (GH-13812) + +(cherry picked from commit 8d0ef0b5edeae52960c7ed05ae8a12388324f87e) + +Co-authored-by: Steve Dower +--- + Lib/test/test_urlparse.py | 11 ++++++----- + Lib/urllib/parse.py | 6 +++--- + 2 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py +index c26235449461..68f633ca3a7d 100644 +--- a/Lib/test/test_urlparse.py ++++ b/Lib/test/test_urlparse.py +@@ -1008,11 +1008,12 @@ def test_urlsplit_normalization(self): + urllib.parse.urlsplit('http://\u30d5\u309a\ufe1380') + + for scheme in ["http", "https", "ftp"]: +- for c in denorm_chars: +- url = "{}://netloc{}false.netloc/path".format(scheme, c) +- with self.subTest(url=url, char='{:04X}'.format(ord(c))): +- with self.assertRaises(ValueError): +- urllib.parse.urlsplit(url) ++ for netloc in ["netloc{}false.netloc", "n{}user@netloc"]: ++ for c in denorm_chars: ++ url = "{}://{}/path".format(scheme, netloc.format(c)) ++ with self.subTest(url=url, char='{:04X}'.format(ord(c))): ++ with self.assertRaises(ValueError): ++ urllib.parse.urlsplit(url) + + class Utility_Tests(unittest.TestCase): + """Testcase to test the various utility functions in the urllib.""" +diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py +index f5b3487ea9d6..4c8e77fe3912 100644 +--- a/Lib/urllib/parse.py ++++ b/Lib/urllib/parse.py +@@ -397,9 +397,9 @@ def _checknetloc(netloc): + # looking for characters like \u2100 that expand to 'a/c' + # IDNA uses NFKC equivalence, so normalize for this check + import unicodedata +- n = netloc.rpartition('@')[2] # ignore anything to the left of '@' +- n = n.replace(':', '') # ignore characters already included +- n = n.replace('#', '') # but not the surrounding text ++ n = netloc.replace('@', '') # ignore characters already included ++ n = n.replace(':', '') # but not the surrounding text ++ n = n.replace('#', '') + n = n.replace('?', '') + netloc2 = unicodedata.normalize('NFKC', n) + if n == netloc2: diff -Nru python3.7-3.7.3/debian/patches/CVE-2019-16056.diff python3.7-3.7.3/debian/patches/CVE-2019-16056.diff --- python3.7-3.7.3/debian/patches/CVE-2019-16056.diff 1970-01-01 00:00:00.000000000 +0000 +++ python3.7-3.7.3/debian/patches/CVE-2019-16056.diff 2019-12-20 16:57:53.000000000 +0000 @@ -0,0 +1,123 @@ +From c48d606adcef395e59fd555496c42203b01dd3e8 Mon Sep 17 00:00:00 2001 +From: "Miss Islington (bot)" + <31488909+miss-islington@users.noreply.github.com> +Date: Fri, 9 Aug 2019 01:30:33 -0700 +Subject: [PATCH] bpo-34155: Dont parse domains containing @ (GH-13079) + +Before: + + >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses + (Address(display_name='', username='a', domain='malicious.org'),) + + >>> parseaddr('a@malicious.org@important.com') + ('', 'a@malicious.org') + + After: + + >>> email.message_from_string('From: a@malicious.org@important.com', policy=email.policy.default)['from'].addresses + (Address(display_name='', username='', domain=''),) + + >>> parseaddr('a@malicious.org@important.com') + ('', 'a@') + +https://bugs.python.org/issue34155 +(cherry picked from commit 8cb65d1381b027f0b09ee36bfed7f35bb4dec9a9) + +Co-authored-by: jpic +--- + Lib/email/_header_value_parser.py | 2 ++ + Lib/email/_parseaddr.py | 11 ++++++++++- + Lib/test/test_email/test__header_value_parser.py | 10 ++++++++++ + Lib/test/test_email/test_email.py | 14 ++++++++++++++ + .../2019-05-04-13-33-37.bpo-34155.MJll68.rst | 1 + + 5 files changed, 37 insertions(+), 1 deletion(-) + create mode 100644 Misc/NEWS.d/next/Security/2019-05-04-13-33-37.bpo-34155.MJll68.rst + +diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py +index 801ae728dd136..c09f4f121ffb6 100644 +--- a/Lib/email/_header_value_parser.py ++++ b/Lib/email/_header_value_parser.py +@@ -1585,6 +1585,8 @@ def get_domain(value): + token, value = get_dot_atom(value) + except errors.HeaderParseError: + token, value = get_atom(value) ++ if value and value[0] == '@': ++ raise errors.HeaderParseError('Invalid Domain') + if leader is not None: + token[:0] = [leader] + domain.append(token) +diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py +index cdfa3729adc79..41ff6f8c000d5 100644 +--- a/Lib/email/_parseaddr.py ++++ b/Lib/email/_parseaddr.py +@@ -379,7 +379,12 @@ def getaddrspec(self): + aslist.append('@') + self.pos += 1 + self.gotonext() +- return EMPTYSTRING.join(aslist) + self.getdomain() ++ domain = self.getdomain() ++ if not domain: ++ # Invalid domain, return an empty address instead of returning a ++ # local part to denote failed parsing. ++ return EMPTYSTRING ++ return EMPTYSTRING.join(aslist) + domain + + def getdomain(self): + """Get the complete domain name from an address.""" +@@ -394,6 +399,10 @@ def getdomain(self): + elif self.field[self.pos] == '.': + self.pos += 1 + sdlist.append('.') ++ elif self.field[self.pos] == '@': ++ # bpo-34155: Don't parse domains with two `@` like ++ # `a@malicious.org@important.com`. ++ return EMPTYSTRING + elif self.field[self.pos] in self.atomends: + break + else: +diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py +index 9e862feab10c9..0f19f8bcc2e0f 100644 +--- a/Lib/test/test_email/test__header_value_parser.py ++++ b/Lib/test/test_email/test__header_value_parser.py +@@ -1448,6 +1448,16 @@ def test_get_addr_spec_dot_atom(self): + self.assertEqual(addr_spec.domain, 'example.com') + self.assertEqual(addr_spec.addr_spec, 'star.a.star@example.com') + ++ def test_get_addr_spec_multiple_domains(self): ++ with self.assertRaises(errors.HeaderParseError): ++ parser.get_addr_spec('star@a.star@example.com') ++ ++ with self.assertRaises(errors.HeaderParseError): ++ parser.get_addr_spec('star@a@example.com') ++ ++ with self.assertRaises(errors.HeaderParseError): ++ parser.get_addr_spec('star@172.17.0.1@example.com') ++ + # get_obs_route + + def test_get_obs_route_simple(self): +diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py +index c29cc56203b1f..aa775881c5521 100644 +--- a/Lib/test/test_email/test_email.py ++++ b/Lib/test/test_email/test_email.py +@@ -3041,6 +3041,20 @@ def test_parseaddr_empty(self): + self.assertEqual(utils.parseaddr('<>'), ('', '')) + self.assertEqual(utils.formataddr(utils.parseaddr('<>')), '') + ++ def test_parseaddr_multiple_domains(self): ++ self.assertEqual( ++ utils.parseaddr('a@b@c'), ++ ('', '') ++ ) ++ self.assertEqual( ++ utils.parseaddr('a@b.c@c'), ++ ('', '') ++ ) ++ self.assertEqual( ++ utils.parseaddr('a@172.17.0.1@c'), ++ ('', '') ++ ) ++ + def test_noquote_dump(self): + self.assertEqual( + utils.formataddr(('A Silly Person', 'person@dom.ain')), diff -Nru python3.7-3.7.3/debian/patches/CVE-2019-16935.diff python3.7-3.7.3/debian/patches/CVE-2019-16935.diff --- python3.7-3.7.3/debian/patches/CVE-2019-16935.diff 1970-01-01 00:00:00.000000000 +0000 +++ python3.7-3.7.3/debian/patches/CVE-2019-16935.diff 2019-12-20 16:57:53.000000000 +0000 @@ -0,0 +1,72 @@ +From 39a0c7555530e31c6941a78da19b6a5b61170687 Mon Sep 17 00:00:00 2001 +From: "Miss Islington (bot)" + <31488909+miss-islington@users.noreply.github.com> +Date: Fri, 27 Sep 2019 13:18:14 -0700 +Subject: [PATCH] bpo-38243, xmlrpc.server: Escape the server_title (GH-16373) + +Escape the server title of xmlrpc.server.DocXMLRPCServer +when rendering the document page as HTML. +(cherry picked from commit e8650a4f8c7fb76f570d4ca9c1fbe44e91c8dfaa) + +Co-authored-by: Dong-hee Na +--- + Lib/test/test_docxmlrpc.py | 16 ++++++++++++++++ + Lib/xmlrpc/server.py | 3 ++- + .../2019-09-25-13-21-09.bpo-38243.1pfz24.rst | 3 +++ + 3 files changed, 21 insertions(+), 1 deletion(-) + create mode 100644 Misc/NEWS.d/next/Security/2019-09-25-13-21-09.bpo-38243.1pfz24.rst + +diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py +index f077f05f5b4f7..38215659b67d9 100644 +--- a/Lib/test/test_docxmlrpc.py ++++ b/Lib/test/test_docxmlrpc.py +@@ -1,5 +1,6 @@ + from xmlrpc.server import DocXMLRPCServer + import http.client ++import re + import sys + import threading + from test import support +@@ -193,6 +194,21 @@ def test_annotations(self): + b'method_annotation(x: bytes)'), + response.read()) + ++ def test_server_title_escape(self): ++ # bpo-38243: Ensure that the server title and documentation ++ # are escaped for HTML. ++ self.serv.set_server_title('test_title