[packages/php/PHP_5_4] Rel 57. Read the openssl_sign() result before freeing it

arekm arekm at pld-linux.org
Thu Nov 19 23:20:30 CET 2026


commit fe71b989fec589bedbbd83354f3424da65589578
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Nov 19 20:56:09 2026 +0100

    Rel 57. Read the openssl_sign() result before freeing it
    
    OpenSSL signed phar archives fell back to SHA-1 at random, because
    phar read the result of openssl_sign() from freed memory.

 php-phar-openssl-sign-uaf.patch | 22 ++++++++++++++++++++++
 php.spec                        |  4 +++-
 2 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/php.spec b/php.spec
index cb6d1bc..72e37af 100644
--- a/php.spec
+++ b/php.spec
@@ -138,7 +138,7 @@ ERROR: You need to select at least one Apache SAPI to build shared modules.
 %undefine	with_filter
 %endif
 
-%define		rel	56
+%define		rel	57
 %define		orgname	php
 %define		ver_suffix 54
 %define		php_suffix %{!?with_default_php:%{ver_suffix}}
@@ -538,6 +538,7 @@ Patch557:	php-cve-2026-128064.patch
 Patch558:	php-cve-2026-127960.patch
 Patch559:	php-http-response-header-leak.patch
 Patch560:	php-cve-2026-129481.patch
+Patch561:	php-phar-openssl-sign-uaf.patch
 URL:		https://www.php.net/
 %{?with_interbase:%{!?with_interbase_inst:BuildRequires:	Firebird-devel >= 1.0.2.908-2}}
 %{?with_pspell:BuildRequires:	aspell-devel >= 2:0.50.0}
@@ -2682,6 +2683,7 @@ cp -p php.ini-production php.ini
 %patch -P558 -p1
 %patch -P559 -p1
 %patch -P560 -p1
+%patch -P561 -p1
 
 # backports patch only the .re sources; date has no make rule and the
 # unserializer one is skipped silently when configure finds no re2c
diff --git a/php-phar-openssl-sign-uaf.patch b/php-phar-openssl-sign-uaf.patch
new file mode 100644
index 0000000..edcc67d
--- /dev/null
+++ b/php-phar-openssl-sign-uaf.patch
@@ -0,0 +1,22 @@
+PLD-only: phar_call_openssl_signverify() freed the openssl_sign() result
+before testing it, so OpenSSL phar signing randomly fell back to SHA-1.
+
+--- a/ext/phar/util.c
++++ b/ext/phar/util.c
+@@ -1813,14 +1813,15 @@ static int phar_call_openssl_signverify(
+ 			efree(retval_ptr);
+ 			return FAILURE;
+ 		case IS_BOOL:
+-			efree(retval_ptr);
+ 			if (Z_BVAL_P(retval_ptr)) {
++				efree(retval_ptr);
+ 				*signature = estrndup(Z_STRVAL_P(zsig), Z_STRLEN_P(zsig));
+ 				*signature_len = Z_STRLEN_P(zsig);
+ 				zval_dtor(zsig);
+ 				efree(zsig);
+ 				return SUCCESS;
+ 			}
++			efree(retval_ptr);
+ 			zval_dtor(zsig);
+ 			efree(zsig);
+ 			return FAILURE;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php.git/commitdiff/fe71b989fec589bedbbd83354f3424da65589578



More information about the pld-cvs-commit mailing list