[packages/php/PHP_5_2] Rel 53. Backport the 2026-11-19 PHP security fixes

arekm arekm at pld-linux.org
Thu Nov 19 18:54:55 CET 2026


commit 6290772074aaffacd95b9991cbf7cc8830e80c0a
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Nov 19 18:35:41 2026 +0100

    Rel 53. Backport the 2026-11-19 PHP security fixes
    
    Fixes CVE-2026-129538, CVE-2026-129506, CVE-2026-129496,
    CVE-2026-129481, CVE-2026-129291, CVE-2026-129289, CVE-2026-128064,
    CVE-2026-127960, CVE-2026-126714, CVE-2026-15353.

 CVE-2026-126714.patch |  22 ++++++++++
 CVE-2026-127960.patch | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++
 CVE-2026-128064.patch |  27 ++++++++++++
 CVE-2026-129289.patch |  38 +++++++++++++++++
 CVE-2026-129291.patch |  32 +++++++++++++++
 CVE-2026-129481.patch |  34 +++++++++++++++
 CVE-2026-129496.patch |  18 ++++++++
 CVE-2026-129506.patch |  18 ++++++++
 CVE-2026-129538.patch |  19 +++++++++
 CVE-2026-15353.patch  |  15 +++++++
 php.spec              |  24 ++++++++++-
 11 files changed, 358 insertions(+), 1 deletion(-)
---
diff --git a/php.spec b/php.spec
index 6a7f17f..41a6b87 100644
--- a/php.spec
+++ b/php.spec
@@ -112,7 +112,7 @@ ERROR: You need to select at least one Apache SAPI to build shared modules.
 %define		magic_mime	/usr/share/misc/magic.mime
 %endif
 
-%define		rel	52
+%define		rel	53
 %define		orgname	php
 %define		ver_suffix 52
 %define		php_suffix %{!?with_default_php:%{ver_suffix}}
@@ -237,6 +237,16 @@ Patch87:	pgsql.patch
 Patch88:	zip.patch
 Patch89:	xmlwriter.patch
 Patch90:	security-backports.patch
+Patch91:	CVE-2026-129538.patch
+Patch92:	CVE-2026-129496.patch
+Patch93:	CVE-2026-129291.patch
+Patch94:	CVE-2026-129289.patch
+Patch95:	CVE-2026-15353.patch
+Patch96:	CVE-2026-129506.patch
+Patch97:	CVE-2026-126714.patch
+Patch98:	CVE-2026-128064.patch
+Patch99:	CVE-2026-127960.patch
+Patch101:	CVE-2026-129481.patch
 # CENTALT patches
 # Backport from 5.3.6
 Patch311:	php-5.3.6-bug-47435.patch
@@ -2012,6 +2022,18 @@ done
 %patch -P311 -p1 -b .bug-47435
 %patch -P314 -p1 -b .bug-39199
 %patch -P90 -p1
+%patch -P91 -p1
+%patch -P92 -p1
+%if %{with fpm}
+%patch -P93 -p1
+%endif
+%patch -P94 -p1
+%patch -P95 -p1
+%patch -P96 -p1
+%patch -P97 -p1
+%patch -P98 -p1
+%patch -P99 -p1
+%patch -P101 -p1
 
 # security-backports.patch changes only the .re scanner sources, and the
 # Makefiles have regeneration rules for just two of these four
