🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21047

[PATCH net-next 08/15] netfilter: nft_synproxy: only handle pure SYN and ACK packets

#21047
From: Pablo Neira Ayuso
Date: Mon, 23 Nov 2026 13:57
68 lines
11051 bytes
From: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>

nft_synproxy treats any segment with SYN set as a client's initial SYN
and any segment with ACK set as the client's final ACK. A SYN-ACK thus
gets answered with a fresh SYN-ACK cookie.

If that reply is routed back to the same host, e.g. to a peer address
covered by an address on lo, it re-enters the input hook, is answered
again, and never stops. Every such SYN starts its own endless loop over
the loopback backlog, so NET_RX softirq keeps the CPU busy and memory
fills with skbs and rtable entries until workqueues stall and the
machine OOMs.

Use the same flag checks as ip(6)t_SYNPROXY: SYN without ACK, FIN or
RST is an initial SYN; ACK without SYN, FIN or RST is the client ACK.
Anything else falls through to the next expression.

Fixes: ad49d86e07a4 ("netfilter: nf_tables: Add synproxy support")
Reported-by: syzbot+d7795c8487ca4e20ed88@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d7795c8487ca4e20ed88
Reported-by: syzbot+d0d2f1a65f45b319d25d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d0d2f1a65f45b319d25d
Signed-off-by: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_synproxy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nft_synproxy.c b/net/netfilter/nft_synproxy.c
index 554a96a000f4..ad43faf1dd1b 100644
--- a/net/netfilter/nft_synproxy.c
+++ b/net/netfilter/nft_synproxy.c
@@ -53,13 +53,13 @@ static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
 	struct synproxy_net *snet = synproxy_pernet(net);
 	struct sk_buff *skb = pkt->skb;
 
