summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-06-23 08:29:01 +0200
committerRemi Collet <remi@php.net>2022-06-23 08:29:01 +0200
commit732417045101cb2248891981105c3749d01dba5a (patch)
treed89d105ab19b5c2a6185c772bb47f0caaa4ed8de
parentd86fc6e7b23f6fe389b22746f775b93d5d80d0ca (diff)
myqlnd: fix #81719: mysqlnd/pdo password buffer overflow. CVE-2022-31626HEADmaster
-rw-r--r--bug77380.patch2
-rw-r--r--bug78599.patch33
-rw-r--r--bug81719.patch29
-rw-r--r--php.spec19
4 files changed, 78 insertions, 5 deletions
diff --git a/bug77380.patch b/bug77380.patch
index d3db7db..28c80bd 100644
--- a/bug77380.patch
+++ b/bug77380.patch
@@ -18,7 +18,7 @@ diff --git a/ext/xmlrpc/libxmlrpc/base64.c b/ext/xmlrpc/libxmlrpc/base64.c
index 5ebdf31f7ade..a4fa19327b76 100644
--- a/ext/xmlrpc/libxmlrpc/base64.c
+++ b/ext/xmlrpc/libxmlrpc/base64.c
-@@ -169,7 +169,7 @@ void base64_decode_xmlrpc(struct buffer_st *bfr, const char *source, int length)
+@@ -165,7 +165,7 @@ void base64_decode_xmlrpc(struct buffer_st *bfr, const char *source, int length)
return;
}
diff --git a/bug78599.patch b/bug78599.patch
new file mode 100644
index 0000000..b70a56d
--- /dev/null
+++ b/bug78599.patch
@@ -0,0 +1,33 @@
+Backported for 5.4 from:
+
+
+
+From c69bcb212b37900fd61daaf38762e4974cb4dcc9 Mon Sep 17 00:00:00 2001
+From: Jakub Zelenka <bukka@php.net>
+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
+@@ -1210,8 +1210,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) {
+
+
diff --git a/bug81719.patch b/bug81719.patch
new file mode 100644
index 0000000..37eda17
--- /dev/null
+++ b/bug81719.patch
@@ -0,0 +1,29 @@
+From 569b03f03929588741bb3dce5168d70805838143 Mon Sep 17 00:00:00 2001
+From: Stanislav Malyshev <smalyshev@gmail.com>
+Date: Mon, 6 Jun 2022 00:56:51 -0600
+Subject: [PATCH] Fix bug #81719: mysqlnd/pdo password buffer overflow
+
+(cherry picked from commit 58006537fc5f133ae8549efe5118cde418b3ace9)
+(cherry picked from commit 9433de72e291db518357fe55531cc15432d43ec4)
+(cherry picked from commit 1560224d3a26574f0195af3853e4d7e050b0b06f)
+(cherry picked from commit 5e1d9182748c5330c4bf2154da858206e76914b6)
+(cherry picked from commit 1f8f48703c7800b0e90344ccd73e74a1727f8a72)
+(cherry picked from commit e47e59289578140103efd03fcd58ea24776a6347)
+---
+ ext/mysqlnd/mysqlnd_wireprotocol.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
+index 844330fbf10..6e5c539d149 100644
+--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
++++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
+@@ -763,7 +763,8 @@ static size_t
+ php_mysqlnd_change_auth_response_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
+ {
+ MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *packet= (MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *) _packet;
+- zend_uchar * buffer = conn->net->cmd_buffer.length >= packet->auth_data_len? conn->net->cmd_buffer.buffer : mnd_emalloc(packet->auth_data_len);
++ size_t total_packet_size = packet->auth_data_len + MYSQLND_HEADER_SIZE;
++ zend_uchar * buffer = conn->net->cmd_buffer.length >= total_packet_size? conn->net->cmd_buffer.buffer : mnd_emalloc(total_packet_size);
+ zend_uchar *p = buffer + MYSQLND_HEADER_SIZE; /* start after the header */
+
+ DBG_ENTER("php_mysqlnd_change_auth_response_write");
diff --git a/php.spec b/php.spec
index 8509d51..49c7037 100644
--- a/php.spec
+++ b/php.spec
@@ -121,7 +121,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: %{?scl_prefix}php
Version: 5.4.45
-Release: 17%{?dist}
+Release: 19%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@@ -259,6 +259,8 @@ Patch273: bug77020.patch
Patch274: bug77231.patch
Patch275: bug77242.patch
Patch276: bug77380.patch
+Patch277: bug78599.patch
+Patch278: bug81719.patch
# Fixes for tests (300+)
# Backported from 5.5
@@ -976,6 +978,8 @@ support for using the enchant library to PHP.
%patch274 -p1 -b .bug77231
%patch275 -p1 -b .bug77242
%patch276 -p1 -b .bug77380
+%patch277 -p1 -b .bug78599
+%patch278 -p1 -b .bug81719
: ------------------------
#exit 1
@@ -990,7 +994,7 @@ support for using the enchant library to PHP.
%endif
# Prevent %%doc confusion over LICENSE files
-cp Zend/LICENSE Zend/ZEND_LICENSE
+cp Zend/LICENSE ZEND_LICENSE
cp TSRM/LICENSE TSRM_LICENSE
cp ext/ereg/regex/COPYRIGHT regex_COPYRIGHT
cp ext/gd/libgd/README libgd_README
@@ -1645,7 +1649,7 @@ cat << EOF
backported from 5.5 or 5.6,
The UPGRADE to a maintained version is very strongly RECOMMENDED.
-%if %{?fedora}%{!?fedora:99} < 26
+%if %{?fedora}%{!?fedora:99} < 28
WARNING : Fedora %{fedora} is now EOL :
You should consider upgrading to a supported release
%endif
@@ -1674,7 +1678,7 @@ EOF
%files common -f files.common
%defattr(-,root,root)
%doc CODING_STANDARDS CREDITS EXTENSIONS NEWS README*
-%license LICENSE Zend/ZEND_* TSRM_LICENSE regex_COPYRIGHT
+%license LICENSE ZEND_LICENSE TSRM_LICENSE regex_COPYRIGHT
%license libmagic_LICENSE
%license phar_LICENSE
%doc php.ini-*
@@ -1813,6 +1817,13 @@ EOF
%changelog
+* Thu Jun 23 2022 Remi Collet <remi@remirepo.net> - 5.4.45-19
+- myqlnd: fix #81719: mysqlnd/pdo password buffer overflow. CVE-2022-31626
+
+* Tue Oct 22 2019 Remi Collet <remi@remirepo.net> - 5.4.45-18
+- FPM:
+ Fix CVE-2019-11043 env_path_info underflow in fpm_main.c
+
* Fri Jan 11 2019 Remi Collet <remi@remirepo.net> - 5.4.45-17
- Fix #77242 heap out of bounds read in xmlrpc_decode
- Fix #77380 Global out of bounds read in xmlrpc base64 code