🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21039

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

#21039
From: Pablo Neira Ayuso
Date: Mon, 23 Nov 2026 13:54
68 lines
11055 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: <20261123135442.3940372-9-pablo@netfilter.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369430-linux-kernel-netdev=dewy.ru
References: <20261123135442.3940372-1-pablo@netfilter.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369430-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:54:35 +0100
Organization: Usenet Network
Message-ID: <20261123135442.3940372-9-pablo@netfilter.org>
References: <20261123135442.3940372-1-pablo@netfilter.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3893875"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:HHjZV8oUrZvCoumabjHJeKrNcw0= sha256:qSzSzFn1UmKaBuGP9wDYtEu4MHq9mPJyjZ2FrVznyKs=
	sha1:yYuydzncUWN3PXPdhrSnBOvLxsI= sha256:wElKyCOG+eSnQ6L+1anXZPJLfo1l7lejuuHeWhq1I4w=
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 3A225125DB8; Mon, 23 Nov 2026 16:56:39 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, URIBL_BLOCKED=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 TiAEDZ3uKZpn;
	Mon, 23 Nov 2026 16:56:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369430-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 1BB63125DB4; Mon, 23 Nov 2026 16:56:27 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 45B5534D9B; Mon, 23 Nov 2026 13:55:07 +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=1795442105;
	b=VH/2aOIw6OftiPXAGY74lwky8ggguqm+pQmlI0lvQGJhEOk/rYnv55RILkSdX3/eEzVo
	 HsjljaqydpEFpMqR075DY1GnHxRGjUk2o0h2FyKER7pGR1h9khOgY7AuhHehBLmyYApk2
	 0HnLPMs74PROpJqMxUKKZJMwEeC7MeuuC5XHZK2dINYB4wXqQLeqRB54HXUEcAUecFIvG
	 L81ZmI0xWV2TawRsBwccrbs/KtoeGqOjDSe3g5uxBxb2g7zvmT0847NHZsvdrEsJRXkz+
	 TLWR3wNRwUON2VVQJpEplSorJ7zJolxHjqqir3G5EWLfZ2ajps4Kd9okOIvzg5hjDBg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795442105;
	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=U5oGNIBYqzEzvC5xt1s2VYJkR0goKlX19kufyJgRlRWH6lOccxOD+BLgwOC0r63tTR9P
	 zdQEu5lTnZsE8LeSLU8SLJ6f2JTZUh0CSobYwluFoMXjNqYyG7cIXOK1r9F2vFylIL/Sq
	 eunDWgHo9u5DQj8BciwuTSklUoD4BZkeZc0FvMwebqLRHbsoeb1gS1GCnSOq+stp60Jrb
	 AOKl3qU1TGfGEvmKtWdXB1bsf2eZ80maBvmbMRV0x4U5JnT1mR7D9lH7v7wH2ICdNcpLw
	 RBUxCKYWPkCQGS9g6eY7zOuJFuVD/SjDs4RN+hxL7lsXBHQ5LPZrz2f8s7lkJSL5YVQ==
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=wCrXgCSX;
	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 008BC606A32A;
	Mon, 23 Nov 2026 13:55:05 +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=wCrXgCSX
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=1795442104;
	b=xEGcPu/PAHkI56FUGBk4a0gfAmKBsS/eka02c+PnpnHYem6UwAgUCMe/Ep5pHrkarnaY
	 itxwQJFyYwwiaLTfLxPX2b7F1JHy5E5bQeutT5Bw1xvd6CnJu8WsGvAWCA455LaqdEffc
	 fqM+jBhWnIlV7IETMEoGP+bDUmafrcjZIfbHv0ODCuuGAlq6HMNJ5PIolvUFX74u7GWDq
	 5/oQCdC419EoOD2MfHB2vTvC/YHQ9YC2WR4sj9cpm6Qn27kzlkG8gt9mo4zFCgLgi1fB9
	 8U+zK9SvxisijTNzKU72Dw/UCfhu0YZtYoNF2OczTvgLwizCHMMrwKLpbZcpItHIMQg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795442104;
	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=ySWIzbNwrLfbPD7a1Fio3Edaz2Xw+HFIW3XcpZhqb4tUVWB7U2z9VRzBU4DgOVLoiDXq
	 Nekwng5Cd3DxTy7SGZlTf1DQnyU+f6EJ4HAkqiBdUElo0RKB3SUw3oc7JAvAG7S6Ps0xv
	 aOw7Lst9q8jXGg0GqZVMIYOAVsLNp/5G/iFjN3GQWDGW1lPZFPNT84Dm+mQCxCZwuwIKf
	 igRNlLB7prleFHT9Yofzbo3bpczbgUKdU8cbn2cIL4m/Iw+63vQcq7F0JufJMuBH0oz3y
	 J+CCEBY3qxWwuaLOuJtjo8s4/Rw/OEL8TgZ7jzRF8Bww9uBvjIzc1V4Q6n1JXb2KWDw==
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=wCrXgCSX;
	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 ABD5B606A337;
	Mon, 23 Nov 2026 13:55:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ABD5B606A337
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=1795442100;
	bh=S7xkWiqqFqg9jXR+/p6MoARXsQBC0WdioQvUUUYQego=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
	b=wCrXgCSXgJrfqkpVn0zilMZMORieaxMmoqO38wq8yfIgPSzxIlqEN5B4qe4LUHAH3
	 dUxlOups7CO+oXbGLtd4bwfhal2qUp0YcoZirUdi7+5In9cS1ddmlgpsMy+x+JrhZu
	 jTEiqTiZoyIf6IEk0zgTnxjWPib2j7CFYp2uJlVM17y+V9r699XCbFtI6PNiQ7sBjy
	 8xAVrj4z88QVU2WJqxtwAlQmvp055Qm7H8yvjGnUiLLfu6cBDS4ReN8GJcPupSL3TS
	 ObrHRvg2Tx+TT8f7B7vIwY0FYXshdh8B1OcwDnTvZZ1KiEUZJWwPYA9IE9z1wnVXfQ
	 eH2Nexnm+1jJg==
X-Received: from localhost.localdomain (mail-agni [217.70.190.124])
	by mail.netfilter.org (Postfix) with ESMTPSA id A19B6602D6;
	Mon, 23 Nov 2026 14:54:59 +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: <20261123135442.3940372-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