From d0d97e334e041b6d44de8bb9f7f8e15a205241ef Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 23 Jun 2022 08:28:53 +0200 Subject: myqlnd: fix #81719: mysqlnd/pdo password buffer overflow. CVE-2022-31626 --- bug81719.patch | 29 +++++++++++++++++++++++++++++ php54.spec | 13 +++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 bug81719.patch 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 +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/php54.spec b/php54.spec index 0d706b5..8268146 100644 --- a/php54.spec +++ b/php54.spec @@ -99,7 +99,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: php Version: 5.4.45 -Release: 18%{?dist} +Release: 19%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -236,6 +236,7 @@ Patch274: bug77231.patch Patch275: bug77242.patch Patch276: bug77380.patch Patch277: bug78599.patch +Patch278: bug81719.patch # Fixes for tests # no_NO issue @@ -267,7 +268,7 @@ BuildRequires: pcre-devel >= 8.10 BuildRequires: bzip2, perl, libtool >= 1.4.3, gcc-c++ BuildRequires: libtool-ltdl-devel %if %{with_libzip} -BuildRequires: libzip-devel >= 0.10 +BuildRequires: libzip-devel = 0.10.1 %endif Obsoletes: php53, php53u, php54w @@ -1021,6 +1022,7 @@ rm -f ext/json/utf8_to_utf16.* %patch275 -p1 -b .bug77242 %patch276 -p1 -b .bug77380 %patch277 -p1 -b .bug78599 +%patch278 -p1 -b .bug81719 # Fixes for tests %patch301 -p1 -b .datetests2 @@ -1032,7 +1034,7 @@ rm -f ext/json/utf8_to_utf16.* %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 @@ -1786,7 +1788,7 @@ fi %files common -f files.common %defattr(-,root,root) %doc CODING_STANDARDS CREDITS EXTENSIONS LICENSE NEWS README* -%doc Zend/ZEND_* TSRM_LICENSE regex_COPYRIGHT +%doc ZEND_LICENSE TSRM_LICENSE regex_COPYRIGHT %doc libmagic_LICENSE %doc phar_LICENSE %doc php.ini-* @@ -1907,6 +1909,9 @@ fi %changelog +* Thu Jun 23 2022 Remi Collet - 5.4.45-19 +- myqlnd: fix #81719: mysqlnd/pdo password buffer overflow. CVE-2022-31626 + * Tue Oct 22 2019 Remi Collet - 5.4.45-18 - FPM: Fix CVE-2019-11043 env_path_info underflow in fpm_main.c -- cgit