From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41B862F9D85; Thu, 28 May 2026 20:46:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780001213; cv=none; b=WcA5q5shVMD0SzmuoLKkyIc/bObzJIFlty55quryG0FqXAhaEx5SWnAXE2pH/q+O6h2Ihc/U1f8+sLd4we9iPmtA8McUO622rbEo+PTjzTceIxLMbDbLw8LtF9tFlvxENibEJs0b0y5c4fvLt7jeHKqd47YCNDq/Fryr9rCNzhM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780001213; c=relaxed/simple; bh=DyH6nBvdJDWOxPtPXiXN07/nhUZBeTQ9HMogrSs89Fk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O4ZYxZkl6s1f7UksamvwdE4CMafI2lJNv5Ivwep0DxPs+9057CdWrJAyvx/Ikay7zINBDIrlQEZMf7z8MjfHKSIf+TWpPzW+2XHbeSc1HS/ErYbHg/+5Z4jXeM/hhTUIEK0kPVHS/kf8UVEWT+tCWp3jwnL9bS7wUi0SDJUk+T0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cL2xvkyz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cL2xvkyz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A71FD1F000E9; Thu, 28 May 2026 20:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780001212; bh=xr46h6UztzwAmZSj9uqUArzdPxeGc9ON+/r32yn46vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cL2xvkyzbqZU9ESmgp7v7ythecvPpuGe1q2jWkgDBTXx250siyKe+Of7vgDvO0UXu dSfe5mCcOI72bgc2ytCiBNUtexoqJ/M9AJ7Dw//OAufgiYFP5GB62ONWA6ik0VfNL6 Ab34AYf7vEaU3wWjzI/67Ro2WNUt8qx0Y4IyjKgc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yizhou Zhao , Yuxiang Yang , Xuewei Feng , Qi Li , Ke Xu , Fernando Fernandez Mancera , Pablo Neira Ayuso Subject: [PATCH 6.6 047/186] netfilter: nft_inner: Fix IPv6 inner_thoff desync Date: Thu, 28 May 2026 21:48:47 +0200 Message-ID: <20260528194930.240082487@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194928.941004471@linuxfoundation.org> References: <20260528194928.941004471@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yizhou Zhao commit b6a91f68ebfed9c38e0e9150f58a9b85da07181c upstream. In nft_inner_parse_l2l3(), when processing inner IPv6 packets, ipv6_find_hdr() correctly computes the transport header offset traversing all extension headers, but the result is immediately overwritten with nhoff + sizeof(_ip6h) (40 bytes), which only accounts for the IPv6 base header. This creates a desync between inner_thoff (wrong — points to extension header start) and l4proto (correct — e.g., IPPROTO_TCP), enabling transport header forgery and potential firewall bypass. This issue affects stable versions from Linux 6.2. For comparison, the normal (non-inner) IPv6 path correctly preserves ipv6_find_hdr()'s result. Removing the incorrect overwrite ensures that ipv6_find_hdr()'s calculated transport header offset is preserved, thereby fixing the desynchronization. Fixes: 3a07327d10a0 ("netfilter: nft_inner: support for inner tunnel header matching") Cc: stable@vger.kernel.org Reported-by: Yizhou Zhao Reported-by: Yuxiang Yang Reported-by: Xuewei Feng Reported-by: Qi Li Reported-by: Ke Xu Assisted-by: GLM:5.1 Z.ai Signed-off-by: Yizhou Zhao Reviewed-by: Fernando Fernandez Mancera Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nft_inner.c | 1 - 1 file changed, 1 deletion(-) --- a/net/netfilter/nft_inner.c +++ b/net/netfilter/nft_inner.c @@ -156,7 +156,6 @@ static int nft_inner_parse_l2l3(const st return -1; if (fragoff == 0) { - thoff = nhoff + sizeof(_ip6h); ctx->flags |= NFT_PAYLOAD_CTX_INNER_TH; ctx->inner_thoff = thoff; ctx->l4proto = l4proto;