From 91fb9e67870e51cc69fd08e588a153c5f7e186ed Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 22 Oct 2019 10:36:58 +0200 Subject: Fix CVE-2019-11043 env_path_info underflow in fpm_main.c --- failed.txt | 4 +++- php-bug78599.patch | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ php70.spec | 9 ++++++++- 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 php-bug78599.patch diff --git a/failed.txt b/failed.txt index 4969e41..e08fe56 100644 --- a/failed.txt +++ b/failed.txt @@ -4,9 +4,11 @@ $ grep -r 'Tests failed' /var/lib/mock/*/build.log /var/lib/mock/el6i/build.log:Tests failed : 0 /var/lib/mock/el6x/build.log:Tests failed : 0 -/var/lib/mock/el7x/build.log:Tests failed : 0 +/var/lib/mock/el7x/build.log:Tests failed : 1 +el7x: + Bug #75457 (heap-use-after-free in php7.0.25) [ext/pcre/tests/bug75457.phpt] 1 proc_open give erratic test results :( 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/php70.spec b/php70.spec index 58a796c..1dfbed7 100644 --- a/php70.spec +++ b/php70.spec @@ -114,7 +114,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: 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 @@ -200,6 +200,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 @@ -447,6 +448,7 @@ Provides: php-zts-devel%{?_isa} = %{version}-%{release} %endif %if 0%{?rhel} Obsoletes: php53-devel, php53u-devel, php54-devel, php54w-devel, php55u-devel, php55w-devel, php56u-devel, php56w-devel, php70u-devel, php70w-devel +Obsoletes: php55u-pecl-jsonc-devel, php56u-pecl-jsonc-devel %endif %description devel @@ -1080,6 +1082,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 %if 0%{?fedora} >= 21 || 0%{?rhel} >= 5 @@ -2114,6 +2117,10 @@ fi %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