-	if (tcp->syn) {
+	if (tcp->syn && !(tcp->ack || tcp->fin || tcp->rst)) {
 		/* Initial SYN from client */
 		nft_synproxy_tcp_options(opts, tcp, snet, &info);
 		synproxy_send_client_synack(net, skb, tcp, opts);
 		consume_skb(skb);
 		regs->verdict.code = NF_STOLEN;
-	} else if (tcp->ack) {
+	} else if (tcp->ack && !(tcp->fin || tcp->rst || tcp->syn)) {
 		/* ACK from client */
 		if (synproxy_recv_client_ack(net, skb, tcp, opts,
 					     ntohl(tcp->seq))) {
@@ -84,13 +84,13 @@ static void nft_synproxy_eval_v6(const struct nft_synproxy *priv,
 	struct synproxy_net *snet = synproxy_pernet(net);
 	struct sk_buff *skb = pkt->skb;
 
-	if (tcp->syn) {
+	if (tcp->syn && !(tcp->ack || tcp->fin || tcp->rst)) {
 		/* Initial SYN from client */
 		nft_synproxy_tcp_options(opts, tcp, snet, &info);
 		synproxy_send_client_synack_ipv6(net, skb, tcp, opts);
 		consume_skb(skb);
 		regs->verdict.code = NF_STOLEN;
-	} else if (tcp->ack) {
+	} else if (tcp->ack && !(tcp->fin || tcp->rst || tcp->syn)) {
 		/* ACK from client */
 		if (synproxy_recv_client_ack_ipv6(net, skb, tcp, opts,
 						  ntohl(tcp->seq))) {
-- 
2.47.3
Technical Details
Message-ID: <20261123135726.3940688-9-pablo@netfilter.org>
Path: mbox-mo1.pugleaf.net!srv.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-369448-linux-kernel-netdev=dewy.ru
References: <20261123135726.3940688-1-pablo@netfilter.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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-369448-linux-kernel-netdev=dewy.ru
From: pablo@netfilter.org (Pablo Neira Ayuso)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 08/15] netfilter: nft_synproxy: only handle pure SYN and ACK packets
Date: Mon, 23 Nov 2026 14:57:19 +0100
Organization: Usenet Network
Message-ID: <20261123135726.3940688-9-pablo@netfilter.org>
References: <20261123135726.3940688-1-pablo@netfilter.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3894587"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2k+YkVsvrGcx9dPZv/NZA8ZUeec= sha256:zREHuISz9ZbCDpBGWos7twByZiR3yyilCXdpIkDqhOw=
	sha1:uCoZC2Ce7qtPxdgz7jVnJ9Vrifs= sha256:Mm0As+OO3wjoXI7gHVI0JNF0T9CvdB+kobsEzW/LecM=
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 895E5125DB6; Mon, 23 Nov 2026 16:58:16 +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 phVVfXLWd18f;
	Mon, 23 Nov 2026 16:58:13 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-369448-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 8284E125DB7; Mon, 23 Nov 2026 16:58:04 +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 A4AA325FDC; Mon, 23 Nov 2026 13:58:00 +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=1795442271;
	b=mp8oNLZ6f+UpARV1zatZoP3Xtj0u2+tN6e9Qp7OLQ/NKtxKMIal3bV1PPgiIxeKGtKmL
	 mXYW96H6JLCuMM1StSdSSne0Fx54sPi3xNbSa7ScaXTKs2tugsPlIL+Ie5y7T1KWBSDRd
	 XASOwAKmJpfeje+N93LeH5iBDhfQpVjTZ4dLurTzLOIE2W0vZ+uaUjSmZ+UrNA9htR6k6
	 aa4u2csJsJIbejU/hIvhXG3WtceCOW7RT3cFc1iEKPnlrgQK53XZtPm6IgoOFM7E+Y9tx
	 fkQi8qJX2gky7F1C524SRAb2M7CI9uO13zmNi9wRVzWQjC99V8uf5gL1EJrsau+52PA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795442271;
	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=S7xkWiqqFqg9jXR+/p6MoARXsQBC0WdioQvUUUYQego=;
	b=KdsVyaTfBax6cipPYoyMp0y75SCaAVbk18kbk1qPp2hbu+QAGWNvwKgghYj8yjbRCFxW
	 PB1Jv+RjntDfePEaciCV2fIDcRaXLUY/YJcJB4pLysKuV58/65pA7pt0yp7DjwnloNlxI
	 uG+whXTGqSdaOsujAcQXMjT1O+C3CGaM72f7nVECfwaQ/kz5OVzwHYc5+NIeUCJyp0Y/i
	 0a6ocHlYe/TQziH85vYFCYjcHsFZ5UmvkZjjxI8U8/pD8KanDzATOqVJoqCcEmi/A5+Q3
	 CnQe3TJPOKgxwvK5P/r2M4bNajzYg+i2x+ekrsafSxsJElkTK0aqUAJBn067LFybYhA==
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=GVOJPYlQ;
	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 54A88606A6AA;
	Mon, 23 Nov 2026 13:57:51 +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=GVOJPYlQ
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=1795442265;
	b=Gmzionc0EUAvyDJsopQ2PcbtGc0ujwZ7uP1oT2bRqFPHJQN6k6tlBG61+c+xiTMzsn5J
	 OR7dQcHKxfU4hMO1mJK6GUvJ4f5h6qOwKYOMvmDW8Qoa8jEH8QrcbB6QpVqaS+dko2rYe
	 ttIe+tyIMBU1N2nwE0jLcWkAheoWnrnWrqEjxm1JgZ40N+mMvfOHPP+VdP7hYUEGqsDTq
	 FwJZWFNQEz7ftnyfU7WO7jf4KC9IKnNcwYTuRua+3R+Umm2X+WMKb+3EOUNDZE6BdcjzY
	 Hoyl+zoD5vvOaLX8h9TEWt1B7reueOp6//+4OwDhIoEXYdf4ImiOa4rWyknP8gfO91g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795442265;
	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=S7xkWiqqFqg9jXR+/p6MoARXsQBC0WdioQvUUUYQego=;
	b=v/PykUvk0xWv2q+GTse76uTwRKlnsCzRNLx5t97mTVNgnITG91CUH7HApM3yh+vZjp7o
	 nWeE6viE0WtbiRHPK0X0HQCnSG1DUTx+S4D+VqzhZktyuLU7pMbiHz5prO+1Pt69I1fTf
	 42Glhf/aZhdU68MM9/jamxli1q2+pkjWlx1klFF0UxdLpWcmWMdTjCGVVen/LR6Gx5i11
	 Ro/9e4iIqMVavS/diRpGMyPC3SBT/8Vt11EPKvOku9IJKbsBbuy2OyvXYHn8DB9B9QBd3
	 OsF8TZXtNn+ZU5ckH/mbkupqmp6Q0H3PKjgLKZEAfF7g3SEqKCoNdCPwflSAJeRT+/A==
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=GVOJPYlQ;
	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 0D054606A695;
	Mon, 23 Nov 2026 13:57:45 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0D054606A695
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=1795442263;
	bh=S7xkWiqqFqg9jXR+/p6MoARXsQBC0WdioQvUUUYQego=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
	b=GVOJPYlQXyNeZcX6Znigh5a6ZU2OMo/dJCBbaf9XfeVUJ9VzzLnF0Zg9H4DxATih3
	 ia+ddF+Ni2f4JVl6v7gVVwU0riTenHadJ276caEskG+Cr0ZDMFaf7m+AHmmG4bLFyD
	 PNBldRS4rJ5HFpgxugcOgPQ1fdP6HZWBimtkuxOz2OoWx5LroD03ZRy3jFcSdEF8Lp
	 XTEsepUFVq53Tp6RtXA1YmfGne43S4ud/KZjmckwl4LdYXLWT49WaWrYYok8tcbVaY
	 LSvMj4bdZdonT9tfDqo8C7S6efYKFiXmxLaiUloEqQE6g5LKrn/vs74QThaI88a7Q7
	 t06Scw9T+xw+A==
X-Received: from localhost.localdomain (mail-agni [217.70.190.124])
	by mail.netfilter.org (Postfix) with ESMTPSA id 0585E602F5;
	Mon, 23 Nov 2026 14:57:42 +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: <20261123135726.3940688-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