From b1b66396debbf9f9030deda817b31e0a447be549 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 22 Oct 2019 09:38:58 +0200 Subject: Fix CVE-2019-11043 env_path_info underflow in fpm_main.c --- failed.txt | 7 ++++--- php-bug78599.patch | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ php.spec | 9 +++++++-- 3 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 php-bug78599.patch diff --git a/failed.txt b/failed.txt index c100cd2..b6f9c2a 100644 --- a/failed.txt +++ b/failed.txt @@ -1,9 +1,9 @@ -===== 5.6.40-13 (2019-08-28) +===== 5.6.40-14 (2019-09-22) $ grep -r 'Tests failed' /var/lib/mock/scl56*/build.log /var/lib/mock/scl56el6x/build.log:Tests failed : 3 -/var/lib/mock/scl56el7x/build.log:Tests failed : 1 +/var/lib/mock/scl56el7x/build.log:Tests failed : 2 /var/lib/mock/scl56el8x/build.log:Tests failed : 28 /var/lib/mock/scl56fc29x/build.log:Tests failed : 3 /var/lib/mock/scl56fc30x/build.log:Tests failed : 3 @@ -16,9 +16,10 @@ el6x: 3 getmxrr() test [ext/standard/tests/network/getmxrr.phpt] el7x: 2 Bug #75457 (heap-use-after-free in php7.0.25) [ext/pcre/tests/bug75457.phpt] +el7x, fc29x, fc30x, fc31x: + openssl_error_string() tests [ext/openssl/tests/openssl_error_string_basic.phpt] fc29x, fc30x, fc31x: 2 substr_compare() [ext/standard/tests/strings/substr_compare.phpt] - openssl_error_string() tests [ext/openssl/tests/openssl_error_string_basic.phpt] 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..97b812e --- /dev/null +++ b/php-bug78599.patch @@ -0,0 +1,54 @@ +From c69bcb212b37900fd61daaf38762e4974cb4dcc9 Mon Sep 17 00:00:00 2001 +From: Jakub Zelenka +Date: Sat, 12 Oct 2019 15:56:16 +0100 +Subject: [PATCH 1/2] 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 d12ac01859..22b889c167 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -1245,8 +1245,8 @@ static void init_request_info(TSRMLS_D) + 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 8eeb2cf3d90e4b5ccb3371bf5379a786171a9ec9 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 22 Oct 2019 08:44:58 +0200 +Subject: [PATCH 2/2] add NEWS entry + +--- + NEWS | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/NEWS b/NEWS +index cb7919bafc..9d7b600cf0 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 9064849..38285a0 100644 --- a/php.spec +++ b/php.spec @@ -142,7 +142,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: %{?scl_prefix}php Version: 5.6.40 -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 @@ -222,7 +222,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 @@ -971,6 +971,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 # Fixes for tests %patch300 -p1 -b .datetests @@ -1916,6 +1917,10 @@ EOF %changelog +* Tue Oct 22 2019 Remi Collet - 5.6.40-14 +- FPM: + Fix CVE-2019-11043 env_path_info underflow in fpm_main.c + * Wed Aug 28 2019 Remi Collet - 5.6.40-13 - mbstring: Fix CVE-2019-13224 don't allow different encodings for onig_new_deluxe -- cgit