mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-21 05:57:05 +00:00
3c1286f8b3
Pick patch accorting to [1]. [1] https://security-tracker.debian.org/tracker/CVE-2026-1642 Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 784fa05025cb8cd0c770f99bc79d2794b9f85b6e Mon Sep 17 00:00:00 2001
|
|
From: Roman Arutyunyan <arut@nginx.com>
|
|
Date: Thu, 29 Jan 2026 13:27:32 +0400
|
|
Subject: [PATCH] Upstream: detect premature plain text response from SSL
|
|
backend.
|
|
|
|
When connecting to a backend, the connection write event is triggered
|
|
first in most cases. However if a response arrives quickly enough, both
|
|
read and write events can be triggered together within the same event loop
|
|
iteration. In this case the read event handler is called first and the
|
|
write event handler is called after it.
|
|
|
|
SSL initialization for backend connections happens only in the write event
|
|
handler since SSL handshake starts with sending Client Hello. Previously,
|
|
if a backend sent a quick plain text response, it could be parsed by the
|
|
read event handler prior to starting SSL handshake on the connection.
|
|
The change adds protection against parsing such responses on SSL-enabled
|
|
connections.
|
|
|
|
CVE: CVE-2026-1642
|
|
Upstream-Status: Backport [https://github.com/nginx/nginx/commit/784fa05025cb8cd0c770f99bc79d2794b9f85b6e]
|
|
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
|
---
|
|
src/http/ngx_http_upstream.c | 9 +++++++++
|
|
1 file changed, 9 insertions(+)
|
|
|
|
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
|
|
index df577ad67..cadc74479 100644
|
|
--- a/src/http/ngx_http_upstream.c
|
|
+++ b/src/http/ngx_http_upstream.c
|
|
@@ -2441,6 +2441,15 @@ ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|
return;
|
|
}
|
|
|
|
+#if (NGX_HTTP_SSL)
|
|
+ if (u->ssl && c->ssl == NULL) {
|
|
+ ngx_log_error(NGX_LOG_ERR, c->log, 0,
|
|
+ "upstream prematurely sent response");
|
|
+ ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
|
|
+ return;
|
|
+ }
|
|
+#endif
|
|
+
|
|
u->state->bytes_received += n;
|
|
|
|
u->buffer.last += n;
|