From 8cc6ce82b5e8c2065214cd551f1ae4f9edd45c6e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 22 Oct 2019 09:45:46 +0200 Subject: Fix CVE-2019-11043 env_path_info underflow in fpm_main.c --- failed.txt | 7 ++++--- php-bug78599.patch | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ php56.spec | 8 +++++++- 3 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 php-bug78599.patch diff --git a/failed.txt b/failed.txt index 5020e80..a58f5e4 100644 --- a/failed.txt +++ b/failed.txt @@ -1,17 +1,18 @@ -===== 5.6.40-13 (2019-08-28) +===== 5.6.40-14 (2019-09-22) $ grep -r 'Tests failed' /var/lib/mock/*/build.log -/var/lib/mock/el6i/build.log:Tests failed : 2 +/var/lib/mock/el6i/build.log:Tests failed : 3 /var/lib/mock/el6x/build.log:Tests failed : 0 /var/lib/mock/el7x/build.log:Tests failed : 2 el6i: + php://input is empty when enable_post_data_reading=Off [tests/basic/bug67198.phpt] 4 Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument. [ext/date/tests/date_sunrise_variation9.phpt] 4 Test getdate() function : usage variation - Passing high positive and negative float values to timestamp. [ext/date/tests/getdate_variation7.phpt] el7x: - TLSv1.1 and TLSv1.2 bitwise stream crypto flag assignment [ext/openssl/tests/stream_crypto_flags_002.phpt] + openssl_error_string() tests [ext/openssl/tests/openssl_error_string_basic.phpt] 2 Bug #75457 (heap-use-after-free in php7.0.25) [ext/pcre/tests/bug75457.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/php56.spec b/php56.spec index 4a50987..d00b93b 100644 --- a/php56.spec +++ b/php56.spec @@ -148,7 +148,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: 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 @@ -230,6 +230,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 @@ -1015,6 +1016,7 @@ echo CIBLE = %{name}-%{version}-%{release} oci8=%{with_oci8} libzip=%{with_libzi %patch224 -p1 -b .bug77919 %patch225 -p1 -b .bug75457 %patch226 -p1 -b .bug78380 +%patch227 -p1 -b .bug78599 # Fixes for tests %patch300 -p1 -b .datetests @@ -2067,6 +2069,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