Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 711744 (CVE-2020-7212) - ~dev-python/urllib3-1.25.8: DoS in _encode_invalid_chars, scales poorly with input (CVE-2020-7212)
Summary: ~dev-python/urllib3-1.25.8: DoS in _encode_invalid_chars, scales poorly with...
Status: RESOLVED FIXED
Alias: CVE-2020-7212
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal trivial (vote)
Assignee: Gentoo Security
URL: https://github.com/urllib3/urllib3/pu...
Whiteboard: ~3 [noglsa cve]
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-06 21:15 UTC by Sam James
Modified: 2020-04-22 01:37 UTC (History)
4 users (show)

See Also:
Package list:
dev-python/urllib3-1.25.8 dev-python/trustme-0.6.0 dev-python/brotlipy-0.7.0
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-03-06 21:15:37 UTC
Description:
"The _encode_invalid_chars function in util/url.py in the urllib3 library 1.25.2 through 1.25.7 for Python allows a denial of service (CPU consumption) because of an inefficient algorithm. The percent_encodings array contains all matches of percent encodings. It is not deduplicated. For a URL of length N, the size of percent_encodings may be up to O(N). The next step (normalize existing percent-encoded bytes) also takes up to O(N) for each step, so the total time is O(N^2). If percent_encodings were deduplicated, the time to compute _encode_invalid_chars would be O(kN), where k is at most 484 ((10+6*2)^2)."

PR: https://github.com/urllib3/urllib3/pull/1787
Patch: https://github.com/urllib3/urllib3/pull/1787/commits/4ab10abde715c7098e77686462b987586825d228
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-03-07 04:45:37 UTC
Let's stabilize it where possible for a start.
Comment 2 Stabilization helper bot gentoo-dev 2020-03-07 05:01:21 UTC
An automated check of this bug failed - repoman reported dependency errors (110 lines truncated): 

> dependency.bad dev-python/urllib3/urllib3-1.25.8.ebuild: BDEPEND: amd64(default/linux/amd64/17.0) ['>=dev-python/trustme-0.5.3[python_targets_pypy3(-)?,python_targets_python2_7(-)?,python_targets_python3_6(-)?,python_targets_python3_7(-)?,python_targets_python3_8(-)?,-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_6(-),-python_single_target_python3_7(-),-python_single_target_python3_8(-)]']
> dependency.bad dev-python/urllib3/urllib3-1.25.8.ebuild: BDEPEND: amd64(default/linux/amd64/17.0/desktop) ['>=dev-python/trustme-0.5.3[python_targets_pypy3(-)?,python_targets_python2_7(-)?,python_targets_python3_6(-)?,python_targets_python3_7(-)?,python_targets_python3_8(-)?,-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_6(-),-python_single_target_python3_7(-),-python_single_target_python3_8(-)]']
> dependency.bad dev-python/urllib3/urllib3-1.25.8.ebuild: BDEPEND: amd64(default/linux/amd64/17.0/desktop/gnome) ['>=dev-python/trustme-0.5.3[python_targets_pypy3(-)?,python_targets_python2_7(-)?,python_targets_python3_6(-)?,python_targets_python3_7(-)?,python_targets_python3_8(-)?,-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_6(-),-python_single_target_python3_7(-),-python_single_target_python3_8(-)]']
Comment 3 Stabilization helper bot gentoo-dev 2020-03-07 07:01:49 UTC
An automated check of this bug failed - repoman reported dependency errors (70 lines truncated): 

> dependency.bad dev-python/urllib3/urllib3-1.25.8.ebuild: BDEPEND: arm(default/linux/arm/17.0) ['dev-python/brotlipy[python_targets_pypy3(-)?,python_targets_python2_7(-)?,python_targets_python3_6(-)?,python_targets_python3_7(-)?,python_targets_python3_8(-)?,-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_6(-),-python_single_target_python3_7(-),-python_single_target_python3_8(-)]']
> dependency.bad dev-python/urllib3/urllib3-1.25.8.ebuild: RDEPEND: arm(default/linux/arm/17.0) ['dev-python/brotlipy[python_targets_pypy3(-)?,python_targets_python2_7(-)?,python_targets_python3_6(-)?,python_targets_python3_7(-)?,python_targets_python3_8(-)?,-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_6(-),-python_single_target_python3_7(-),-python_single_target_python3_8(-)]']
> dependency.bad dev-python/urllib3/urllib3-1.25.8.ebuild: RDEPEND: arm64(default/linux/arm64/17.0) ['dev-python/brotlipy[python_targets_pypy3(-)?,python_targets_python2_7(-)?,python_targets_python3_6(-)?,python_targets_python3_7(-)?,python_targets_python3_8(-)?,-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_6(-),-python_single_target_python3_7(-),-python_single_target_python3_8(-)]']
Comment 4 Stabilization helper bot gentoo-dev 2020-03-07 08:02:42 UTC
An automated check of this bug succeeded - the previous repoman errors are now resolved.
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2020-03-08 00:42:29 UTC
Just for the records: Current stable =dev-python/urllib3-1.24.2 was *not* affected. Vulnerability was introduced with commit https://github.com/urllib3/urllib3/commit/a74c9cfbaed9f811e7563cfc3dce894928e0221a (1.25.2).
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-03-09 16:54:38 UTC
Arch testers, if urllib3 fails tests due to resolver errors, you can either disable network-sandbox, add 'localhost.' (with a trailing dot) to /etc/hosts or use nss_myhostname.  I'm looking how to make it work properly with the default config.
Comment 7 Mart Raudsepp gentoo-dev 2020-03-12 14:09:41 UTC
dev-python/requests-2.21.0-r1 requires <urllib3-1.25 and is not part of the stabilization round here.
Please handle that via package list or dependent bugs, or skip this stabilization for now per comment #5 and drop the vulnerable ~arch versions instead.
Comment 8 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2020-03-14 18:20:36 UTC
arm stable
Comment 9 tt_1 2020-03-16 06:45:49 UTC
a suitable dev-python/requests should be added to the queue, I went for 2.22.0 on my stable arm in the meantime.
Comment 10 Agostino Sarubbo gentoo-dev 2020-03-25 14:26:18 UTC
amd64 stable
Comment 11 Agostino Sarubbo gentoo-dev 2020-03-25 15:51:15 UTC
x86 stable
Comment 12 Yury German Gentoo Infrastructure gentoo-dev 2020-04-05 23:41:29 UTC
This was also stable for ppc, ppc64, and spare. 
Are we stabilizing these as well, or are we going to drop them from stable?
Comment 13 Mart Raudsepp gentoo-dev 2020-04-08 06:09:21 UTC
requests stabling suitable for this urllib3 here appears to have happened in bug 714490 meanwhile
Comment 14 Mart Raudsepp gentoo-dev 2020-04-11 12:09:00 UTC
arm64 stable
Comment 15 NATTkA bot gentoo-dev 2020-04-11 12:12:30 UTC
Resetting sanity check; keywords are not fully specified and arches are not CC-ed.