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

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


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

    Rel 53. 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 68a066f..a15a08a 100644
--- a/php.spec
+++ b/php.spec
@@ -140,7 +140,7 @@ ERROR: You need to select at least one Apache SAPI to build shared modules.
 %undefine	with_filter
 %endif
 
-%define		rel	52
+%define		rel	53
 %define		orgname	php
 %define		ver_suffix 55
 %define		php_suffix %{!?with_default_php:%{ver_suffix}}
@@ -477,6 +477,7 @@ Patch447:	php-cve-2026-128064.patch
 Patch448:	php-cve-2026-127960.patch
 Patch449:	php-cve-2026-129481.patch
 Patch450:	php-cve-2026-129289.patch
+Patch451:	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}
@@ -2604,6 +2605,7 @@ exit 1
 %patch -P448 -p1
 %patch -P449 -p1
 %patch -P450 -p1
+%patch -P451 -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..8fe3c1c
--- /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
+@@ -1542,14 +1542,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/25b3b5d5d053a4fcad3442bbccea3c766d46d2c2



More information about the pld-cvs-commit mailing list