diff options
| author | Amy Fong <amy.fong@windriver.com> | 2014-05-07 14:20:09 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-05-08 14:30:03 -0400 |
| commit | fd1371e01ea808309b76a72cc9a161c72e148279 (patch) | |
| tree | c4a3063e4ec20cdea5589341b931cfe76d2dbde9 /meta-openstack/recipes-devtools/python/python-swift | |
| parent | f1875da73f07825ad468648c6d154478a8673089 (diff) | |
| download | meta-cloud-services-fd1371e01ea808309b76a72cc9a161c72e148279.tar.gz | |
CVE-2014-0006 Openstack Swift: TempURL timing attack
The TempURL middleware in OpenStack Object Storage (Swift) 1.4.6 through
1.8.0, 1.9.0 through 1.10.0, and 1.11.0 allows remote attackers to obtain
secret URLs by leveraging an object name and a timing side-channel attack.
Signed-off-by: Amy Fong <amy.fong@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-swift')
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch b/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch new file mode 100644 index 0000000..a284b5b --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | From b2c61375b3255486adb2900922a894dc7dad3c6d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Samuel Merritt <sam@swiftstack.com> | ||
| 3 | Date: Thu, 16 Jan 2014 13:44:23 +0100 | ||
| 4 | Subject: Use constant time comparison in tempURL | ||
| 5 | |||
| 6 | Use constant time comparison when evaluating tempURL to avoid timing | ||
| 7 | attacks (CVE-2014-0006). This is the havana backport of the master | ||
| 8 | patch. | ||
| 9 | |||
| 10 | Fixes bug 1265665 | ||
| 11 | |||
| 12 | Change-Id: I11e4ad83cc4077e52adf54a0bd0f9749294b2a48 | ||
| 13 | |||
| 14 | diff --git a/swift/common/middleware/tempurl.py b/swift/common/middleware/tempurl.py | ||
| 15 | index ffc1431..ae2f4a1 100644 | ||
| 16 | --- a/swift/common/middleware/tempurl.py | ||
| 17 | +++ b/swift/common/middleware/tempurl.py | ||
| 18 | @@ -98,7 +98,7 @@ from urlparse import parse_qs | ||
| 19 | |||
| 20 | from swift.proxy.controllers.base import get_account_info | ||
| 21 | from swift.common.swob import HeaderKeyDict | ||
| 22 | -from swift.common.utils import split_path | ||
| 23 | +from swift.common.utils import split_path, streq_const_time | ||
| 24 | |||
| 25 | |||
| 26 | #: Default headers to remove from incoming requests. Simply a whitespace | ||
| 27 | @@ -267,17 +267,20 @@ class TempURL(object): | ||
| 28 | if not keys: | ||
| 29 | return self._invalid(env, start_response) | ||
| 30 | if env['REQUEST_METHOD'] == 'HEAD': | ||
| 31 | - hmac_vals = self._get_hmacs(env, temp_url_expires, keys, | ||
| 32 | - request_method='GET') | ||
| 33 | - if temp_url_sig not in hmac_vals: | ||
| 34 | - hmac_vals = self._get_hmacs(env, temp_url_expires, keys, | ||
| 35 | - request_method='PUT') | ||
| 36 | - if temp_url_sig not in hmac_vals: | ||
| 37 | - return self._invalid(env, start_response) | ||
| 38 | + hmac_vals = (self._get_hmacs(env, temp_url_expires, keys, | ||
| 39 | + request_method='GET') + | ||
| 40 | + self._get_hmacs(env, temp_url_expires, keys, | ||
| 41 | + request_method='PUT')) | ||
| 42 | else: | ||
| 43 | hmac_vals = self._get_hmacs(env, temp_url_expires, keys) | ||
| 44 | - if temp_url_sig not in hmac_vals: | ||
| 45 | - return self._invalid(env, start_response) | ||
| 46 | + | ||
| 47 | + # While it's true that any() will short-circuit, this doesn't affect | ||
| 48 | + # the timing-attack resistance since the only way this will | ||
| 49 | + # short-circuit is when a valid signature is passed in. | ||
| 50 | + is_valid_hmac = any(streq_const_time(temp_url_sig, h) | ||
| 51 | + for h in hmac_vals) | ||
| 52 | + if not is_valid_hmac: | ||
| 53 | + return self._invalid(env, start_response) | ||
| 54 | self._clean_incoming_headers(env) | ||
| 55 | env['swift.authorize'] = lambda req: None | ||
| 56 | env['swift.authorize_override'] = True | ||
| 57 | -- | ||
| 58 | cgit v0.10.1 | ||
| 59 | |||
