From 032107c8f3bb0d1f0e0941547615b5d1b72b87d8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 22 Oct 2019 10:36:19 +0200 Subject: Fix CVE-2019-11043 env_path_info underflow in fpm_main.c --- failed.txt | 8 +++++--- php-bug78599.patch | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ php.spec | 8 +++++++- 3 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 php-bug78599.patch diff --git a/failed.txt b/failed.txt index 2782518..faa72af 100644 --- a/failed.txt +++ b/failed.txt @@ -1,16 +1,18 @@ -===== 7.0.33-13 (2019-08-28) +===== 7.0.33-14 (2019-10-22) $ grep -r 'Tests failed' /var/lib/mock/scl70*/build.log /var/lib/mock/scl70el6x/build.log:Tests failed : 0 -/var/lib/mock/scl70el7x/build.log:Tests failed : 0 +/var/lib/mock/scl70el7x/build.log:Tests failed : 1 /var/lib/mock/scl70el8x/build.log:Tests failed : 28 /var/lib/mock/scl70fc29x/build.log:Tests failed : 1 /var/lib/mock/scl70fc30x/build.log:Tests failed : 1 /var/lib/mock/scl70fc31x/build.log:Tests failed : 1 -fc29x, fc30x: +el7x: + Bug #75457 (heap-use-after-free in php7.0.25) [ext/pcre/tests/bug75457.phpt] +fc29x, fc30x, fc31x: TLS server rate-limits client-initiated renegotiation [ext/openssl/tests/stream_server_reneg_limit.phpt] diff --git a/php-bug78599.patch b/php-bug78599.patch new file mode 100644 index 0000000..106b080 --- /dev/null +++ b/php-bug78599.patch @@ -0,0 +1,53 @@ +From 6e705460ff4f02358b9fb037169c53f4103a21b7 Mon Sep 17 00:00:00 2001 +From: Jakub Zelenka +Date: Sat, 12 Oct 2019 15:56:16 +0100 +Subject: [PATCH] Fix bug #78599 (env_path_info underflow can lead to RCE) + (CVE-2019-11043) + +cheery-picked from ab061f95ca966731b1c84cf5b7b20155c0a1c06a +without the test as tester not available +--- + sapi/fpm/fpm/fpm_main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c +index 695839cd9a..88c7c9f118 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -1208,8 +1208,8 @@ static void init_request_info(void) + path_info = script_path_translated + ptlen; + tflag = (slen != 0 && (!orig_path_info || strcmp(orig_path_info, path_info) != 0)); + } else { +- path_info = env_path_info ? env_path_info + pilen - slen : NULL; +- tflag = (orig_path_info != path_info); ++ path_info = (env_path_info && pilen > slen) ? env_path_info + pilen - slen : NULL; ++ tflag = path_info && (orig_path_info != path_info); + } + + if (tflag) { +From 8df4c9426c4810699e9290382d4e60453caa96e2 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 22 Oct 2019 08:41:53 +0200 +Subject: [PATCH] add NEWS entry + +--- + NEWS | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/NEWS b/NEWS +index a3c0c90143..b5a736947b 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,6 +1,12 @@ + PHP NEWS + ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| + ++Backported from 7.1.33 ++ ++- FPM: ++ . Fixed bug #78599 (env_path_info underflow in fpm_main.c can lead to RCE). ++ (CVE-2019-11043) (Jakub Zelenka) ++ + Backported from 7.1.32 + + - mbstring: diff --git a/php.spec b/php.spec index 5f07455..7de0254 100644 --- a/php.spec +++ b/php.spec @@ -137,7 +137,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: %{?scl_prefix}php Version: %{upver}%{?rcver:~%{rcver}} -Release: 13%{?dist} +Release: 14%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -229,6 +229,7 @@ Patch223: php-bug78256.patch Patch224: php-bug77919.patch Patch225: php-bug75457.patch Patch226: php-bug78380.patch +Patch227: php-bug78599.patch # Fixes for tests (300+) # Factory is droped from system tzdata @@ -997,6 +998,7 @@ sed -e 's/php-devel/%{?scl_prefix}php-devel/' -i scripts/phpize.in %patch224 -p1 -b .bug77919 %patch225 -p1 -b .bug75457 %patch226 -p1 -b .bug78380 +%patch227 -p1 -b .bug78599 : --------------------------- #exit 1 @@ -1949,6 +1951,10 @@ EOF %changelog +* Tue Oct 22 2019 Remi Collet - 7.0.33-14 +- FPM: + Fix CVE-2019-11043 env_path_info underflow in fpm_main.c + * Wed Aug 28 2019 Remi Collet - 7.0.33-13 - mbstring: Fix CVE-2019-13224 don't allow different encodings for onig_new_deluxe -- cgit