fix CVE-2023-49285 CVE-2023-49286
(cherry picked from commit d8519a501cbb770729c96bf27d62d08502d2b19b)
This commit is contained in:
parent
dac746618f
commit
7147c4f70b
34
backport-CVE-2023-49285.patch
Normal file
34
backport-CVE-2023-49285.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From 77b3fb4df0f126784d5fd4967c28ed40eb8d521b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alex Rousskov <rousskov@measurement-factory.com>
|
||||||
|
Date: Wed, 25 Oct 2023 19:41:45 +0000
|
||||||
|
Subject: [PATCH] RFC 1123: Fix date parsing (#1538)
|
||||||
|
|
||||||
|
The bug was discovered and detailed by Joshua Rogers at
|
||||||
|
https://megamansec.github.io/Squid-Security-Audit/datetime-overflow.html
|
||||||
|
where it was filed as "1-Byte Buffer OverRead in RFC 1123 date/time
|
||||||
|
Handling".
|
||||||
|
|
||||||
|
Conflict:NA
|
||||||
|
Reference:https://github.com/squid-cache/squid/commit/77b3fb4df0f126784d5fd4967c28ed40eb8d521b
|
||||||
|
---
|
||||||
|
lib/rfc1123.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/lib/rfc1123.c b/lib/rfc1123.c
|
||||||
|
index e5bf9a4d705..cb484cc002b 100644
|
||||||
|
--- a/lib/rfc1123.c
|
||||||
|
+++ b/lib/rfc1123.c
|
||||||
|
@@ -50,7 +50,13 @@ make_month(const char *s)
|
||||||
|
char month[3];
|
||||||
|
|
||||||
|
month[0] = xtoupper(*s);
|
||||||
|
+ if (!month[0])
|
||||||
|
+ return -1; // protects *(s + 1) below
|
||||||
|
+
|
||||||
|
month[1] = xtolower(*(s + 1));
|
||||||
|
+ if (!month[1])
|
||||||
|
+ return -1; // protects *(s + 2) below
|
||||||
|
+
|
||||||
|
month[2] = xtolower(*(s + 2));
|
||||||
|
|
||||||
|
for (i = 0; i < 12; i++)
|
||||||
84
backport-CVE-2023-49286.patch
Normal file
84
backport-CVE-2023-49286.patch
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
From: Alex Rousskov <rousskov@measurement-factory.com>
|
||||||
|
Date: Fri, 27 Oct 2023 21:27:20 +0000
|
||||||
|
Subject: [PATCH] Exit without asserting when helper process startup fails
|
||||||
|
(#1543)
|
||||||
|
|
||||||
|
... to dup() after fork() and before execvp().
|
||||||
|
|
||||||
|
Assertions are for handling program logic errors. Helper initialization
|
||||||
|
code already handled system call errors correctly (i.e. by exiting the
|
||||||
|
newly created helper process with an error), except for a couple of
|
||||||
|
assert()s that could be triggered by dup(2) failures.
|
||||||
|
|
||||||
|
This bug was discovered and detailed by Joshua Rogers at
|
||||||
|
https://megamansec.github.io/Squid-Security-Audit/ipc-assert.html
|
||||||
|
where it was filed as 'Assertion in Squid "Helper" Process Creator'.
|
||||||
|
|
||||||
|
Conflict:NA
|
||||||
|
Reference:https://github.com/squid-cache/squid/commit/6014c6648a2a54a4ecb7f952ea1163e0798f9264
|
||||||
|
---
|
||||||
|
src/ipc.cc | 32 ++++++++++++++++++++++++++------
|
||||||
|
1 file changed, 26 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ipc.cc b/src/ipc.cc
|
||||||
|
index 40d34b475..1afc4d5cf 100644
|
||||||
|
--- a/src/ipc.cc
|
||||||
|
+++ b/src/ipc.cc
|
||||||
|
@@ -22,6 +22,11 @@
|
||||||
|
#include "SquidConfig.h"
|
||||||
|
#include "SquidIpc.h"
|
||||||
|
#include "tools.h"
|
||||||
|
+#include <cstdlib>
|
||||||
|
+
|
||||||
|
+#if HAVE_UNISTD_H
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
static const char *hello_string = "hi there\n";
|
||||||
|
#ifndef HELLO_BUF_SZ
|
||||||
|
@@ -362,6 +367,22 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
|
||||||
|
}
|
||||||
|
|
||||||
|
PutEnvironment();
|
||||||
|
+
|
||||||
|
+ // A dup(2) wrapper that reports and exits the process on errors. The
|
||||||
|
+ // exiting logic is only suitable for this child process context.
|
||||||
|
+ const auto dupOrExit = [prog,name](const int oldFd) {
|
||||||
|
+ const auto newFd = dup(oldFd);
|
||||||
|
+ if (newFd < 0) {
|
||||||
|
+ const auto savedErrno = errno;
|
||||||
|
+ debugs(54, DBG_CRITICAL, "ERROR: Helper process initialization failure: " << name <<
|
||||||
|
+ Debug::Extra << "helper (CHILD) PID: " << getpid() <<
|
||||||
|
+ Debug::Extra << "helper program name: " << prog <<
|
||||||
|
+ Debug::Extra << "dup(2) system call error for FD " << oldFd << ": " << xstrerr(savedErrno));
|
||||||
|
+ _exit(EXIT_FAILURE);
|
||||||
|
+ }
|
||||||
|
+ return newFd;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* This double-dup stuff avoids problems when one of
|
||||||
|
* crfd, cwfd, or debug_log are in the rage 0-2.
|
||||||
|
@@ -369,17 +390,16 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
|
||||||
|
|
||||||
|
do {
|
||||||
|
/* First make sure 0-2 is occupied by something. Gets cleaned up later */
|
||||||
|
- x = dup(crfd);
|
||||||
|
- assert(x > -1);
|
||||||
|
- } while (x < 3 && x > -1);
|
||||||
|
+ x = dupOrExit(crfd);
|
||||||
|
+ } while (x < 3);
|
||||||
|
|
||||||
|
close(x);
|
||||||
|
|
||||||
|
- t1 = dup(crfd);
|
||||||
|
+ t1 = dupOrExit(crfd);
|
||||||
|
|
||||||
|
- t2 = dup(cwfd);
|
||||||
|
+ t2 = dupOrExit(cwfd);
|
||||||
|
|
||||||
|
- t3 = dup(fileno(debug_log));
|
||||||
|
+ t3 = dupOrExit(fileno(debug_log));
|
||||||
|
|
||||||
|
assert(t1 > 2 && t2 > 2 && t3 > 2);
|
||||||
|
|
||||||
10
squid.spec
10
squid.spec
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: squid
|
Name: squid
|
||||||
Version: 4.9
|
Version: 4.9
|
||||||
Release: 20
|
Release: 21
|
||||||
Summary: The Squid proxy caching server
|
Summary: The Squid proxy caching server
|
||||||
Epoch: 7
|
Epoch: 7
|
||||||
License: GPLv2+ and (LGPLv2+ and MIT and BSD and Public Domain)
|
License: GPLv2+ and (LGPLv2+ and MIT and BSD and Public Domain)
|
||||||
@ -51,6 +51,8 @@ Patch30:backport-0002-CVE-2023-46846.patch
|
|||||||
Patch31:backport-CVE-2023-46847.patch
|
Patch31:backport-CVE-2023-46847.patch
|
||||||
Patch32:backport-CVE-2023-46724.patch
|
Patch32:backport-CVE-2023-46724.patch
|
||||||
Patch33:backport-CVE-2023-46728.patch
|
Patch33:backport-CVE-2023-46728.patch
|
||||||
|
Patch34:backport-CVE-2023-49285.patch
|
||||||
|
Patch35:backport-CVE-2023-49286.patch
|
||||||
|
|
||||||
Buildroot: %{_tmppath}/squid-4.9-1-root-%(%{__id_u} -n)
|
Buildroot: %{_tmppath}/squid-4.9-1-root-%(%{__id_u} -n)
|
||||||
Requires: bash >= 2.0
|
Requires: bash >= 2.0
|
||||||
@ -245,6 +247,12 @@ fi
|
|||||||
chgrp squid /var/cache/samba/winbindd_privileged >/dev/null 2>&1 || :
|
chgrp squid /var/cache/samba/winbindd_privileged >/dev/null 2>&1 || :
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 05 2023 yanglu <yanglu72@h-partners.com> - 7:4.9-21
|
||||||
|
- Type:cves
|
||||||
|
- ID:CVE-2023-49285 CVE-2023-49286
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:fix CVE-2023-49285 CVE-2023-49286
|
||||||
|
|
||||||
* Wed Nov 08 2023 yanglu <yanglu72@h-partners.com> - 7:4.9-20
|
* Wed Nov 08 2023 yanglu <yanglu72@h-partners.com> - 7:4.9-20
|
||||||
- Type:CVE
|
- Type:CVE
|
||||||
- ID:CVE-2023-46728
|
- ID:CVE-2023-46728
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user