fix CVE-2020-11078

This commit is contained in:
wangxiao65 2020-07-20 15:55:11 +08:00
parent 31200f687f
commit 947ad8a5a0
2 changed files with 51 additions and 1 deletions

46
CVE-2020-11078.patch Normal file
View File

@ -0,0 +1,46 @@
From a1457cc31f3206cf691d11d2bf34e98865873e9e Mon Sep 17 00:00:00 2001
From: Sergey Shepelev <temotor@gmail.com>
Date: Wed, 20 May 2020 14:56:12 +0300
Subject: [PATCH] IMPORTANT security vulnerability CWE-93 CRLF injection
Force %xx quote of space, CR, LF characters in uri.
Special thanks to Recar https://github.com/Ciyfly for discrete notification.
https://cwe.mitre.org/data/definitions/93.html
---
python2/httplib2/__init__.py | 3 +++
python3/httplib2/__init__.py | 3 +++
2 files changed, 6 insertions(+)
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
index 97e06c1..34281b7 100644
--- a/python2/httplib2/__init__.py
+++ b/python2/httplib2/__init__.py
@@ -1985,6 +1985,9 @@ class Http(object):
headers["user-agent"] = "Python-httplib2/%s (gzip)" % __version__
uri = iri2uri(uri)
+ # Prevent CWE-75 space injection to manipulate request via part of uri.
+ # Prevent CWE-93 CRLF injection to modify headers via part of uri.
+ uri = uri.replace(" ", "%20").replace("\r", "%0D").replace("\n", "%0A")
(scheme, authority, request_uri, defrag_uri) = urlnorm(uri)
diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py
index 8785cc1..c0b1418 100644
--- a/python3/httplib2/__init__.py
+++ b/python3/httplib2/__init__.py
@@ -1790,6 +1790,9 @@ a string that contains the response entity body.
headers["user-agent"] = "Python-httplib2/%s (gzip)" % __version__
uri = iri2uri(uri)
+ # Prevent CWE-75 space injection to manipulate request via part of uri.
+ # Prevent CWE-93 CRLF injection to modify headers via part of uri.
+ uri = uri.replace(" ", "%20").replace("\r", "%0D").replace("\n", "%0A")
(scheme, authority, request_uri, defrag_uri) = urlnorm(uri)
--
2.23.0

View File

@ -1,10 +1,11 @@
Name: python-httplib2
Version: 0.13.1
Release: 4
Release: 5
Summary: Small, fast HTTP client library for Python.
License: MIT
URL: https://github.com/httplib2/httplib2
Source0: https://files.pythonhosted.org/packages/78/23/bb9606e87a66fd8c72a2b1a75b049d3859a122bc2648915be845bc44e04f/httplib2-0.13.1.tar.gz
Patch0001: CVE-2020-11078.patch
BuildRequires: python2-setuptools python2-devel
@ -71,6 +72,9 @@ popd
%endif
%changelog
* Mon Jul 20 2020 wangxiao <wangxiao65@huawei.com> - 0.13.1-5
- fix CVE-2020-11078
* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.13.1-4
- Delete the useless patch