diff --git a/CVE-2026-126714.patch b/CVE-2026-126714.patch
new file mode 100644
index 0000000..0e91ade
--- /dev/null
+++ b/CVE-2026-126714.patch
@@ -0,0 +1,22 @@
+GHSA-fm2m-fjf5-v3cp (CVE-2026-126714): an interrupted session file write left the
+old session data behind the new prefix. From php-src
+41c0941ae27d1033129e0e09ce3af034ffee86ba.
+
+diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
+--- a/ext/session/mod_files.c
++++ b/ext/session/mod_files.c
+@@ -397,10 +397,10 @@ PS_WRITE_FUNC(files)
+ 		return FAILURE;
+ 	}
+ 
+-	/* Truncate file if the amount of new data is smaller than the existing data set. */
+-
+-	if (vallen < (int)data->st_size) {
+-		ftruncate(data->fd, 0);
++	/* An interrupted write must not leave the old data behind the new data. */
++	if (ftruncate(data->fd, 0) != 0) {
++		php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftruncate() failed: %s (%d)", strerror(errno), errno);
++		return FAILURE;
+ 	}
+ 
+ #if defined(HAVE_PWRITE)
diff --git a/CVE-2026-127960.patch b/CVE-2026-127960.patch
new file mode 100644
index 0000000..55d3fe2
--- /dev/null
+++ b/CVE-2026-127960.patch
@@ -0,0 +1,112 @@
+GHSA-mmf9-xm3v-hg2x (CVE-2026-127960): quadratic CPU use on a response header folded
+into many continuation lines. Same idea as php-src
+a303f697268d42f6671c9d4c479ff90bbf301db1, with a geometrically grown buffer because
+the 5.2 smart_str grows by a fixed 128 bytes.
+
+diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -167,24 +167,6 @@ static int php_url_same_origin(const php_url *a, const php_url *b, int default_p
+ 	return (a->port ? a->port : default_port) == (b->port ? b->port : default_port);
+ }
+ 
+-static ZEND_API char *zend_string_concat3(
+-		const char *str1, size_t str1_len,
+-		const char *str2, size_t str2_len,
+-		const char *str3, size_t str3_len,
+-    	size_t *new_len)
+-{
+-	size_t len = str1_len + str2_len + str3_len;
+-	char *res = (char *) emalloc(len + 1);
+-
+-	memcpy(res, str1, str1_len);
+-	memcpy(res + str1_len, str2, str2_len);
+-	memcpy(res + str1_len + str2_len, str3, str3_len);
+-	res[len] = '\0';
+-	if (new_len)
+-		*new_len = len;
+-	return res;
+-}
+-
+ typedef struct _php_stream_http_response_header_info {
+ 	php_stream_filter *transfer_encoding;
+ 	size_t file_size;
+@@ -240,7 +222,7 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ 		char *last_header_line_str, char *header_line, size_t *header_line_length,
+ 		int response_code, zval *response_header,
+ 		php_stream_http_response_header_info *header_info,
+-		size_t *last_header_line_len)
++		size_t *last_header_line_len, size_t *last_header_line_size)
+ {
+ 	size_t last_header_line_length;
+ 	char *last_header_line_end;
+@@ -266,7 +248,7 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ 		if (header_line && (*header_line == ' ' || *header_line == '\t')) {
+ 			char *http_folded_header_line = header_line;
+ 			size_t http_folded_header_line_length = *header_line_length;
+-			char *extended_header_str;
++			size_t extended_header_len;
+ 			/* Remove the leading white spaces. */
+ 			while (*http_folded_header_line == ' ' || *http_folded_header_line == '\t') {
+ 				http_folded_header_line++;
+@@ -276,14 +258,18 @@ static char *php_stream_http_response_headers_parse(php_stream_wrapper *wrapper,
+ 			 * php_stream_http_response_header_trim above. */
+ 			if(http_folded_header_line_length == 0 || http_folded_header_line_length > *header_line_length)
+ 				return NULL;
+-			/* Concatenate last header line, space and current header line. */
+-			extended_header_str = zend_string_concat3(
+-					last_header_line_str, last_header_line_length,
+-					" ", 1,
+-					http_folded_header_line, http_folded_header_line_length,
+-					last_header_line_len);
+-			efree(last_header_line_str);
+-			last_header_line_str = extended_header_str;
++			/* Append space and current header line to the last header line; the
++			 * buffer grows geometrically so many folded lines stay linear. */
++			extended_header_len = last_header_line_length + 1 + http_folded_header_line_length;
++			if (extended_header_len >= *last_header_line_size) {
++				*last_header_line_size = MAX(extended_header_len + 1, 2 * *last_header_line_size);
++				last_header_line_str = erealloc(last_header_line_str, *last_header_line_size);
++			}
++			last_header_line_str[last_header_line_length] = ' ';
++			memcpy(last_header_line_str + last_header_line_length + 1,
++					http_folded_header_line, http_folded_header_line_length);
++			last_header_line_str[extended_header_len] = '\0';
++			*last_header_line_len = extended_header_len;
+ 			/* Return new header line. */
+ 			return last_header_line_str;
+ 		}
+@@ -436,6 +422,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
+ 	char *http_header_line = NULL;
+ 	char *last_header_line_str = NULL;
+ 	size_t last_header_line_length = 0;
++	size_t last_header_line_size = 0;
+ 	php_stream_http_response_header_info header_info;
+ 	char tmp_line[128];
+ 	size_t chunk_size = 0;
+@@ -959,7 +946,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
+ 				last_header_line_str = php_stream_http_response_headers_parse(wrapper, stream,
+ 						context, options, last_header_line_str, http_header_line,
+ 						&http_header_line_length, response_code, response_header, &header_info,
+-						&last_header_line_length);
++						&last_header_line_length, &last_header_line_size);
+ 				if (EXPECTED(last_header_line_str == NULL)) {
+ 					if (UNEXPECTED(header_info.error)) {
+ 						php_stream_close(stream);
+@@ -992,6 +979,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
+ 			/* Save current line as the last line so it gets parsed in the next round. */
+ 			last_header_line_str = estrndup(http_header_line, http_header_line_length);
+ 			last_header_line_length = http_header_line_length;
++			last_header_line_size = http_header_line_length + 1;
+ 		} else {
+ 			break;
+ 		}
+@@ -1001,7 +989,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
+ 	if (last_header_line_str != NULL) {
+ 		php_stream_http_response_headers_parse(wrapper, stream, context, options,
+ 		last_header_line_str, NULL, NULL, response_code, response_header, &header_info,
+-		&last_header_line_length);
++		&last_header_line_length, &last_header_line_size);
+ 	}
+ 
+ 	if (!reqok || (header_info.location != NULL && header_info.follow_location)) {
diff --git a/CVE-2026-128064.patch b/CVE-2026-128064.patch
new file mode 100644
index 0000000..34709c1
--- /dev/null
+++ b/CVE-2026-128064.patch
@@ -0,0 +1,27 @@
+GHSA-f6gg-rchx-xw8j (CVE-2026-128064): HTTPS:// and FTPS:// (any upper case S) URLs
+were fetched in plaintext. From php-src cb68a63e8177f9dc25aba23c0d79c7da82ea69db.
+
+diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
+--- a/ext/standard/ftp_fopen_wrapper.c
++++ b/ext/standard/ftp_fopen_wrapper.c
+@@ -149,7 +149,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, char *path
+ 		return NULL;
+ 	}
+ 
+-	use_ssl = resource->scheme && (strlen(resource->scheme) > 3) && resource->scheme[3] == 's';
++	use_ssl = resource->scheme && !strcasecmp(resource->scheme, "ftps");
+ 
+ 	/* use port 21 if one wasn't specified */
+ 	if (resource->port == 0)
+diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
+--- a/ext/standard/http_fopen_wrapper.c
++++ b/ext/standard/http_fopen_wrapper.c
+@@ -492,7 +492,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
+ 			request_fulluri = zend_is_true(*tmpzval);
+ 		}
+ 
+-		use_ssl = resource->scheme && (strlen(resource->scheme) > 4) && resource->scheme[4] == 's';
++		use_ssl = resource->scheme && !strcasecmp(resource->scheme, "https");
+ 		/* choose default ports */
+ 		if (use_ssl && resource->port == 0)
+ 			resource->port = 443;
diff --git a/CVE-2026-129289.patch b/CVE-2026-129289.patch
new file mode 100644
index 0000000..d75681b
--- /dev/null
+++ b/CVE-2026-129289.patch
@@ -0,0 +1,38 @@
+GHSA-qc49-hpvq-g2w6 (CVE-2026-129289): on a kept FastCGI connection, unread bytes
+of a partly consumed STDIN record were parsed as the next request (request
+smuggling). fastcgi.c part of php-src 28014fd092c7acdafb9c074e735f099893a5ef66;
+5.2 has no lazy php://input stream, so the SAPI.c part does not apply.
+
+diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c
+--- a/sapi/cgi/fastcgi.c
++++ b/sapi/cgi/fastcgi.c
+@@ -683,6 +683,9 @@ static int fcgi_read_request(fcgi_request *req)
+ 	fcgi_header hdr;
+ 	int len, padding;
+ 	unsigned char buf[FCGI_MAX_LENGTH+8];
++	/* the previous request left part of a STDIN record unread: its bytes
++	 * must not be parsed as the next request on a kept connection */
++	int stdin_pending = req->in_len != 0;
+ 
+ 	req->keep = 0;
+ 	req->in_len = 0;
+@@ -690,6 +693,10 @@ static int fcgi_read_request(fcgi_request *req)
+ 	req->out_pos = req->out_buf;
+ 	zend_hash_init(&req->env, 0, NULL, (void (*)(void *)) fcgi_free_var, 1);
+ 
++	if (stdin_pending) {
++		return 0;
++	}
++
+ 	if (safe_read(req, &hdr, sizeof(fcgi_header)) != sizeof(fcgi_header) ||
+ 	    hdr.version < FCGI_VERSION_1) {
+ 		return 0;
+@@ -932,6 +939,8 @@ void fcgi_close(fcgi_request *req, int force, int destroy)
+ 		close(req->fd);
+ #endif
+ 		req->fd = -1;
++		/* a partially read STDIN record does not outlive its connection */
++		req->in_len = 0;
+ 
+ #if PHP_FASTCGI_PM
+ 		if (fpm) fpm_request_finished();
diff --git a/CVE-2026-129291.patch b/CVE-2026-129291.patch
new file mode 100644
index 0000000..4ecc197
--- /dev/null
+++ b/CVE-2026-129291.patch
@@ -0,0 +1,32 @@
+GHSA-jm4m-qfqx-967m (CVE-2026-129291): with catch_workers_output the fpm master
+closed a worker's stdio pipe without removing its libevent event and then freed
+the child record, leaving a dangling event. From php-src
+8c38b791449708540fd356ddc6927f463faeca91 (GH-24046 fix cd161267c0d2).
+
+diff --git a/sapi/cgi/fpm/fpm_children.c b/sapi/cgi/fpm/fpm_children.c
+--- a/sapi/cgi/fpm/fpm_children.c
++++ b/sapi/cgi/fpm/fpm_children.c
+@@ -64,7 +64,11 @@ static void fpm_child_close(struct fpm_child_s *child, int in_event_loop)
+ 			fpm_event_fire(&child->ev_stdout);
+ 		}
+ 		if (child->fd_stdout != -1) {
++			if (in_event_loop) {
++				fpm_event_del(&child->ev_stdout);
++			}
+ 			close(child->fd_stdout);
++			child->fd_stdout = -1;
+ 		}
+ 	}
+ 
+@@ -73,7 +77,11 @@ static void fpm_child_close(struct fpm_child_s *child, int in_event_loop)
+ 			fpm_event_fire(&child->ev_stderr);
+ 		}
+ 		if (child->fd_stderr != -1) {
++			if (in_event_loop) {
++				fpm_event_del(&child->ev_stderr);
++			}
+ 			close(child->fd_stderr);
++			child->fd_stderr = -1;
+ 		}
+ 	}
+ 
diff --git a/CVE-2026-129481.patch b/CVE-2026-129481.patch
new file mode 100644
index 0000000..ca73dbe
--- /dev/null
+++ b/CVE-2026-129481.patch
@@ -0,0 +1,34 @@
+GHSA-g3vh-838c-65v7 (CVE-2026-129481): a bailout in a module RSHUTDOWN left request
+state behind for the next request; 5.2 runs all RSHUTDOWNs under one zend_try, so
+a fatal error in session RSHUTDOWN (e.g. a user stream in $_SESSION failing in
+stream_close) also skipped ext/date's, and the next RINIT freed a stale
+DATEG(timezone). Zend part of php-src ad9b44ae611962c8b770ffc962ddff0c30d7d77c;
+5.2 session has no session_started_filename.
+
+diff --git a/Zend/zend_API.c b/Zend/zend_API.c
+--- a/Zend/zend_API.c
++++ b/Zend/zend_API.c
+@@ -29,6 +29,9 @@
+ #ifdef HAVE_STDARG_H
+ #include <stdarg.h>
+ #endif
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
+ 
+ /* these variables are true statics/globals, and have to be mutex'ed on every access */
+ static int module_count=0;
+@@ -1990,7 +1993,12 @@ int module_registry_cleanup(zend_module_entry *module TSRMLS_DC)
+ #if 0
+ 		zend_printf("%s:  Request shutdown\n", module->name);
+ #endif
+-		module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
++		zend_try {
++			module->request_shutdown_func(module->type, module->module_number TSRMLS_CC);
++		} zend_catch {
++			/* module shutdown is incomplete, its request state would leak into the next request */
++			_exit(1);
++		} zend_end_try();
+ 	}
+ 	return 0;
+ }
diff --git a/CVE-2026-129496.patch b/CVE-2026-129496.patch
new file mode 100644
index 0000000..bd2a1c9
--- /dev/null
+++ b/CVE-2026-129496.patch
@@ -0,0 +1,18 @@
+GHSA-gr4f-wgx5-jpfv (CVE-2026-129496): a diagnostic logged to error_log during
+startup leaves DATEG(tzcache) pointing at freed startup memory, an early request
+diagnostic (e.g. max_input_vars) then uses it. From php-src
+f986c5ca37c0fdc50595d8291a9920a1df23bf38 (main.c part).
+
+diff --git a/main/main.c b/main/main.c
+--- a/main/main.c
++++ b/main/main.c
+@@ -518,7 +518,8 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
+ 			char *error_time_str;
+ 
+ 			time(&error_time);
+-			error_time_str = php_format_date("d-M-Y H:i:s", 11, error_time, 1 TSRMLS_CC);
++			/* local time goes through DATEG(tzcache), which is stale outside an active request */
++			error_time_str = php_format_date("d-M-Y H:i:s", 11, error_time, PG(modules_activated) && EG(active) TSRMLS_CC);
+ 			len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL);
+ #ifdef PHP_WIN32
+ 			php_flock(fd, 2);
diff --git a/CVE-2026-129506.patch b/CVE-2026-129506.patch
new file mode 100644
index 0000000..a43b438
--- /dev/null
+++ b/CVE-2026-129506.patch
@@ -0,0 +1,18 @@
+GHSA-4646-p932-gw34 (CVE-2026-129506): SOAP use-after-free of DTD entity content
+referenced from attribute values. In 5.2 only soap_xmlParseFile() (WSDL and
+imported schemas) runs cleanup_xml_node(), so that is the affected path.
+From php-src 66db5cda7df3d7a0e1fc7b171bd9ca318fca49fb.
+
+diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
+--- a/ext/soap/php_xml.c
++++ b/ext/soap/php_xml.c
+@@ -53,6 +53,9 @@ static void cleanup_xml_node(xmlNodePtr node)
+ 				xmlUnlinkNode(trav);
+ 				xmlFreeNode(trav);
+ 			}
++		} else if (trav->type == XML_DTD_NODE) {
++			/* Attribute-value entity references can share content with the DTD.
++			 * Keep it alive until the document itself is freed. */
+ 		} else if ((trav->type != XML_ELEMENT_NODE) &&
+ 		           (trav->type != XML_CDATA_SECTION_NODE)) {
+ 			xmlUnlinkNode(trav);
diff --git a/CVE-2026-129538.patch b/CVE-2026-129538.patch
new file mode 100644
index 0000000..f02e968
--- /dev/null
+++ b/CVE-2026-129538.patch
@@ -0,0 +1,19 @@
+GHSA-5j3f-64r7-f564 (CVE-2026-129538): php-cgi out-of-bounds read and write
+during PATH_INFO correction when the stripped suffix is longer than PATH_INFO.
+From php-src 964cdcfa5adfa577cde97df89fc8fda04815694d.
+
+diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
+--- a/sapi/cgi/cgi_main.c
++++ b/sapi/cgi/cgi_main.c
+@@ -1073,9 +1073,9 @@ static void init_request_info(TSRMLS_D)
+ 						 */
+ 						int slen = len - strlen(pt);
+ 						int pilen = env_path_info ? strlen(env_path_info) : 0;
+-						char *path_info = env_path_info ? env_path_info + pilen - slen : NULL;
++						char *path_info = (env_path_info && pilen > slen) ? env_path_info + pilen - slen : NULL;
+ 
+-						if (orig_path_info != path_info) {
++						if (path_info && orig_path_info != path_info) {
+ 							if (orig_path_info) {
+ 								char old;
+ 
diff --git a/CVE-2026-15353.patch b/CVE-2026-15353.patch
new file mode 100644
index 0000000..0c4cf49
--- /dev/null
+++ b/CVE-2026-15353.patch
@@ -0,0 +1,15 @@
+GHSA-q23r-hr55-xmpg (CVE-2026-15353): SOAP arraySize without dimensions reads an
+uninitialized array position. From php-src 59e46404a744b7ef469f51acd3ee225d518dbaf8.
+
+diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
+--- a/ext/soap/php_encoding.c
++++ b/ext/soap/php_encoding.c
+@@ -2128,7 +2128,7 @@ static int calc_dimension_12(const char* str)
+ 		}
+ 		str++;
+ 	}
+-	return i;
++	return i != 0 ? i : 1;
+ }
+ 
+ static int* get_position_12(int dimension, const char* str)
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list