diff options
| -rw-r--r-- | meta/recipes-devtools/python/python3/CVE-2016-1000110.patch | 129 | ||||
| -rw-r--r-- | meta/recipes-devtools/python/python3_3.5.1.bb | 1 |
2 files changed, 130 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3/CVE-2016-1000110.patch b/meta/recipes-devtools/python/python3/CVE-2016-1000110.patch new file mode 100644 index 0000000000..659dcb2f0c --- /dev/null +++ b/meta/recipes-devtools/python/python3/CVE-2016-1000110.patch | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | From 5e0700418dc27b645edbe33c744daff93cd66618 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Senthil Kumaran <senthil@uthcode.com> | ||
| 3 | Date: Sat, 30 Jul 2016 23:24:16 -0700 | ||
| 4 | Subject: [PATCH] Prevent HTTPoxy attack (CVE-2016-1000110) | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | Ignore the HTTP_PROXY variable when REQUEST_METHOD environment is set, which | ||
| 10 | indicates that the script is in CGI mode. | ||
| 11 | |||
| 12 | Issue #27568 Reported and patch contributed by Rémi Rampin. | ||
| 13 | |||
| 14 | Upstream-Status: Backport | ||
| 15 | CVE: CVE-2016-1000110 | ||
| 16 | |||
| 17 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
| 18 | |||
| 19 | --- | ||
| 20 | Doc/howto/urllib2.rst | 5 +++++ | ||
| 21 | Doc/library/urllib.request.rst | 13 +++++++++++++ | ||
| 22 | Lib/test/test_urllib.py | 13 +++++++++++++ | ||
| 23 | Lib/urllib/request.py | 7 +++++++ | ||
| 24 | Misc/NEWS | 4 ++++ | ||
| 25 | 5 files changed, 42 insertions(+) | ||
| 26 | |||
| 27 | Index: Python-3.5.1/Doc/howto/urllib2.rst | ||
| 28 | =================================================================== | ||
| 29 | --- Python-3.5.1.orig/Doc/howto/urllib2.rst | ||
| 30 | +++ Python-3.5.1/Doc/howto/urllib2.rst | ||
| 31 | @@ -538,6 +538,11 @@ setting up a `Basic Authentication`_ han | ||
| 32 | through a proxy. However, this can be enabled by extending urllib.request as | ||
| 33 | shown in the recipe [#]_. | ||
| 34 | |||
| 35 | +.. note:: | ||
| 36 | + | ||
| 37 | + `HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see | ||
| 38 | + the documentation on :func:`~urllib.request.getproxies`. | ||
| 39 | + | ||
| 40 | |||
| 41 | Sockets and Layers | ||
| 42 | ================== | ||
| 43 | Index: Python-3.5.1/Doc/library/urllib.request.rst | ||
| 44 | =================================================================== | ||
| 45 | --- Python-3.5.1.orig/Doc/library/urllib.request.rst | ||
| 46 | +++ Python-3.5.1/Doc/library/urllib.request.rst | ||
| 47 | @@ -166,6 +166,14 @@ The :mod:`urllib.request` module defines | ||
| 48 | cannot find it, looks for proxy information from Mac OSX System | ||
| 49 | Configuration for Mac OS X and Windows Systems Registry for Windows. | ||
| 50 | |||
| 51 | + .. note:: | ||
| 52 | + | ||
| 53 | + If the environment variable ``REQUEST_METHOD`` is set, which usually | ||
| 54 | + indicates your script is running in a CGI environment, the environment | ||
| 55 | + variable ``HTTP_PROXY`` (uppercase ``_PROXY``) will be ignored. This is | ||
| 56 | + because that variable can be injected by a client using the "Proxy:" HTTP | ||
| 57 | + header. If you need to use an HTTP proxy in a CGI environment use | ||
| 58 | + ``ProxyHandler`` explicitly. | ||
| 59 | |||
| 60 | The following classes are provided: | ||
| 61 | |||
| 62 | @@ -275,6 +283,11 @@ The following classes are provided: | ||
| 63 | |||
| 64 | To disable autodetected proxy pass an empty dictionary. | ||
| 65 | |||
| 66 | + .. note:: | ||
| 67 | + | ||
| 68 | + ``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; | ||
| 69 | + see the documentation on :func:`~urllib.request.getproxies`. | ||
| 70 | + | ||
| 71 | |||
| 72 | .. class:: HTTPPasswordMgr() | ||
| 73 | |||
| 74 | Index: Python-3.5.1/Lib/urllib/request.py | ||
| 75 | =================================================================== | ||
| 76 | --- Python-3.5.1.orig/Lib/urllib/request.py | ||
| 77 | +++ Python-3.5.1/Lib/urllib/request.py | ||
| 78 | @@ -2394,6 +2394,13 @@ def getproxies_environment(): | ||
| 79 | name = name.lower() | ||
| 80 | if value and name[-6:] == '_proxy': | ||
| 81 | proxies[name[:-6]] = value | ||
| 82 | + | ||
| 83 | + # CVE-2016-1000110 - If we are running as CGI script, forget HTTP_PROXY | ||
| 84 | + # (non-all-lowercase) as it may be set from the web server by a "Proxy:" | ||
| 85 | + # header from the client | ||
| 86 | + if 'REQUEST_METHOD' in os.environ: | ||
| 87 | + proxies.pop('http', None) | ||
| 88 | + | ||
| 89 | return proxies | ||
| 90 | |||
| 91 | def proxy_bypass_environment(host): | ||
| 92 | Index: Python-3.5.1/Misc/NEWS | ||
| 93 | =================================================================== | ||
| 94 | --- Python-3.5.1.orig/Misc/NEWS | ||
| 95 | +++ Python-3.5.1/Misc/NEWS | ||
| 96 | @@ -1266,6 +1266,10 @@ Library | ||
| 97 | lines from the code object, fixing an issue when a lambda function is used as | ||
| 98 | decorator argument. Patch by Thomas Ballinger and Allison Kaptur. | ||
| 99 | |||
| 100 | +- Issue #27568: Prevent HTTPoxy attack (CVE-2016-1000110). Ignore the | ||
| 101 | + HTTP_PROXY variable when REQUEST_METHOD environment is set, which indicates | ||
| 102 | + that the script is in CGI mode. | ||
| 103 | + | ||
| 104 | - Issue #24521: Fix possible integer overflows in the pickle module. | ||
| 105 | |||
| 106 | - Issue #22931: Allow '[' and ']' in cookie values. | ||
| 107 | Index: Python-3.5.1/Lib/test/test_urllib.py | ||
| 108 | =================================================================== | ||
| 109 | --- Python-3.5.1.orig/Lib/test/test_urllib.py | ||
| 110 | +++ Python-3.5.1/Lib/test/test_urllib.py | ||
| 111 | @@ -224,6 +224,18 @@ class ProxyTests(unittest.TestCase): | ||
| 112 | # List of no_proxies with space. | ||
| 113 | self.env.set('NO_PROXY', 'localhost, anotherdomain.com, newdomain.com') | ||
| 114 | self.assertTrue(urllib.request.proxy_bypass_environment('anotherdomain.com')) | ||
| 115 | + def test_proxy_cgi_ignore(self): | ||
| 116 | + try: | ||
| 117 | + self.env.set('HTTP_PROXY', 'http://somewhere:3128') | ||
| 118 | + proxies = urllib.request.getproxies_environment() | ||
| 119 | + self.assertEqual('http://somewhere:3128', proxies['http']) | ||
| 120 | + self.env.set('REQUEST_METHOD', 'GET') | ||
| 121 | + proxies = urllib.request.getproxies_environment() | ||
| 122 | + self.assertNotIn('http', proxies) | ||
| 123 | + finally: | ||
| 124 | + self.env.unset('REQUEST_METHOD') | ||
| 125 | + self.env.unset('HTTP_PROXY') | ||
| 126 | + | ||
| 127 | |||
| 128 | class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin, FakeFTPMixin): | ||
| 129 | """Test urlopen() opening a fake http connection.""" | ||
diff --git a/meta/recipes-devtools/python/python3_3.5.1.bb b/meta/recipes-devtools/python/python3_3.5.1.bb index 37ef26775b..f83a032bd3 100644 --- a/meta/recipes-devtools/python/python3_3.5.1.bb +++ b/meta/recipes-devtools/python/python3_3.5.1.bb | |||
| @@ -38,6 +38,7 @@ SRC_URI += "\ | |||
| 38 | file://setup.py-find-libraries-in-staging-dirs.patch \ | 38 | file://setup.py-find-libraries-in-staging-dirs.patch \ |
| 39 | file://use_packed_importlib.patch \ | 39 | file://use_packed_importlib.patch \ |
| 40 | file://configure.ac-fix-LIBPL.patch \ | 40 | file://configure.ac-fix-LIBPL.patch \ |
| 41 | file://CVE-2016-1000110.patch \ | ||
| 41 | " | 42 | " |
| 42 | SRC_URI[md5sum] = "e9ea6f2623fffcdd871b7b19113fde80" | 43 | SRC_URI[md5sum] = "e9ea6f2623fffcdd871b7b19113fde80" |
| 43 | SRC_URI[sha256sum] = "c6d57c0c366d9060ab6c0cdf889ebf3d92711d466cc0119c441dbf2746f725c9" | 44 | SRC_URI[sha256sum] = "c6d57c0c366d9060ab6c0cdf889ebf3d92711d466cc0119c441dbf2746f725c9" |
