Projects
home:rottame:vhosts-ng:php80
php8
php8-CVE-2026-129292.patch
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File php8-CVE-2026-129292.patch of Package php8
From 1ecb92f2cdeb235bb10d6c220c9be4a13f527243 Mon Sep 17 00:00:00 2001 From: Jakub Zelenka <bukka@php.net> Date: Mon, 26 Oct 2026 20:10:08 +0100 Subject: [PATCH] Fix GHSA-3mg3-cr28-46gc: FPM XSS within status endpoint via user and script The fix for GHSA-7qg2-v9fj-4mwv escaped only the request URI and query string. The request method, auth user and script filename were still printed raw in the full status output. Escape all of them using a common helper. --- sapi/fpm/fpm/fpm_status.c | 98 +++++++++---------- .../tests/ghsa-3mg3-cr28-46gc-status-xss.phpt | 70 +++++++++++++ 2 files changed, 117 insertions(+), 51 deletions(-) create mode 100644 sapi/fpm/tests/ghsa-3mg3-cr28-46gc-status-xss.phpt Index: php-8.0.30/sapi/fpm/fpm/fpm_status.c =================================================================== --- php-8.0.30.orig/sapi/fpm/fpm/fpm_status.c +++ php-8.0.30/sapi/fpm/fpm/fpm_status.c @@ -45,6 +45,32 @@ int fpm_status_init_child(struct fpm_wor } /* }}} */ +static char *fpm_status_escape(const char *str, bool encode_html, bool encode_json, zend_string **tmp) +{ + char *escaped; + + *tmp = NULL; + if (str[0] == '\0') { + return NULL; + } + if (encode_html) { + *tmp = php_escape_html_entities_ex((const unsigned char *) str, strlen(str), 1, + ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT, NULL, /* double_encode */ 1, /* quiet */ 0); + return ZSTR_VAL(*tmp); + } + if (encode_json) { + *tmp = php_json_encode_string(str, strlen(str), PHP_JSON_INVALID_UTF8_IGNORE); + escaped = ZSTR_VAL(*tmp); + /* remove quotes around the string */ + if (ZSTR_LEN(*tmp) >= 2) { + escaped[ZSTR_LEN(*tmp) - 1] = '\0'; + ++escaped; + } + return escaped; + } + return (char *) str; +} + int fpm_status_export_to_zval(zval *status) { struct fpm_scoreboard_s scoreboard, *scoreboard_p; @@ -451,8 +477,10 @@ int fpm_status_handle_request(void) /* { if (full_syntax) { unsigned int i; int first; - zend_string *tmp_query_string, *tmp_request_uri_string; - char *query_string, *request_uri_string; + zend_string *tmp_request_method_string, *tmp_request_uri_string, *tmp_query_string; + zend_string *tmp_auth_user_string, *tmp_script_filename_string; + char *request_method_string, *request_uri_string, *query_string; + char *auth_user_string, *script_filename_string; struct timeval duration, now; float cpu; @@ -477,52 +505,11 @@ int fpm_status_handle_request(void) /* { } } - request_uri_string = NULL; - tmp_request_uri_string = NULL; - if (proc->request_uri[0] != '\0') { - if (encode) { - tmp_request_uri_string = php_escape_html_entities_ex( - (const unsigned char *) proc->request_uri, - strlen(proc->request_uri), 1, ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT, - NULL, /* double_encode */ 1, /* quiet */ 0); - request_uri_string = ZSTR_VAL(tmp_request_uri_string); - } else if (encode_json) { - tmp_request_uri_string = php_json_encode_string(proc->request_uri, - strlen(proc->request_uri), PHP_JSON_INVALID_UTF8_IGNORE); - request_uri_string = ZSTR_VAL(tmp_request_uri_string); - /* remove quotes around the string */ - if (ZSTR_LEN(tmp_request_uri_string) >= 2) { - request_uri_string[ZSTR_LEN(tmp_request_uri_string) - 1] = '\0'; - ++request_uri_string; - } - } else { - request_uri_string = proc->request_uri; - } - } - - query_string = NULL; - tmp_query_string = NULL; - if (proc->query_string[0] != '\0') { - if (encode) { - tmp_query_string = php_escape_html_entities_ex( - (const unsigned char *) proc->query_string, - strlen(proc->query_string), 1, ENT_DISALLOWED | ENT_HTML_DOC_XML1 | ENT_COMPAT, - NULL, /* double_encode */ 1, /* quiet */ 0); - } else if (encode_json) { - tmp_query_string = php_json_encode_string(proc->query_string, - strlen(proc->query_string), PHP_JSON_INVALID_UTF8_IGNORE); - } else { - query_string = proc->query_string; - } - if (tmp_query_string) { - query_string = ZSTR_VAL(tmp_query_string); - /* remove quotes around the string */ - if (encode_json && ZSTR_LEN(tmp_query_string) >= 2) { - query_string[ZSTR_LEN(tmp_query_string) - 1] = '\0'; - ++query_string; - } - } - } + request_method_string = fpm_status_escape(proc->request_method, encode, encode_json, &tmp_request_method_string); + request_uri_string = fpm_status_escape(proc->request_uri, encode, encode_json, &tmp_request_uri_string); + query_string = fpm_status_escape(proc->query_string, encode, encode_json, &tmp_query_string); + auth_user_string = fpm_status_escape(proc->auth_user, encode, encode_json, &tmp_auth_user_string); + script_filename_string = fpm_status_escape(proc->script_filename, encode, encode_json, &tmp_script_filename_string); /* prevent NaN */ if (proc->cpu_duration.tv_sec == 0 && proc->cpu_duration.tv_usec == 0) { @@ -544,25 +531,33 @@ int fpm_status_handle_request(void) /* { (unsigned long) (now_epoch - proc->start_epoch), proc->requests, duration.tv_sec * 1000000UL + duration.tv_usec, - proc->request_method[0] != '\0' ? proc->request_method : "-", + request_method_string ? request_method_string : "-", request_uri_string ? request_uri_string : "-", query_string ? "?" : "", query_string ? query_string : "", proc->content_length, - proc->auth_user[0] != '\0' ? proc->auth_user : "-", - proc->script_filename[0] != '\0' ? proc->script_filename : "-", + auth_user_string ? auth_user_string : "-", + script_filename_string ? script_filename_string : "-", proc->request_stage == FPM_REQUEST_ACCEPTING ? cpu : 0., proc->request_stage == FPM_REQUEST_ACCEPTING ? proc->memory : 0); PUTS(buffer); efree(buffer); + if (tmp_request_method_string) { + zend_string_free(tmp_request_method_string); + } if (tmp_request_uri_string) { zend_string_free(tmp_request_uri_string); } - if (tmp_query_string) { zend_string_free(tmp_query_string); } + if (tmp_auth_user_string) { + zend_string_free(tmp_auth_user_string); + } + if (tmp_script_filename_string) { + zend_string_free(tmp_script_filename_string); + } } if (full_post) {
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.