Skip to contentSkip to conversation

package/squid: backport patch for CVE-2026-33515

PATCH Applied Thomas Perale via buildroot 1 participant 8 messages Jun 26 – Jul 3

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 package/squid: backport patch for CVE-2026-33515

- CVE-2026-33515:
Squid is a caching proxy for the Web. Prior to version 7.5, due to improper input validation, Squid is vulnerable to out of bounds read when handling ICP traffic. This problem allows a remote attacker to receive small amounts of memory potentially containing sensitive information when responding with errors to invalid ICP requests. This attack is limited to Squid deployments that explicitly enable ICP support (i.e. configure non-zero icp_port). This problem cannot be mitigated by denying ICP queries using icp_access rules. Version 7.5 contains a patch.

For more information, see:
- https://www.cve.org/CVERecord?id=CVE-2026-33515
- https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165

---
 package/squid/0003-CVE-2026-33515.patch | 199 ++++++++++++++++++++++++
 package/squid/squid.mk                  |   3 +
 2 files changed, 202 insertions(+)
 create mode 100644 package/squid/0003-CVE-2026-33515.patch
package/squid/0003-CVE-2026-33515.patch new file +199 -0
new file mode 100644
index 0000000000..c99a0362cf
@@ -0,0 +1,199 @@
+From 8138e909d2058d4401e0ad49b583afaec912b165 Mon Sep 17 00:00:00 2001
+From: Joshua Rogers <[email protected]>
+Date: Thu, 12 Feb 2026 20:28:43 +0000
+Subject: [PATCH] ICP: Fix validation of packet sizes and URLs (#2220)
+
+Fix handling of malformed ICP queries and replies instead of passing
+invalid URL pointer to consumers, leading to out-of-bounds memory reads
+and other problems. These fixes affect both ICP v2 and ICP v3 traffic.
+
+* Reject packets with URLs that are not NUL-terminated.
+* Reject packets with URLs containing embedded NULs or trailing garbage.
+
+The above two restrictions may backfire if popular ICP agents do send
+such malformed URLs, and we will need to do more to handle them
+correctly, but it is _safe_ to reject them for now.
+
+Also protect icpHandleUdp() from dereferencing a nil icpOutgoingConn
+pointer. It is not clear whether icpHandleUdp() can be exposed to nil
+icpOutgoingConn in current code. More work is needed to polish this.
+
+Upstream: https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165
+CVE: CVE-2026-33515
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/ICP.h             |  8 ++++--
+ src/icp_v2.cc         | 57 +++++++++++++++++++++++++++++++++++++------
+ src/icp_v3.cc         | 10 +++++---
+ src/tests/stub_icp.cc |  5 ++--
+ 4 files changed, 66 insertions(+), 14 deletions(-)
+
+diff --git a/src/ICP.h b/src/ICP.h
+index 10a8e1c673b..e9ad8d0cef1 100644
+--- a/src/ICP.h
++++ b/src/ICP.h
+@@ -89,8 +89,12 @@ extern Comm::ConnectionPointer icpIncomingConn;
+ extern Comm::ConnectionPointer icpOutgoingConn;
+ extern Ip::Address theIcpPublicHostID;
+ 
++/// A URI extracted from the given raw packet buffer.
++/// On errors, details the problem and returns nil.
++const char *icpGetUrl(const Ip::Address &from, const char *, const icp_common_t &);
++
+ /// \ingroup ServerProtocolICPAPI
+-HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from);
++HttpRequest *icpGetRequest(const char *url, int reqnum, int fd, const Ip::Address &from);
+ 
+ /// \ingroup ServerProtocolICPAPI
+ bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request);
+@@ -102,7 +106,7 @@ void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pa
+ icp_opcode icpGetCommonOpcode();
+ 
+ /// \ingroup ServerProtocolICPAPI
+-void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
++void icpDenyAccess(const Ip::Address &from, const char *url, int reqnum, int fd);
+ 
+ /// \ingroup ServerProtocolICPAPI
+ PF icpHandleUdp;
+diff --git a/src/icp_v2.cc b/src/icp_v2.cc
+index 25f7b71d25e..312104024de 100644
+--- a/src/icp_v2.cc
++++ b/src/icp_v2.cc
+@@ -425,7 +425,7 @@ icpCreateAndSend(icp_opcode opcode, int flags, char const *url, int reqnum, int
+ }
+ 
+ void
+-icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
++icpDenyAccess(const Ip::Address &from, const char * const url, const int reqnum, const int fd)
+ {
+     debugs(12, 2, "icpDenyAccess: Access Denied for " << from << " by " << AclMatchedName << ".");
+ 
+@@ -453,8 +453,41 @@ icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request)
+     return checklist.fastCheck().allowed();
+ }
+ 
++const char *
++icpGetUrl(const Ip::Address &from, const char * const buf, const icp_common_t &header)
++{
++    const auto receivedPacketSize = static_cast<size_t>(header.length);
++    const auto payloadOffset = sizeof(header);
++
++    // Query payload contains a "Requester Host Address" followed by a URL.
++    // Payload of other ICP packets (with opcode that we recognize) is a URL.
++    const auto urlOffset = payloadOffset + ((header.opcode == ICP_QUERY) ? sizeof(uint32_t) : 0);
++
++    // A URL field cannot be empty because it includes a terminating NUL char.
++    // Ensure that the packet has at least one URL field byte.
++    if (urlOffset >= receivedPacketSize) {
++        debugs(12, 3, "too small packet from " << from << ": " << urlOffset << " >= " << receivedPacketSize);
++        return nullptr;
++    }
++
++    // All ICP packets (with opcode that we recognize) _end_ with a URL field.
++    // RFC 2186 requires all URLs to be "Null-Terminated".
++    if (buf[receivedPacketSize - 1] != '\0') {
++        debugs(12, 3, "unterminated URL or trailing garbage from " << from);
++        return nullptr;
++    }
++
++    const auto url = buf + urlOffset; // a possibly empty c-string
++    if (urlOffset + strlen(url) + 1 != receivedPacketSize) {
++        debugs(12, 3, "URL with an embedded NUL or trailing garbage from " << from);
++        return nullptr;
++    }
++
++    return url;
++}
++
+ HttpRequest *
+-icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
++icpGetRequest(const char * const url, const int reqnum, const int fd, const Ip::Address &from)
+ {
+     if (strpbrk(url, w_space)) {
+         url = rfc1738_escape(url);
+@@ -472,13 +505,18 @@ icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
+ }
+ 
+ static void
+-doV2Query(int fd, Ip::Address &from, char *buf, icp_common_t header)
++doV2Query(const int fd, Ip::Address &from, const char * const buf, icp_common_t header)
+ {
+     int rtt = 0;
+     int src_rtt = 0;
+     uint32_t flags = 0;
+-    /* We have a valid packet */
+-    char *url = buf + sizeof(icp_common_t) + sizeof(uint32_t);
++
++    const auto url = icpGetUrl(from, buf, header);
++    if (!url) {
++        icpCreateAndSend(ICP_ERR, 0, "", header.reqnum, 0, fd, from, nullptr);
++        return;
++    }
++
+     HttpRequest *icp_request = icpGetRequest(url, header.reqnum, fd, from);
+ 
+     if (!icp_request)
+@@ -545,7 +583,9 @@ icp_common_t::handleReply(char *buf, Ip::Address &from)
+         neighbors_do_private_keys = 0;
+     }
+ 
+-    char *url = buf + sizeof(icp_common_t);
++    const auto url = icpGetUrl(from, buf, *this);
++    if (!url)
++        return;
+     debugs(12, 3, "icpHandleIcpV2: " << icp_opcode_str[opcode] << " from " << from << " for '" << url << "'");
+ 
+     const cache_key *key = icpGetCacheKey(url, (int) reqnum);
+@@ -680,7 +720,10 @@ icpHandleUdp(int sock, void *)
+ 
+         icp_version = (int) buf[1]; /* cheat! */
+ 
+-        if (icpOutgoingConn->local == from)
++        // XXX: The IP equality comparison below ignores port differences but
++        // should not. It also fails to detect loops when `local` is a wildcard
++        // address (e.g., [::]:3130) because `from` address is never a wildcard.
++        if (icpOutgoingConn && icpOutgoingConn->local == from)
+             // ignore ICP packets which loop back (multicast usually)
+             debugs(12, 4, "icpHandleUdp: Ignoring UDP packet sent by myself");
+         else if (icp_version == ICP_VERSION_2)
+diff --git a/src/icp_v3.cc b/src/icp_v3.cc
+index c912dd4c062..844768aa0bc 100644
+--- a/src/icp_v3.cc
++++ b/src/icp_v3.cc
+@@ -32,10 +32,14 @@ class ICP3State: public ICPState
+ 
+ /// \ingroup ServerProtocolICPInternal3
+ static void
+-doV3Query(int fd, Ip::Address &from, char *buf, icp_common_t header)
++doV3Query(int fd, Ip::Address &from, const char * const buf, icp_common_t header)
+ {
+-    /* We have a valid packet */
+-    char *url = buf + sizeof(icp_common_t) + sizeof(uint32_t);
++    const auto url = icpGetUrl(from, buf, header);
++    if (!url) {
++        icpCreateAndSend(ICP_ERR, 0, "", header.reqnum, 0, fd, from, nullptr);
++        return;
++    }
++
+     HttpRequest *icp_request = icpGetRequest(url, header.reqnum, fd, from);
+ 
+     if (!icp_request)
+diff --git a/src/tests/stub_icp.cc b/src/tests/stub_icp.cc
+index 44091838b58..d148ab66d48 100644
+--- a/src/tests/stub_icp.cc
++++ b/src/tests/stub_icp.cc
+@@ -29,11 +29,12 @@ Comm::ConnectionPointer icpIncomingConn;
+ Comm::ConnectionPointer icpOutgoingConn;
+ Ip::Address theIcpPublicHostID;
+ 
+-HttpRequest* icpGetRequest(char *, int, int, Ip::Address &) STUB_RETVAL(nullptr)
++const char *icpGetUrl(const Ip::Address &, const char *, const icp_common_t &) STUB_RETVAL(nullptr)
++HttpRequest* icpGetRequest(const char *, int, int, const Ip::Address &) STUB_RETVAL(nullptr)
+ bool icpAccessAllowed(Ip::Address &, HttpRequest *) STUB_RETVAL(false)
+ void icpCreateAndSend(icp_opcode, int, char const *, int, int, int, const Ip::Address &, AccessLogEntryPointer) STUB
+ icp_opcode icpGetCommonOpcode() STUB_RETVAL(ICP_INVALID)
+-void icpDenyAccess(Ip::Address &, char *, int, int) STUB
++void icpDenyAccess(const Ip::Address &, const char *, int, int) STUB
+ void icpHandleIcpV3(int, Ip::Address &, char *, int) STUB
+ void icpConnectionShutdown(void) STUB
+ int icpSetCacheKey(const cache_key *) STUB_RETVAL(0)
package/squid/squid.mk +3 -0
index c031f1aa03..4a56e32e59 100644
@@ -18,6 +18,9 @@ SQUID_IGNORE_CVES += CVE-2025-59362
 # 0002-Proxy-auth-data-visible-to-scripts.patch
 SQUID_IGNORE_CVES += CVE-2025-62168
 
+# 0003-CVE-2026-33515.patch
+SQUID_IGNORE_CVES += CVE-2026-33515
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/4 package/squid: backport patch for CVE-2026-33526

- CVE-2026-33526:
Squid is a caching proxy for the Web. Prior to version 7.5, due to heap Use-After-Free, Squid is vulnerable to Denial of Service when handling ICP traffic. This problem allows a remote attacker to perform a reliable and repeatable Denial of Service attack against the Squid service using ICP protocol. This attack is limited to Squid deployments that explicitly enable ICP support (i.e. configure non- zero icp_port). This problem _cannot_ be mitigated by denying ICP queries using icp_access rules. Version 7.5 contains a patch.

For more information, see:
- https://www.cve.org/CVERecord?id=CVE-2026-33526
- https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165

---
 package/squid/0004-CVE-2026-33526.patch | 34 +++++++++++++++++++++++++
 package/squid/squid.mk                  |  3 +++
 2 files changed, 37 insertions(+)
 create mode 100644 package/squid/0004-CVE-2026-33526.patch
package/squid/0004-CVE-2026-33526.patch new file +34 -0
new file mode 100644
index 0000000000..572a0197cb
@@ -0,0 +1,34 @@
+From 8a7d42f9d44befb8fcbbb619505587c8de6a1e91 Mon Sep 17 00:00:00 2001
+From: Joshua Rogers <[email protected]>
+Date: Tue, 10 Feb 2026 19:58:49 +0000
+Subject: [PATCH] Do not escape malformed URI twice when sending ICP errors
+ (#2374)
+
+In this context, escaping escaped URI always produces incorrect URI
+because `%` character in the escaped URI gets escaped again. Feeding the
+result of the first rfc1738_escape() call to the second call is also
+dangerously wrong because the result of the first call gets invalidated
+during the second call.
+
+No other cases of such "chained" rfc1738_escape() calls were found.
+
+Broken since 2002 commit e6ccf245.
+Upstream: https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165
+CVE: CVE-2026-33526
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/icp_v2.cc | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/icp_v2.cc b/src/icp_v2.cc
+index 2a4ced3bfab..25f7b71d25e 100644
+--- a/src/icp_v2.cc
++++ b/src/icp_v2.cc
+@@ -490,7 +490,6 @@ HttpRequest *
+ icpGetRequest(const char * const url, const int reqnum, const int fd, const Ip::Address &from)
+ {
+     if (strpbrk(url, w_space)) {
+-        url = rfc1738_escape(url);
+         icpCreateAndSend(ICP_ERR, 0, rfc1738_escape(url), reqnum, 0, fd, from, nullptr);
+         return nullptr;
+     }
package/squid/squid.mk +3 -0
index 4a56e32e59..e072ec6137 100644
@@ -21,6 +21,9 @@ SQUID_IGNORE_CVES += CVE-2025-62168
 # 0003-CVE-2026-33515.patch
 SQUID_IGNORE_CVES += CVE-2026-33515
 
+# 0004-CVE-2026-33526.patch
+SQUID_IGNORE_CVES += CVE-2026-33526
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2025.02.x 2/4] package/squid: backport patch for CVE-2026-33526

In reply of:

Quoted 10 lines

- CVE-2026-33526:
Squid is a caching proxy for the Web. Prior to version 7.5, due to heap Use-After-Free, Squid is vulnerable to Denial of Service when handling ICP traffic. This problem allows a remote attacker to perform a reliable and repeatable Denial of Service attack against the Squid service using ICP protocol. This attack is limited to Squid deployments that explicitly enable ICP support (i.e. configure non- zero icp_port). This problem _cannot_ be mitigated by denying ICP queries using icp_access rules. Version 7.5 contains a patch.

Quoted 5 lines

For more information, see:
- https://www.cve.org/CVERecord?id=CVE-2026-33526
- https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165

Applied to 2025.02.x. Thanks

Quoted 67 lines
---
 package/squid/0004-CVE-2026-33526.patch | 34 +++++++++++++++++++++++++
 package/squid/squid.mk                  |  3 +++
 2 files changed, 37 insertions(+)
 create mode 100644 package/squid/0004-CVE-2026-33526.patch
package/squid/0004-CVE-2026-33526.patch new file +34 -0
new file mode 100644
index 0000000000..572a0197cb
@@ -0,0 +1,34 @@
+From 8a7d42f9d44befb8fcbbb619505587c8de6a1e91 Mon Sep 17 00:00:00 2001
+From: Joshua Rogers <[email protected]>
+Date: Tue, 10 Feb 2026 19:58:49 +0000
+Subject: [PATCH] Do not escape malformed URI twice when sending ICP errors
+ (#2374)
+
+In this context, escaping escaped URI always produces incorrect URI
+because `%` character in the escaped URI gets escaped again. Feeding the
+result of the first rfc1738_escape() call to the second call is also
+dangerously wrong because the result of the first call gets invalidated
+during the second call.
+
+No other cases of such "chained" rfc1738_escape() calls were found.
+
+Broken since 2002 commit e6ccf245.
+Upstream: https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165
+CVE: CVE-2026-33526
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/icp_v2.cc | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/icp_v2.cc b/src/icp_v2.cc
+index 2a4ced3bfab..25f7b71d25e 100644
+--- a/src/icp_v2.cc
++++ b/src/icp_v2.cc
+@@ -490,7 +490,6 @@ HttpRequest *
+ icpGetRequest(const char * const url, const int reqnum, const int fd, const Ip::Address &from)
+ {
+     if (strpbrk(url, w_space)) {
+-        url = rfc1738_escape(url);
+         icpCreateAndSend(ICP_ERR, 0, rfc1738_escape(url), reqnum, 0, fd, from, nullptr);
+         return nullptr;
+     }
package/squid/squid.mk +3 -0
index 4a56e32e59..e072ec6137 100644
@@ -21,6 +21,9 @@ SQUID_IGNORE_CVES += CVE-2025-62168
 # 0003-CVE-2026-33515.patch
 SQUID_IGNORE_CVES += CVE-2026-33515
 
+# 0004-CVE-2026-33526.patch
+SQUID_IGNORE_CVES += CVE-2026-33526
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

PATCH 3/4 package/squid: add upstream patch CVE-2026-47729

In reply to Thomas Perale via buildroot

- CVE-2026-47729
Due to a Improper Validation of Syntactic Correctness of Input bug, Squid is vulnerable to a Out-of-bounds Read attack against the FTP gateway.

This problem allows a trusted client to perform an Out-of-Bounds Read from random unrelated transactions when accessing a misbehaving FTP server through Squid's gateway feature.

For more information, see:
- https://blog.calif.io/p/squidbleed-cve-2026-47729
- https://www.openwall.com/lists/oss-security/2026/06/12/1
- https://github.com/squid-cache/squid/commit/865a131c7d557e68c965043d98c2eccae26deef8

---
 package/squid/0005-CVE-2026-47729.patch | 49 +++++++++++++++++++++++++
 package/squid/squid.mk                  |  3 ++
 2 files changed, 52 insertions(+)
 create mode 100644 package/squid/0005-CVE-2026-47729.patch
package/squid/0005-CVE-2026-47729.patch new file +49 -0
new file mode 100644
index 0000000000..5a8b0e3e08
@@ -0,0 +1,49 @@
+From 865a131c7d557e68c965043d98c2eccae26deef8 Mon Sep 17 00:00:00 2001
+From: squidadm <[email protected]>
+Date: Sun, 17 May 2026 18:04:47 +1200
+Subject: [PATCH] Improve parsing of certain FTP directory listing formats
+ (#2408) (#2409)
+
+This surgical fix restricts parsing to the input buffer when the listing
+entry date in "TypeA" or "TypeB" formats is not followed by a filename.
+It does not improve rendering of listings with missing filenames or the
+overall quality of FTP listing parsing code.
+
+C strchr() always returns a non-nil pointer when given a NUL character,
+so its callers must be careful not to supply a NUL character if a
+"natural" one-of-the-regular-c-string-characters membership test is
+required.
+
+The bug was probably introduced in 1997 commit 3fdadc70 and then
+duplicated in 2017 commit 3d872090.
+
+Co-authored-by: Alex Rousskov <[email protected]>
+Co-authored-by: Amos Jeffries <[email protected]>
+Upstream: https://github.com/squid-cache/squid/commit/865a131c7d557e68c965043d98c2eccae26deef8
+CVE: CVE-2026-47729
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/clients/FtpGateway.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc
+index 164fd0e499c..e04bb603d96 100644
+--- a/src/clients/FtpGateway.cc
++++ b/src/clients/FtpGateway.cc
+@@ -622,7 +622,7 @@ ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags)
+             // point after tokens[i+2] :
+             copyFrom = buf + tokens[i + 2].pos + strlen(tokens[i + 2].token);
+             if (flags.skip_whitespace) {
+-                while (strchr(w_space, *copyFrom))
++                while (*copyFrom && strchr(w_space, *copyFrom))
+                     ++copyFrom;
+             } else {
+                 /* Handle the following four formats:
+@@ -633,7 +633,7 @@ ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags)
+                  * Assuming a single space between date and filename
+                  * suggested by:  [email protected] and
+                  * Mike Battersby <[email protected]> */
+-                if (strchr(w_space, *copyFrom))
++                if (*copyFrom && strchr(w_space, *copyFrom))
+                     ++copyFrom;
+             }
package/squid/squid.mk +3 -0
index e072ec6137..439d65e479 100644
@@ -24,6 +24,9 @@ SQUID_IGNORE_CVES += CVE-2026-33515
 # 0004-CVE-2026-33526.patch
 SQUID_IGNORE_CVES += CVE-2026-33526
 
+# 0005-CVE-2026-47729.patch
+SQUID_IGNORE_CVES += CVE-2026-47729
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 2025.02.x 3/4] package/squid: add upstream patch CVE-2026-47729

In reply of:

Quoted 9 lines

- CVE-2026-47729
Due to a Improper Validation of Syntactic Correctness of Input bug, Squid is vulnerable to a Out-of-bounds Read attack against the FTP gateway.

This problem allows a trusted client to perform an Out-of-Bounds Read from random unrelated transactions when accessing a misbehaving FTP server through Squid's gateway feature.

Quoted 6 lines

For more information, see:
- https://blog.calif.io/p/squidbleed-cve-2026-47729
- https://www.openwall.com/lists/oss-security/2026/06/12/1
- https://github.com/squid-cache/squid/commit/865a131c7d557e68c965043d98c2eccae26deef8

Applied to 2025.02.x. Thanks

Quoted 82 lines
---
 package/squid/0005-CVE-2026-47729.patch | 49 +++++++++++++++++++++++++
 package/squid/squid.mk                  |  3 ++
 2 files changed, 52 insertions(+)
 create mode 100644 package/squid/0005-CVE-2026-47729.patch
package/squid/0005-CVE-2026-47729.patch new file +49 -0
new file mode 100644
index 0000000000..5a8b0e3e08
@@ -0,0 +1,49 @@
+From 865a131c7d557e68c965043d98c2eccae26deef8 Mon Sep 17 00:00:00 2001
+From: squidadm <[email protected]>
+Date: Sun, 17 May 2026 18:04:47 +1200
+Subject: [PATCH] Improve parsing of certain FTP directory listing formats
+ (#2408) (#2409)
+
+This surgical fix restricts parsing to the input buffer when the listing
+entry date in "TypeA" or "TypeB" formats is not followed by a filename.
+It does not improve rendering of listings with missing filenames or the
+overall quality of FTP listing parsing code.
+
+C strchr() always returns a non-nil pointer when given a NUL character,
+so its callers must be careful not to supply a NUL character if a
+"natural" one-of-the-regular-c-string-characters membership test is
+required.
+
+The bug was probably introduced in 1997 commit 3fdadc70 and then
+duplicated in 2017 commit 3d872090.
+
+Co-authored-by: Alex Rousskov <[email protected]>
+Co-authored-by: Amos Jeffries <[email protected]>
+Upstream: https://github.com/squid-cache/squid/commit/865a131c7d557e68c965043d98c2eccae26deef8
+CVE: CVE-2026-47729
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/clients/FtpGateway.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc
+index 164fd0e499c..e04bb603d96 100644
+--- a/src/clients/FtpGateway.cc
++++ b/src/clients/FtpGateway.cc
+@@ -622,7 +622,7 @@ ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags)
+             // point after tokens[i+2] :
+             copyFrom = buf + tokens[i + 2].pos + strlen(tokens[i + 2].token);
+             if (flags.skip_whitespace) {
+-                while (strchr(w_space, *copyFrom))
++                while (*copyFrom && strchr(w_space, *copyFrom))
+                     ++copyFrom;
+             } else {
+                 /* Handle the following four formats:
+@@ -633,7 +633,7 @@ ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags)
+                  * Assuming a single space between date and filename
+                  * suggested by:  [email protected] and
+                  * Mike Battersby <[email protected]> */
+-                if (strchr(w_space, *copyFrom))
++                if (*copyFrom && strchr(w_space, *copyFrom))
+                     ++copyFrom;
+             }
package/squid/squid.mk +3 -0
index e072ec6137..439d65e479 100644
@@ -24,6 +24,9 @@ SQUID_IGNORE_CVES += CVE-2026-33515
 # 0004-CVE-2026-33526.patch
 SQUID_IGNORE_CVES += CVE-2026-33526
 
+# 0005-CVE-2026-47729.patch
+SQUID_IGNORE_CVES += CVE-2026-47729
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH 4/4 package/squid: add upstream patch for CVE-2026-50012

In reply to Thomas Perale via buildroot

- CVE-2026-50012
Due to an Improper Input Validation bug, Squid is vulnerable to a Heap-based Buffer Overflow attack against cache digests.

For more information, see:
- https://github.com/squid-cache/squid/security/advisories/GHSA-5vmx-9x64-9284
- https://github.com/squid-cache/squid/commit/19fcfe922717c8b255270c032dcde4071c003bcd

---
 package/squid/0006-CVE-2026-50012.patch | 33 +++++++++++++++++++++++++
 package/squid/squid.mk                  |  3 +++
 2 files changed, 36 insertions(+)
 create mode 100644 package/squid/0006-CVE-2026-50012.patch
package/squid/0006-CVE-2026-50012.patch new file +33 -0
new file mode 100644
index 0000000000..ac3af8a36d
@@ -0,0 +1,33 @@
+From 19fcfe922717c8b255270c032dcde4071c003bcd Mon Sep 17 00:00:00 2001
+From: Francesco Chemolli <[email protected]>
+Date: Sat, 30 May 2026 10:16:33 +0000
+Subject: [PATCH] Harden peerDigestSwapInMask against invalid cache digest
+ reply (#2423)
+
+A cache_digest on-the-wire size may be bigger than the
+mask_size declared in the digest itself.
+
+Ignore the digest in case this happens.
+Upstream: https://github.com/squid-cache/squid/commit/19fcfe922717c8b255270c032dcde4071c003bcd
+CVE: CVE-2026-50012
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/peer_digest.cc | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/peer_digest.cc b/src/peer_digest.cc
+index 741090574d6..53dac203eab 100644
+--- a/src/peer_digest.cc
++++ b/src/peer_digest.cc
+@@ -622,6 +622,11 @@ peerDigestSwapInMask(void *data, char *buf, ssize_t size)
+      * NOTENOTENOTENOTENOTE: buf doesn't point to pd->cd->mask anymore!
+      * we need to do the copy ourselves!
+      */
++    Assure(size >= 0);
++    if (fetch->mask_offset + size > static_cast<ssize_t>(pd->cd->mask_size)) {
++        finishAndDeleteFetch(fetch, "peer digest mask data too large", true);
++        return -1;
++    }
+     memcpy(pd->cd->mask + fetch->mask_offset, buf, size);
+ 
+     /* NOTE! buf points to the middle of pd->cd->mask! */
package/squid/squid.mk +3 -0
index 439d65e479..21aca9fe8b 100644
@@ -27,6 +27,9 @@ SQUID_IGNORE_CVES += CVE-2026-33526
 # 0005-CVE-2026-47729.patch
 SQUID_IGNORE_CVES += CVE-2026-47729
 
+# 0006-CVE-2026-50012.patch
+SQUID_IGNORE_CVES += CVE-2026-50012
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH 2025.02.x 4/4] package/squid: add upstream patch for CVE-2026-50012

In reply of:

Quoted 9 lines

- CVE-2026-50012
Due to an Improper Input Validation bug, Squid is vulnerable to a Heap-based Buffer Overflow attack against cache digests.

For more information, see:
- https://github.com/squid-cache/squid/security/advisories/GHSA-5vmx-9x64-9284
- https://github.com/squid-cache/squid/commit/19fcfe922717c8b255270c032dcde4071c003bcd

Applied to 2025.02.x. Thanks

Quoted 66 lines
---
 package/squid/0006-CVE-2026-50012.patch | 33 +++++++++++++++++++++++++
 package/squid/squid.mk                  |  3 +++
 2 files changed, 36 insertions(+)
 create mode 100644 package/squid/0006-CVE-2026-50012.patch
package/squid/0006-CVE-2026-50012.patch new file +33 -0
new file mode 100644
index 0000000000..ac3af8a36d
@@ -0,0 +1,33 @@
+From 19fcfe922717c8b255270c032dcde4071c003bcd Mon Sep 17 00:00:00 2001
+From: Francesco Chemolli <[email protected]>
+Date: Sat, 30 May 2026 10:16:33 +0000
+Subject: [PATCH] Harden peerDigestSwapInMask against invalid cache digest
+ reply (#2423)
+
+A cache_digest on-the-wire size may be bigger than the
+mask_size declared in the digest itself.
+
+Ignore the digest in case this happens.
+Upstream: https://github.com/squid-cache/squid/commit/19fcfe922717c8b255270c032dcde4071c003bcd
+CVE: CVE-2026-50012
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/peer_digest.cc | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/peer_digest.cc b/src/peer_digest.cc
+index 741090574d6..53dac203eab 100644
+--- a/src/peer_digest.cc
++++ b/src/peer_digest.cc
+@@ -622,6 +622,11 @@ peerDigestSwapInMask(void *data, char *buf, ssize_t size)
+      * NOTENOTENOTENOTENOTE: buf doesn't point to pd->cd->mask anymore!
+      * we need to do the copy ourselves!
+      */
++    Assure(size >= 0);
++    if (fetch->mask_offset + size > static_cast<ssize_t>(pd->cd->mask_size)) {
++        finishAndDeleteFetch(fetch, "peer digest mask data too large", true);
++        return -1;
++    }
+     memcpy(pd->cd->mask + fetch->mask_offset, buf, size);
+ 
+     /* NOTE! buf points to the middle of pd->cd->mask! */
package/squid/squid.mk +3 -0
index 439d65e479..21aca9fe8b 100644
@@ -27,6 +27,9 @@ SQUID_IGNORE_CVES += CVE-2026-33526
 # 0005-CVE-2026-47729.patch
 SQUID_IGNORE_CVES += CVE-2026-47729
 
+# 0006-CVE-2026-50012.patch
+SQUID_IGNORE_CVES += CVE-2026-50012
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw
In reply to Thomas Perale via buildroot

In reply of:

Quoted 11 lines

- CVE-2026-33515:
Squid is a caching proxy for the Web. Prior to version 7.5, due to improper input validation, Squid is vulnerable to out of bounds read when handling ICP traffic. This problem allows a remote attacker to receive small amounts of memory potentially containing sensitive information when responding with errors to invalid ICP requests. This attack is limited to Squid deployments that explicitly enable ICP support (i.e. configure non-zero icp_port). This problem cannot be mitigated by denying ICP queries using icp_access rules. Version 7.5 contains a patch.

Quoted 5 lines

For more information, see:
- https://www.cve.org/CVERecord?id=CVE-2026-33515
- https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165

Applied to 2025.02.x. Thanks

Quoted 232 lines
---
 package/squid/0003-CVE-2026-33515.patch | 199 ++++++++++++++++++++++++
 package/squid/squid.mk                  |   3 +
 2 files changed, 202 insertions(+)
 create mode 100644 package/squid/0003-CVE-2026-33515.patch
package/squid/0003-CVE-2026-33515.patch new file +199 -0
new file mode 100644
index 0000000000..c99a0362cf
@@ -0,0 +1,199 @@
+From 8138e909d2058d4401e0ad49b583afaec912b165 Mon Sep 17 00:00:00 2001
+From: Joshua Rogers <[email protected]>
+Date: Thu, 12 Feb 2026 20:28:43 +0000
+Subject: [PATCH] ICP: Fix validation of packet sizes and URLs (#2220)
+
+Fix handling of malformed ICP queries and replies instead of passing
+invalid URL pointer to consumers, leading to out-of-bounds memory reads
+and other problems. These fixes affect both ICP v2 and ICP v3 traffic.
+
+* Reject packets with URLs that are not NUL-terminated.
+* Reject packets with URLs containing embedded NULs or trailing garbage.
+
+The above two restrictions may backfire if popular ICP agents do send
+such malformed URLs, and we will need to do more to handle them
+correctly, but it is _safe_ to reject them for now.
+
+Also protect icpHandleUdp() from dereferencing a nil icpOutgoingConn
+pointer. It is not clear whether icpHandleUdp() can be exposed to nil
+icpOutgoingConn in current code. More work is needed to polish this.
+
+Upstream: https://github.com/squid-cache/squid/commit/8138e909d2058d4401e0ad49b583afaec912b165
+CVE: CVE-2026-33515
+Signed-off-by: Thomas Perale <[email protected]>
+---
+ src/ICP.h             |  8 ++++--
+ src/icp_v2.cc         | 57 +++++++++++++++++++++++++++++++++++++------
+ src/icp_v3.cc         | 10 +++++---
+ src/tests/stub_icp.cc |  5 ++--
+ 4 files changed, 66 insertions(+), 14 deletions(-)
+
+diff --git a/src/ICP.h b/src/ICP.h
+index 10a8e1c673b..e9ad8d0cef1 100644
+--- a/src/ICP.h
++++ b/src/ICP.h
+@@ -89,8 +89,12 @@ extern Comm::ConnectionPointer icpIncomingConn;
+ extern Comm::ConnectionPointer icpOutgoingConn;
+ extern Ip::Address theIcpPublicHostID;
+ 
++/// A URI extracted from the given raw packet buffer.
++/// On errors, details the problem and returns nil.
++const char *icpGetUrl(const Ip::Address &from, const char *, const icp_common_t &);
++
+ /// \ingroup ServerProtocolICPAPI
+-HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from);
++HttpRequest *icpGetRequest(const char *url, int reqnum, int fd, const Ip::Address &from);
+ 
+ /// \ingroup ServerProtocolICPAPI
+ bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request);
+@@ -102,7 +106,7 @@ void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pa
+ icp_opcode icpGetCommonOpcode();
+ 
+ /// \ingroup ServerProtocolICPAPI
+-void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
++void icpDenyAccess(const Ip::Address &from, const char *url, int reqnum, int fd);
+ 
+ /// \ingroup ServerProtocolICPAPI
+ PF icpHandleUdp;
+diff --git a/src/icp_v2.cc b/src/icp_v2.cc
+index 25f7b71d25e..312104024de 100644
+--- a/src/icp_v2.cc
++++ b/src/icp_v2.cc
+@@ -425,7 +425,7 @@ icpCreateAndSend(icp_opcode opcode, int flags, char const *url, int reqnum, int
+ }
+ 
+ void
+-icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd)
++icpDenyAccess(const Ip::Address &from, const char * const url, const int reqnum, const int fd)
+ {
+     debugs(12, 2, "icpDenyAccess: Access Denied for " << from << " by " << AclMatchedName << ".");
+ 
+@@ -453,8 +453,41 @@ icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request)
+     return checklist.fastCheck().allowed();
+ }
+ 
++const char *
++icpGetUrl(const Ip::Address &from, const char * const buf, const icp_common_t &header)
++{
++    const auto receivedPacketSize = static_cast<size_t>(header.length);
++    const auto payloadOffset = sizeof(header);
++
++    // Query payload contains a "Requester Host Address" followed by a URL.
++    // Payload of other ICP packets (with opcode that we recognize) is a URL.
++    const auto urlOffset = payloadOffset + ((header.opcode == ICP_QUERY) ? sizeof(uint32_t) : 0);
++
++    // A URL field cannot be empty because it includes a terminating NUL char.
++    // Ensure that the packet has at least one URL field byte.
++    if (urlOffset >= receivedPacketSize) {
++        debugs(12, 3, "too small packet from " << from << ": " << urlOffset << " >= " << receivedPacketSize);
++        return nullptr;
++    }
++
++    // All ICP packets (with opcode that we recognize) _end_ with a URL field.
++    // RFC 2186 requires all URLs to be "Null-Terminated".
++    if (buf[receivedPacketSize - 1] != '\0') {
++        debugs(12, 3, "unterminated URL or trailing garbage from " << from);
++        return nullptr;
++    }
++
++    const auto url = buf + urlOffset; // a possibly empty c-string
++    if (urlOffset + strlen(url) + 1 != receivedPacketSize) {
++        debugs(12, 3, "URL with an embedded NUL or trailing garbage from " << from);
++        return nullptr;
++    }
++
++    return url;
++}
++
+ HttpRequest *
+-icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
++icpGetRequest(const char * const url, const int reqnum, const int fd, const Ip::Address &from)
+ {
+     if (strpbrk(url, w_space)) {
+         url = rfc1738_escape(url);
+@@ -472,13 +505,18 @@ icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from)
+ }
+ 
+ static void
+-doV2Query(int fd, Ip::Address &from, char *buf, icp_common_t header)
++doV2Query(const int fd, Ip::Address &from, const char * const buf, icp_common_t header)
+ {
+     int rtt = 0;
+     int src_rtt = 0;
+     uint32_t flags = 0;
+-    /* We have a valid packet */
+-    char *url = buf + sizeof(icp_common_t) + sizeof(uint32_t);
++
++    const auto url = icpGetUrl(from, buf, header);
++    if (!url) {
++        icpCreateAndSend(ICP_ERR, 0, "", header.reqnum, 0, fd, from, nullptr);
++        return;
++    }
++
+     HttpRequest *icp_request = icpGetRequest(url, header.reqnum, fd, from);
+ 
+     if (!icp_request)
+@@ -545,7 +583,9 @@ icp_common_t::handleReply(char *buf, Ip::Address &from)
+         neighbors_do_private_keys = 0;
+     }
+ 
+-    char *url = buf + sizeof(icp_common_t);
++    const auto url = icpGetUrl(from, buf, *this);
++    if (!url)
++        return;
+     debugs(12, 3, "icpHandleIcpV2: " << icp_opcode_str[opcode] << " from " << from << " for '" << url << "'");
+ 
+     const cache_key *key = icpGetCacheKey(url, (int) reqnum);
+@@ -680,7 +720,10 @@ icpHandleUdp(int sock, void *)
+ 
+         icp_version = (int) buf[1]; /* cheat! */
+ 
+-        if (icpOutgoingConn->local == from)
++        // XXX: The IP equality comparison below ignores port differences but
++        // should not. It also fails to detect loops when `local` is a wildcard
++        // address (e.g., [::]:3130) because `from` address is never a wildcard.
++        if (icpOutgoingConn && icpOutgoingConn->local == from)
+             // ignore ICP packets which loop back (multicast usually)
+             debugs(12, 4, "icpHandleUdp: Ignoring UDP packet sent by myself");
+         else if (icp_version == ICP_VERSION_2)
+diff --git a/src/icp_v3.cc b/src/icp_v3.cc
+index c912dd4c062..844768aa0bc 100644
+--- a/src/icp_v3.cc
++++ b/src/icp_v3.cc
+@@ -32,10 +32,14 @@ class ICP3State: public ICPState
+ 
+ /// \ingroup ServerProtocolICPInternal3
+ static void
+-doV3Query(int fd, Ip::Address &from, char *buf, icp_common_t header)
++doV3Query(int fd, Ip::Address &from, const char * const buf, icp_common_t header)
+ {
+-    /* We have a valid packet */
+-    char *url = buf + sizeof(icp_common_t) + sizeof(uint32_t);
++    const auto url = icpGetUrl(from, buf, header);
++    if (!url) {
++        icpCreateAndSend(ICP_ERR, 0, "", header.reqnum, 0, fd, from, nullptr);
++        return;
++    }
++
+     HttpRequest *icp_request = icpGetRequest(url, header.reqnum, fd, from);
+ 
+     if (!icp_request)
+diff --git a/src/tests/stub_icp.cc b/src/tests/stub_icp.cc
+index 44091838b58..d148ab66d48 100644
+--- a/src/tests/stub_icp.cc
++++ b/src/tests/stub_icp.cc
+@@ -29,11 +29,12 @@ Comm::ConnectionPointer icpIncomingConn;
+ Comm::ConnectionPointer icpOutgoingConn;
+ Ip::Address theIcpPublicHostID;
+ 
+-HttpRequest* icpGetRequest(char *, int, int, Ip::Address &) STUB_RETVAL(nullptr)
++const char *icpGetUrl(const Ip::Address &, const char *, const icp_common_t &) STUB_RETVAL(nullptr)
++HttpRequest* icpGetRequest(const char *, int, int, const Ip::Address &) STUB_RETVAL(nullptr)
+ bool icpAccessAllowed(Ip::Address &, HttpRequest *) STUB_RETVAL(false)
+ void icpCreateAndSend(icp_opcode, int, char const *, int, int, int, const Ip::Address &, AccessLogEntryPointer) STUB
+ icp_opcode icpGetCommonOpcode() STUB_RETVAL(ICP_INVALID)
+-void icpDenyAccess(Ip::Address &, char *, int, int) STUB
++void icpDenyAccess(const Ip::Address &, const char *, int, int) STUB
+ void icpHandleIcpV3(int, Ip::Address &, char *, int) STUB
+ void icpConnectionShutdown(void) STUB
+ int icpSetCacheKey(const cache_key *) STUB_RETVAL(0)
package/squid/squid.mk +3 -0
index c031f1aa03..4a56e32e59 100644
@@ -18,6 +18,9 @@ SQUID_IGNORE_CVES += CVE-2025-59362
 # 0002-Proxy-auth-data-visible-to-scripts.patch
 SQUID_IGNORE_CVES += CVE-2025-62168
 
+# 0003-CVE-2026-33515.patch
+SQUID_IGNORE_CVES += CVE-2026-33515
+
 SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
 	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
 SQUID_CONF_ENV = \
Signature · 6 lines
2.54.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot