From 29166e9b7a469a362474c6e424295a6af0b3667f Mon Sep 17 00:00:00 2001 From: Hetvi Thakar Date: Thu, 15 Oct 2026 20:20:54 -0700 Subject: [PATCH] nginx: fix CVE-2026-56434 This patch applies the upstream fix as referenced in [2], using the commit shown in [1]. [1] https://github.com/nginx/nginx/commit/ddde692db11ab8238e9ca661007f64c9f6d764d2 [2] https://nginx.org/en/security_advisories.html Signed-off-by: Hetvi Thakar Signed-off-by: Anuj Mittal --- .../nginx/files/CVE-2026-56434.patch | 71 +++++++++++++++++++ .../recipes-httpd/nginx/nginx_1.28.3.bb | 1 + .../recipes-httpd/nginx/nginx_1.29.7.bb | 1 + 3 files changed, 73 insertions(+) create mode 100644 meta-webserver/recipes-httpd/nginx/files/CVE-2026-56434.patch diff --git a/meta-webserver/recipes-httpd/nginx/files/CVE-2026-56434.patch b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-56434.patch new file mode 100644 index 0000000000..ccf19a7745 --- /dev/null +++ b/meta-webserver/recipes-httpd/nginx/files/CVE-2026-56434.patch @@ -0,0 +1,71 @@ +From ddde692db11ab8238e9ca661007f64c9f6d764d2 Mon Sep 17 00:00:00 2001 +From: Roman Arutyunyan +Date: Mon, 29 Jun 2026 21:49:27 +0400 +Subject: [PATCH] Avoid duplicate subrequest finalization + +Previously, if a subrequest was posted twice, it could be finalized in +both calls, excessively reducing r->main->count and potentially leading +to a use-after-free. + +The fix is to avoid posting a request if it's already posted. Also, +as a hardening measure, r->write_event_handler is now reset to a no-op +handler during active subrequest finalization. + +The problem manifests itself in ngx_http_ssi_filter_module during +unbuffered proxying. If a subrequest is created for an SSI include +statement while the main request has some data postponed by another +include, this subrequest becomes double-posted when the main request +data is flushed. The first post comes from ngx_http_subrequest() and +the second one comes from ngx_http_postpone_filter(). In case of a +quick subrequest finalization, the above mentioned problem happens. + +Reported by P4P3R-HAK. + +CVE: CVE-2026-56434 +Upstream-Status: Backport [https://github.com/nginx/nginx/commit/ddde692db11ab8238e9ca661007f64c9f6d764d2] + +(cherry picked from commit ddde692db11ab8238e9ca661007f64c9f6d764d2) +Signed-off-by: Hetvi Thakar +--- + src/http/ngx_http_request.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c +index ceac8d307..6dc275757 100644 +--- a/src/http/ngx_http_request.c ++++ b/src/http/ngx_http_request.c +@@ -2501,6 +2501,14 @@ ngx_http_post_request(ngx_http_request_t *r, ngx_http_posted_request_t *pr) + { + ngx_http_posted_request_t **p; + ++ for (p = &r->main->posted_requests; *p; p = &(*p)->next) { ++ if ((*p)->request == r) { ++ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, ++ "http request already posted"); ++ return NGX_OK; ++ } ++ } ++ + if (pr == NULL) { + pr = ngx_palloc(r->pool, sizeof(ngx_http_posted_request_t)); + if (pr == NULL) { +@@ -2511,8 +2519,6 @@ ngx_http_post_request(ngx_http_request_t *r, ngx_http_posted_request_t *pr) + pr->request = r; + pr->next = NULL; + +- for (p = &r->main->posted_requests; *p; p = &(*p)->next) { /* void */ } +- + *p = pr; + + return NGX_OK; +@@ -2632,6 +2638,8 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) + + r->main->count--; + ++ r->write_event_handler = ngx_http_request_empty_handler; ++ + if (pr->postponed && pr->postponed->request == r) { + pr->postponed = pr->postponed->next; + } +-- +2.35.6 diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb index bcceedf820..56050b84eb 100644 --- a/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb +++ b/meta-webserver/recipes-httpd/nginx/nginx_1.28.3.bb @@ -14,6 +14,7 @@ SRC_URI:append = " \ file://CVE-2026-42533_p3.patch \ file://CVE-2026-42533_p4.patch \ file://CVE-2026-42533_p5.patch \ + file://CVE-2026-56434.patch \ " LIC_FILES_CHKSUM = "file://LICENSE;md5=3dc49537b08b14c8b66ad247bb4c4593" diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb index 1e0b889dcd..68015a12fa 100644 --- a/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb +++ b/meta-webserver/recipes-httpd/nginx/nginx_1.29.7.bb @@ -14,6 +14,7 @@ SRC_URI:append = " \ file://CVE-2026-42533_p3.patch \ file://CVE-2026-42533_p4.patch \ file://CVE-2026-42533_p5.patch \ + file://CVE-2026-56434.patch \ " # 1.28.x branch is the current stable branch, the recommended default