diff --git a/community/php8/APKBUILD b/community/php8/APKBUILD index 23d854acabb942ad1cc7c923ab0514169527310a..83d0adaf857c177bc3f4c22c3a2feab330b83a15 100644 --- a/community/php8/APKBUILD +++ b/community/php8/APKBUILD @@ -26,7 +26,7 @@ pkgname=php8 _pkgreal=php pkgver=8.0.19 -pkgrel=1 +pkgrel=2 _apiver=20200930 _suffix=${pkgname#php} # Is this package the default (latest) PHP version? @@ -103,6 +103,8 @@ source="https://php.net/distributions/$_pkgreal-$pkgver.tar.xz xfail-openssl-1.1-test.patch atomic-lsapi.patch fix-curl-7.83-test.patch + CVE-2022-31625.patch + CVE-2022-31626.patch " builddir="$srcdir/$_pkgreal-$pkgver" @@ -177,6 +179,9 @@ subpackages="$subpackages $pkgname-common::noarch" subpackages="$subpackages $pkgname-litespeed" # secfixes: +# 8.0.19-r2: +# - CVE-2022-31625 +# - CVE-2022-31626 # 8.0.13-r0: # - CVE-2021-21707 # 8.0.12-r0: @@ -633,4 +638,6 @@ f634ac591576dff87487d239578420364edb56e977535c4a5ab799d360a799179edf1e7e6a4e6b6e 996b9a542858b0385a300265194afc57eddb72b9d7e4dcdf63b4f1ba7d3588e67309030acc73f00af1717168becd50b1d3582fcb88605e9892fd683a33cae023 xfail-openssl-1.1-test.patch 465b38c089d938a4a072b2eff3edaf928455bf873f5eeb65ff3bee9614f5f45c70f285abb50809c2e2d9d259395acae38bd649860ca3b8d65e43447082a51552 atomic-lsapi.patch be6a57063414bd255def54d5f6e42cbdc3baec55c8eaf9c8ca6e96d0cb3fec942ebb1868806850859d34c5c45d03a2abfec3fecd1aef04524da8eda01d9041ed fix-curl-7.83-test.patch +3a6ee3914b1a4e73caf19b40052cb70d1cd5716ed8b22cd83d57a52c0e6568b8960d65dba43e76cde5a19e56f318dc18d08dafb816ccd95dbc80534916a8b29a CVE-2022-31625.patch +e7b21f0dc7afdafe36d06818819e5f51e3b5031ba9261b9f578d8def9cd458ba6d2ce5c8f38833246082d4621766005984944e381e022f9c6d2bcb8e05459ae9 CVE-2022-31626.patch " diff --git a/community/php8/CVE-2022-31625.patch b/community/php8/CVE-2022-31625.patch new file mode 100644 index 0000000000000000000000000000000000000000..7f89dcb3558b55f22748db5b74af0087e5646c12 --- /dev/null +++ b/community/php8/CVE-2022-31625.patch @@ -0,0 +1,23 @@ +From 58006537fc5f133ae8549efe5118cde418b3ace9 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 + +--- + 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 87b2e7c31331..e4a298adaea4 100644 +--- a/ext/mysqlnd/mysqlnd_wireprotocol.c ++++ b/ext/mysqlnd/mysqlnd_wireprotocol.c +@@ -771,7 +771,8 @@ php_mysqlnd_change_auth_response_write(MYSQLND_CONN_DATA * conn, void * _packet) + MYSQLND_VIO * vio = conn->vio; + MYSQLND_STATS * stats = conn->stats; + MYSQLND_CONNECTION_STATE * connection_state = &conn->state; +- zend_uchar * const buffer = pfc->cmd_buffer.length >= packet->auth_data_len? pfc->cmd_buffer.buffer : mnd_emalloc(packet->auth_data_len); ++ size_t total_packet_size = packet->auth_data_len + MYSQLND_HEADER_SIZE; ++ zend_uchar * const buffer = pfc->cmd_buffer.length >= total_packet_size? pfc->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/community/php8/CVE-2022-31626.patch b/community/php8/CVE-2022-31626.patch new file mode 100644 index 0000000000000000000000000000000000000000..7c8770bd2be544c0ae4d70995b3204ad60b87a47 --- /dev/null +++ b/community/php8/CVE-2022-31626.patch @@ -0,0 +1,65 @@ +From 55f6895f4b4c677272fd4ee1113acdbd99c4b5ab Mon Sep 17 00:00:00 2001 +From: "Christoph M. Becker" <cmbecker69@gmx.de> +Date: Tue, 17 May 2022 12:59:23 +0200 +Subject: [PATCH] Fix #81720: Uninitialized array in pg_query_params() leading + to RCE + +We must not free parameters which we haven't initialized yet. + +We also fix the not directly related issue, that we checked for the +wrong value being `NULL`, potentially causing a segfault. +--- + ext/pgsql/pgsql.c | 6 +++--- + ext/pgsql/tests/bug81720.phpt | 27 +++++++++++++++++++++++++++ + 2 files changed, 30 insertions(+), 3 deletions(-) + create mode 100644 ext/pgsql/tests/bug81720.phpt + +diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c +index f52ff884d83c..7dcd56cf1441 100644 +--- a/ext/pgsql/pgsql.c ++++ b/ext/pgsql/pgsql.c + params[i] = estrndup(Z_STRVAL(tmp_val), Z_STRLEN(tmp_val)); +@@ -3920,8 +3920,8 @@ PHP_FUNCTION(pg_send_execute) + params[i] = NULL; + } else { + zend_string *tmp_str = zval_try_get_string(tmp); +- if (UNEXPECTED(!tmp)) { +- _php_pgsql_free_params(params, num_params); ++ if (UNEXPECTED(!tmp_str)) { ++ _php_pgsql_free_params(params, i); + return; + } + params[i] = estrndup(ZSTR_VAL(tmp_str), ZSTR_LEN(tmp_str)); +diff --git a/ext/pgsql/tests/bug81720.phpt b/ext/pgsql/tests/bug81720.phpt +new file mode 100644 +index 000000000000..d79f1fcdd612 +--- /dev/null ++++ b/ext/pgsql/tests/bug81720.phpt +@@ -0,0 +1,27 @@ ++--TEST-- ++Bug #81720 (Uninitialized array in pg_query_params() leading to RCE) ++--SKIPIF-- ++<?php include("skipif.inc"); ?> ++--FILE-- ++<?php ++include('config.inc'); ++ ++$conn = pg_connect($conn_str); ++ ++try { ++ pg_query_params($conn, 'SELECT $1, $2', [1, new stdClass()]); ++} catch (Throwable $ex) { ++ echo $ex->getMessage(), PHP_EOL; ++} ++ ++try { ++ pg_send_prepare($conn, "my_query", 'SELECT $1, $2'); ++ pg_get_result($conn); ++ pg_send_execute($conn, "my_query", [1, new stdClass()]); ++} catch (Throwable $ex) { ++ echo $ex->getMessage(), PHP_EOL; ++} ++?> ++--EXPECT-- ++Object of class stdClass could not be converted to string ++Object of class stdClass could not be converted to string