Article View: linux.kernel.netdev
Article #15618[PATCH net 11/15] ipvs: validate cport in received sync records
From: Pablo Neira Ayuso
Date: Fri, 13 Nov 2026 01:14
Date: Fri, 13 Nov 2026 01:14
61 lines
10518 bytes
10518 bytes
From: Axel Mierczuk <axel.mierczuk@1password.com>
Local templates have cport 0 and IP_VS_CONN_F_NO_CPORT clear, so
ip_vs_conn_in_get() cannot match them. A template received over the
unauthenticated sync protocol with a nonzero cport can reach the
protocol state machine. Before template state validation, this
could cause out-of-bounds reads, crashes and kernel data leaks.
Ordinary records with cport 0 and IP_VS_CONN_F_NO_CPORT clear, or
with a nonzero cport and IP_VS_CONN_F_NO_CPORT set, create connections
that incoming lookups cannot match. The latter also keeps the
cport-zero fallback in ip_vs_conn_in_get() enabled.
Reject all three cases. Continue accepting ordinary connections with
cport 0 and IP_VS_CONN_F_NO_CPORT. The companion commit f96e91748f63
("ipvs: filter some flags received in the backup server") rejects
template records carrying IP_VS_CONN_F_NO_CPORT.
Fixes: 87375ab47cd0 ("[IPVS]: ip_vs_ftp breaks connections using persistence")
Cc: stable@vger.kernel.org
Suggested-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Axel Mierczuk <axel.mierczuk@1password.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/ipvs/ip_vs_sync.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index f11c59eca553..7e562e745ab5 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -871,6 +871,25 @@ static void ip_vs_proc_conn(struct netns_ipvs *ipvs, struct ip_vs_conn_param *pa
struct ip_vs_dest *dest;
struct ip_vs_conn *cp;
+ /* Templates require cport 0. Ordinary connections require
+ * NO_CPORT exactly when cport is 0.
+ */
+ if (flags & IP_VS_CONN_F_TEMPLATE) {
+ if (param->cport) {
+ IP_VS_DBG(2, "BACKUP, template with cport dropped\n");
+ kfree(param->pe_data);
+ return;
+ }
+ } else if (!param->cport && !(flags & IP_VS_CONN_F_NO_CPORT)) {
+ IP_VS_DBG(2, "BACKUP, conn without cport dropped\n");
+ kfree(param->pe_data);
+ return;
+ } else if (param->cport && (flags & IP_VS_CONN_F_NO_CPORT)) {
+ IP_VS_DBG(2, "BACKUP, conn with cport and NO_CPORT dropped\n");
+ kfree(param->pe_data);
+ return;
+ }
+
if (!(flags & IP_VS_CONN_F_TEMPLATE)) {
cp = ip_vs_conn_in_get(param);
if (cp && ((cp->dport != dport) ||
--
2.47.3
Technical Details
Message-ID:
<20261113011447.2357709-12-pablo@netfilter.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362360-linux-kernel-netdev=dewy.ruReferences:
<20261113011447.2357709-1-pablo@netfilter.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362360-linux-kernel-netdev=dewy.ru From: pablo@netfilter.org (Pablo Neira Ayuso) Newsgroups: linux.kernel.netdev Subject: [PATCH net 11/15] ipvs: validate cport in received sync records Date: Fri, 13 Nov 2026 02:14:43 +0100 Organization: Usenet Network Message-ID: <20261113011447.2357709-12-pablo@netfilter.org> References: <20261113011447.2357709-1-pablo@netfilter.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1285083"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:0d8r2mtPmp1p4jlyMlGYZaJAqJ8= sha256:CrwdJZQR29s79ku40NVXX19Hxfj1CWnUsxyzBkmjgYo= sha1:t3fLnLZrYXqMnjJ6THRmEaVZjNE= sha256:vjP7PfjQyBeYa2vsjKSWTggfd/n1eZGHJQ29YD2qlKg= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id CDE42114490; Fri, 13 Nov 2026 10:00:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=netfilter.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M3LswM_TFrhE; Fri, 13 Nov 2026 10:00:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-362360-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=netfilter.org X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 655E011445B; Fri, 13 Nov 2026 09:59:58 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 0F9841068C8; Fri, 13 Nov 2026 01:16:13 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1794532515; b=UuUZavrrJhnue7VMknKU3TuALc/OkvpS3H0ZbAVJJjregN9Zs2GFUFR85X6/k25pWLau Q9E7j2whWRV5JdKsTdf82fiI9I1/paZYrbb1UjLzxaJsIP+NlCeYm1bhQ1g+7Fz/ewPzM AxYjmZFUZ40LBwu1WlR8fCIMU2mgoWET8c3FJ/ACVYsZzla3dvF/NljpMOjlOMJy81Jsg C5ZQZAdS73N2nSYu6q6qhikdSC8nYxbRwXSJgi+9qXEXqNLy2CRWYqeI5+xoN+v2jNSls whX0qfVxUNtrKOQ52ivQr7mLTcrPSLoY/qfdAjU74pR2tQPTjyiIHjMvuxVxpiC0l0w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794532515; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=iy4TGIRj/y0rTfGvhCEsPkvS8/SqmV+ZRLhEWbG+xdk=; b=UgVn5gwPt7+oXOhKrQ21z7GZW3zCdics6dMU5MTVVhQbG+CgfOMWbfG+vHL0pNd0kjZd UdDoIk1zxYS9TVai2O96RobfI0Nqps9hG49Hz5NTVoHVi7Ci0YmFu5TqdSrh/Fv+UX1N6 qJOPHt0l4Qhl80hcjaN4nHsjrDLvSqCyzTJBtUBxguTHeij0IwUWCPoFoxrMvLf3HviMp QGiOiPMhKKA/64o4mzGBPx/Ie+kr7wqhlMXTDNLAFa5yRnM2l/f9NkkEitfB3V+/j5VLi jjvkS2UEf9rjlRS9blEsV7FzDsKnMOEhVr/CK/ozmA0T0QVkOHzWCi8c08YEX3buYZg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=g5bDnkPd; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; arc=fail smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E469460A2634; Fri, 13 Nov 2026 01:15:14 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=g5bDnkPd X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.70.190.124 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794532514; b=GmmtQC/L1ERJfPhCrEZ5ol/95SFyq9rMzZOrBxrfiAqyFSCPg/YprFUOqt7ZQVFemtNc K0+9YXYUqpw6hbzJeZRVdKzBAhLbCbOgG2Nfri0byezsjTDuUtY1hvahiHlnSarxpxr3a H6ETOBdFuChWYDOqX73KrC3G47+Du65SjxRkc0fuAhyQUZw/NVsYc0GUlNmcKBesFo45B NvbRz1XUR27dxB4L+nCb9iXZi2oKGr/GwhAhkhrGyCWW9IedcmFgyc5Lee1hnRPvHvEku jJmKz8/XG3teda8Jl//ojYquNDtvSBf7ODhpTAtgBJMkNGXo4MXyCX8Xk43QQMJJ9BA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794532514; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=iy4TGIRj/y0rTfGvhCEsPkvS8/SqmV+ZRLhEWbG+xdk=; b=RbibPBATmOkTHfLw3vb2/t1z8amSgyc5U4/CrBE/XDCS4O5v48UARgl17SQ/JCb4HPh0 LyvbJrcBa3hTQ0k8qQVdVS5mCYAfMG6jnM2keFU890l1zQwdtH0iN1/Jjly4pLItLlK3v 22IQleBF6tbkHHt4SUzdwcFXlN5sjswjnSR4CeQGg05rGuftNIoGYvVYIlY/ro5GT9VAw iNQUer2U8uBHlTjLoYPT9KF8NtEIfZHG+mj1sxH5aGQpMz0Ldv1H1GV47Mmsm6TEiedCH k4LIRvz37qNyhIUyVKJxyaM/KQQKZYPQc1JeBPxcaAe4R5mrYqHUzN/PQ5huTO4ZFqw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=g5bDnkPd; arc=none smtp.remote-ip=217.70.190.124 X-Received: from mail.netfilter.org (mail.netfilter.org [217.70.190.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EA2B60A2628; Fri, 13 Nov 2026 01:15:13 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8EA2B60A2628 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org; s=2025; t=1794532512; bh=iy4TGIRj/y0rTfGvhCEsPkvS8/SqmV+ZRLhEWbG+xdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g5bDnkPdTuqRN6gqffVNGimA1UhWIIU73qZQL32j7q87PjcN5AY3XJGe6nJt8iHmt b91E8p0oPBg+PUMAoFbF3fxZNQ0H3/hVnGlnMEa8VLOmyyInJKrHIH8ij/q2IuPPlo JNikI1A5RdJcOzImjuaGkOZtnDrCC++GBwK2iwW/NtqDqAotRAmcs+bVkaIfOSxG4O vvvqI6NEjHWRNJZdq43UMaLKvRjdVf2gQ3BvILtUCBt1HfZ72Lpi3r7I+FJGrHY/7Y QUf4OTWSISsdHj2EwxUiIJ3ORCYDsLrFas3RQDRWBrNBlYXALtYU8+buyMUFyD9LSw AaFcZxVszo0gg== X-Received: from localhost.localdomain (mail-agni [217.70.190.124]) by mail.netfilter.org (Postfix) with ESMTPSA id 6E20A6005B; Fri, 13 Nov 2026 02:15:11 +0100 (CET) X-Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg X-Mailer: git-send-email 2.47.3 X-In-Reply-To: <20261113011447.2357709-1-pablo@netfilter.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list