Skip to contentSkip to conversation

nginx: Backport fix for CVE-2024-7347

PATCH New Ashish Sharma 1 participant 1 message Aug 16, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nginx: Backport fix for CVE-2024-7347

Upstream-Status: Backport [https://github.com/nginx/nginx/commit/88955b1044ef38315b77ad1a509d63631a790a0f and https://github.com/nginx/nginx/commit/7362d01658b61184108c21278443910da68f93b4]

---
 .../nginx/files/CVE-2024-7347-1.patch         | 34 ++++++++++++
 .../nginx/files/CVE-2024-7347-2.patch         | 52 +++++++++++++++++++
 meta-webserver/recipes-httpd/nginx/nginx.inc  |  2 +
 3 files changed, 88 insertions(+)
 create mode 100644 meta-webserver/recipes-httpd/nginx/files/CVE-2024-7347-1.patch
 create mode 100644 meta-webserver/recipes-httpd/nginx/files/CVE-2024-7347-2.patch
meta-webserver/recipes-httpd/nginx/files/CVE-2024-7347-1.patch new file +34 -0
new file mode 100644
index 0000000000..23723d63d4
@@ -0,0 +1,34 @@
+From 88955b1044ef38315b77ad1a509d63631a790a0f Mon Sep 17 00:00:00 2001
+From: Roman Arutyunyan <[email protected]>
+Date: Mon, 12 Aug 2024 18:20:45 +0400
+Subject: [PATCH] Mp4: rejecting unordered chunks in stsc atom.
+
+Unordered chunks could result in trak->end_chunk smaller than trak->start_chunk
+in ngx_http_mp4_crop_stsc_data().  Later in ngx_http_mp4_update_stco_atom()
+this caused buffer overread while trying to calculate trak->end_offset.
+
+CVE: CVE-2024-7347
+Upstream-Status: Backport [https://github.com/nginx/nginx/commit/88955b1044ef38315b77ad1a509d63631a790a0f]
+Signed-off-by: Ashish Sharma <[email protected]>
+
+ src/http/modules/ngx_http_mp4_module.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c
+index 1cd017c274..041ad263b5 100644
+--- a/src/http/modules/ngx_http_mp4_module.c
++++ b/src/http/modules/ngx_http_mp4_module.c
+@@ -3156,6 +3156,13 @@ ngx_http_mp4_crop_stsc_data(ngx_http_mp4_file_t *mp4,
+ 
+         next_chunk = ngx_mp4_get_32value(entry->chunk);
+ 
++        if (next_chunk < chunk) {
++            ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0,
++                          "unordered mp4 stsc chunks in \"%s\"",
++                          mp4->file.name.data);
++            return NGX_ERROR;
++        }
++
+         ngx_log_debug5(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,
+                        "sample:%uD, chunk:%uD, chunks:%uD, "
+                        "samples:%uD, id:%uD",
meta-webserver/recipes-httpd/nginx/files/CVE-2024-7347-2.patch new file +52 -0

52 lines not on this page · raw message

meta-webserver/recipes-httpd/nginx/nginx.inc +2 -0
index 83ae90c40c..926db19443 100644
@@ -23,6 +23,8 @@ SRC_URI = " \
     file://nginx.service \
     file://nginx-fix-pidfile.patch \
     file://0001-configure-libxslt-conf.patch \
+    file://CVE-2024-7347-1.patch \
+    file://CVE-2024-7347-2.patch \
 "
 
 inherit siteinfo update-rc.d useradd systemd
Signature · 1 line
2.44.1