mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-11-13 15:47:23 +00:00
nginx: fix CVE-2026-42946
These patches apply the upstream fix sequence as referenced in [3], using the commits shown in [1] and [2]. [1] https://github.com/nginx/nginx/commit/baef7fdac28e4e1fe26509b50b8d15603393e28e [2] https://github.com/nginx/nginx/commit/39d7d0ba0799fcff6baee52b6525f45739593cfd [3] https://nginx.org/en/security_advisories.html Signed-off-by: Hetvi Thakar <hthakar@cisco.com> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
1 parent
3c92a9dd3a
commit
c20a117ce1
4 files changed
+143
No files matched your search
@@ -0,0 +1,47 @@
|
||||
From baef7fdac28e4e1fe26509b50b8d15603393e28e Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Kandaurov <pluknet@nginx.com>
|
||||
Date: Wed, 29 Apr 2026 21:56:51 +0400
|
||||
Subject: [PATCH] Upstream: reset parsing state after invalid status line
|
||||
|
||||
Previously, it was possible to start parsing headers with a wrong
|
||||
parsing state after status line was not recognized, as a fallback
|
||||
used in the scgi and uwsgi modules.
|
||||
|
||||
Reported by Leo Lin.
|
||||
|
||||
CVE: CVE-2026-42946
|
||||
Upstream-Status: Backport [https://github.com/nginx/nginx/commit/baef7fdac28e4e1fe26509b50b8d15603393e28e]
|
||||
|
||||
(cherry picked from commit baef7fdac28e4e1fe26509b50b8d15603393e28e)
|
||||
Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
|
||||
---
|
||||
src/http/modules/ngx_http_scgi_module.c | 1 +
|
||||
src/http/modules/ngx_http_uwsgi_module.c | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
|
||||
index 49977b07b..038380798 100644
|
||||
--- a/src/http/modules/ngx_http_scgi_module.c
|
||||
+++ b/src/http/modules/ngx_http_scgi_module.c
|
||||
@@ -1029,6 +1029,7 @@ ngx_http_scgi_process_status_line(ngx_http_request_t *r)
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
u->process_header = ngx_http_scgi_process_header;
|
||||
+ r->state = 0;
|
||||
return ngx_http_scgi_process_header(r);
|
||||
}
|
||||
|
||||
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
|
||||
index c1d0035cc..05c08b6c4 100644
|
||||
--- a/src/http/modules/ngx_http_uwsgi_module.c
|
||||
+++ b/src/http/modules/ngx_http_uwsgi_module.c
|
||||
@@ -1266,6 +1266,7 @@ ngx_http_uwsgi_process_status_line(ngx_http_request_t *r)
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
u->process_header = ngx_http_uwsgi_process_header;
|
||||
+ r->state = 0;
|
||||
return ngx_http_uwsgi_process_header(r);
|
||||
}
|
||||
|
||||
--
|
||||
2.35.6
|
||||
@@ -0,0 +1,92 @@
|
||||
From 39d7d0ba0799fcff6baee52b6525f45739593cfd Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Kandaurov <pluknet@nginx.com>
|
||||
Date: Wed, 29 Apr 2026 23:02:20 +0400
|
||||
Subject: [PATCH] Upstream: fixed parsing of split status lines
|
||||
|
||||
If the first response line was split across reads and it didn't appear
|
||||
a status line, the portion already processed was lost. To preserve ABI,
|
||||
the change reuses r->header_name_start for proper backtracking on status
|
||||
line fallback.
|
||||
|
||||
CVE: CVE-2026-42946
|
||||
Upstream-Status: Backport [https://github.com/nginx/nginx/commit/39d7d0ba0799fcff6baee52b6525f45739593cfd]
|
||||
|
||||
(cherry picked from commit 39d7d0ba0799fcff6baee52b6525f45739593cfd)
|
||||
Signed-off-by: Hetvi Thakar <hthakar@cisco.com>
|
||||
---
|
||||
src/http/modules/ngx_http_proxy_module.c | 5 +++++
|
||||
src/http/modules/ngx_http_scgi_module.c | 5 +++++
|
||||
src/http/modules/ngx_http_uwsgi_module.c | 5 +++++
|
||||
3 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
|
||||
index 0778ec728..454ef6270 100644
|
||||
--- a/src/http/modules/ngx_http_proxy_module.c
|
||||
+++ b/src/http/modules/ngx_http_proxy_module.c
|
||||
@@ -1835,6 +1835,10 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
|
||||
|
||||
u = r->upstream;
|
||||
|
||||
+ if (r->state == 0) {
|
||||
+ r->header_name_start = u->buffer.pos;
|
||||
+ }
|
||||
+
|
||||
rc = ngx_http_parse_status_line(r, &u->buffer, &ctx->status);
|
||||
|
||||
if (rc == NGX_AGAIN) {
|
||||
@@ -1842,6 +1846,7 @@ ngx_http_proxy_process_status_line(ngx_http_request_t *r)
|
||||
}
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
+ u->buffer.pos = r->header_name_start;
|
||||
|
||||
#if (NGX_HTTP_CACHE)
|
||||
|
||||
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
|
||||
index 038380798..7477df317 100644
|
||||
--- a/src/http/modules/ngx_http_scgi_module.c
|
||||
+++ b/src/http/modules/ngx_http_scgi_module.c
|
||||
@@ -1021,6 +1021,10 @@ ngx_http_scgi_process_status_line(ngx_http_request_t *r)
|
||||
|
||||
u = r->upstream;
|
||||
|
||||
+ if (r->state == 0) {
|
||||
+ r->header_name_start = u->buffer.pos;
|
||||
+ }
|
||||
+
|
||||
rc = ngx_http_parse_status_line(r, &u->buffer, status);
|
||||
|
||||
if (rc == NGX_AGAIN) {
|
||||
@@ -1029,6 +1033,7 @@ ngx_http_scgi_process_status_line(ngx_http_request_t *r)
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
u->process_header = ngx_http_scgi_process_header;
|
||||
+ u->buffer.pos = r->header_name_start;
|
||||
r->state = 0;
|
||||
return ngx_http_scgi_process_header(r);
|
||||
}
|
||||
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
|
||||
index 05c08b6c4..d012f4fd4 100644
|
||||
--- a/src/http/modules/ngx_http_uwsgi_module.c
|
||||
+++ b/src/http/modules/ngx_http_uwsgi_module.c
|
||||
@@ -1258,6 +1258,10 @@ ngx_http_uwsgi_process_status_line(ngx_http_request_t *r)
|
||||
|
||||
u = r->upstream;
|
||||
|
||||
+ if (r->state == 0) {
|
||||
+ r->header_name_start = u->buffer.pos;
|
||||
+ }
|
||||
+
|
||||
rc = ngx_http_parse_status_line(r, &u->buffer, status);
|
||||
|
||||
if (rc == NGX_AGAIN) {
|
||||
@@ -1266,6 +1270,7 @@ ngx_http_uwsgi_process_status_line(ngx_http_request_t *r)
|
||||
|
||||
if (rc == NGX_ERROR) {
|
||||
u->process_header = ngx_http_uwsgi_process_header;
|
||||
+ u->buffer.pos = r->header_name_start;
|
||||
r->state = 0;
|
||||
return ngx_http_uwsgi_process_header(r);
|
||||
}
|
||||
--
|
||||
2.35.6
|
||||
@@ -3,6 +3,8 @@ require nginx.inc
|
||||
SRC_URI:append = " \
|
||||
file://CVE-2026-40701.patch \
|
||||
file://CVE-2026-42934.patch \
|
||||
file://CVE-2026-42946_p1.patch \
|
||||
file://CVE-2026-42946_p2.patch \
|
||||
"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=3dc49537b08b14c8b66ad247bb4c4593"
|
||||
|
||||
@@ -3,6 +3,8 @@ require nginx.inc
|
||||
SRC_URI:append = " \
|
||||
file://CVE-2026-40701.patch \
|
||||
file://CVE-2026-42934.patch \
|
||||
file://CVE-2026-42946_p1.patch \
|
||||
file://CVE-2026-42946_p2.patch \
|
||||
"
|
||||
|
||||
# 1.28.x branch is the current stable branch, the recommended default
|
||||
|
||||
Reference in new issue
Block a user