Article View: linux.kernel.netdev
Article #9178Re: [PATCH] netfilter: br_netfilter: reject unsafe neighbour devices for DNAT
From: Florian Westphal
Date: Sat, 31 Oct 2026 18:50
Date: Sat, 31 Oct 2026 18:50
30 lines
8436 bytes
8436 bytes
Kyle Zeng <kylebot@openai.com> wrote: > The IPv4 and IPv6 bridge prerouting callbacks classify DNAT traffic using > the logical input device saved in skb->dev. The physical input port can > have a different bridge master when prerouting resumes, for example after > an NFQUEUE verdict. Netfilter reassembly can also combine the first > fragment's bridge information with a different fragment's input device. > > br_nf_pre_routing_finish_bridge() replaces skb->dev with the port's > current bridge master, but looks up the neighbour using the existing > route. This can put an skb with skb->dev pointing to bridge B on an > unresolved neighbour of bridge A. Deleting B and resolving the neighbour > on A then causes a use-after-free in __dev_queue_xmit(). > > Before calling the neighbour output method, check that the neighbour > keeps skb->dev alive. A neighbour holds its device, and a VLAN device > also holds its real device, so allow a VLAN whose real device is the > bridge. Release the neighbour and drop the skb on a mismatch. > > Doing this in the shared continuation covers both protocol families, > including a queue in the remaining bridge prerouting hooks. Leave the > cached-header path unchanged since it does not enqueue the skb. > > Signed-off-by: Kyle Zeng <kylebot@openai.com> > --- > I have a reproducer for this issue and can share via DM Please do. I'd like to understand if that needs to be addressed from nfqueue side instead, or if we can avoid neigh layer to begin with.
Technical Details
Message-ID:
<auY4ZAZWQfQtX3oe@strlen.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354126-linux-kernel-netdev=dewy.ruReferences:
<20261030042155.73844-1-kylebot@openai.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354126-linux-kernel-netdev=dewy.ru From: fw@strlen.de (Florian Westphal) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] netfilter: br_netfilter: reject unsafe neighbour devices for DNAT Date: Sat, 31 Oct 2026 19:50:12 +0100 Organization: Usenet Network Message-ID: <auY4ZAZWQfQtX3oe@strlen.de> References: <20261030042155.73844-1-kylebot@openai.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2527700"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:QacK8btB0KR1OXCv7YdVhPyW74o= sha256:8uxTo/8sQodhZ9fdq3xbdhdYJpimDuzwNu9f/YaCKsg= sha1:ZdSIbBSC419olgN/vvAuq1P8PpY= sha256:cRyMaU9Ahz9BkjpVanF6DGs2VwN7a83huyqwS6Xlhho= Content-Disposition: inline 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 8D2BD125CBA; Sat, 31 Oct 2026 21:50:41 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.95 X-Spam-Status: No, score=-2.95 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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-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 eLHnRGRci7T3; Sat, 31 Oct 2026 21:50: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-354126-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=strlen.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 0D9D1125CB9; Sat, 31 Oct 2026 21:50:29 +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 1D30226B48; Sat, 31 Oct 2026 18:50:18 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793472617; b=xe9ioHT5fKQs4g8wloPSNwYNFzqINW+h6tlZWtlmaus/1VYSQrOeGcFW6QYmssx7Qflb T5yuls/hwyIVbE3bkY2wrQ1oklrfUINMJwmXWY0+Xnwye9ngZH4KFrjO8GnV/Zi4IjiFA q/C7eWjEsqqny1go+n/oeZTP29WP/XdLsnG5PNPA5Fbf7UcoIz0+SleO290BnWrmvtiVT M8FUhdsaejBUv6nK5qno1OnsfYaFe2N3t8p1su1VsW1BrQZ5dJTYDqV8PsCdvBj8UdDz5 2h2TSD74X3oh8V4+QTgIWY4NkDKtCB6Vp0i+Z+LF9zf4hsbEPLYS4MfeOkzQOckDBwg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793472617; h=X-Original-To:Received:DMARC-Filter:Received:Date:From:To:Cc:Subject: Message-ID:References:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=mxsr/9eM9IT7x56XlFJqaM4VoKdjWeJUE5kFLUzsU1c=; b=KR3GXDq/7XI1nrniPnS9z1l0m0TvQ2vGa5A5E209g/1xIYsTSpbUuzu7gf5nDkviXdkQ nfP/gfoM82NTtz5slGxF1tEByJrsOrTd95uEjpxyCxkWcQD7JwJNH+S0EmzqQ/BOK08Rn zjj/5/ceF3x4Ldlep3U2viXFSutAyDzbPWX1q1acK6TjyJnTKCafcf6Q+Gch6teyOmzx6 E04adUJDxNlqUU8q85BdvG4NxYFi2LU7W3efG59fBhtlvy6p46fWu7AkauRKSH+XB63nn 5oVaSGLjXTf8UUxsrIzo5EZqwTTPLW+DZ10fNqbc0SNRIc2d3wU+FrkBgJy2VignKjg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=pass header.oldest-pass=0 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 4049B606A32A; Sat, 31 Oct 2026 18:50:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.216.245.30 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793472616; b=4k2glpix+wNWXSmw+7x+VPvpOnaZ0tkTIV3cKpSnNlrYnh/E+AT9fdEZWN+2p2nMY4KQ qyFgMYV/wLZsItgAjgP+4XyttK4f/OLj1kRvZQig0Iwoc9GQJuGAwOq7I7AI0Sr0Ukwv0 kM4/6lqgCzrNpWfsCQOoUD9PwvlI36Z6XOovA5ek5wqjAseZz/tE016mxKdgWx+Cmyd0+ bAZdad7Eh+YR6THitGlxRs/V6B7VuFRqESIrCxGbWLcjz6pcK8032JciUEQN9A4fQxT+E 1IPxmYNCPHwrYFAar7VP5PCFpDO6HSAm+GXlivLEqV9UPceGEVurdbu6O0InfOcHkJg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793472616; h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=mxsr/9eM9IT7x56XlFJqaM4VoKdjWeJUE5kFLUzsU1c=; b=R73xDyP2CsIvqhuKtEGvZHhoh04Ukwp45pxpkyLw4TGZabwiuH19BdxdzTFnkqIyMdh8 d+CTDMqw06Awyx2WPPviBRm2I+p6X7i6iijbRmfatRqljQTd/intgZ7wWSI/dkC/SGxi2 b6YpcKCDs/O2BUasz6n0r/6BBjfFHulclPMWVkFIzP0FDUsur0jUss7ofKvADksXZ1QsH SnScU4BLZMCFY3akQ2u1G9f8fY7Hhpfijz+Fnoemu3ouLRs48Nkli5bAjcWdAz6onuQWN lcnfdU6JZ862tCR7EWIki2OHhVnWu75ScNn89KQgUltNFpgPufCC8Kz3SS9GUqgK0Xg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=strlen.de; spf=pass smtp.mailfrom=strlen.de; arc=none smtp.remote-ip=91.216.245.30 X-Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B287606A31C; Sat, 31 Oct 2026 18:50:15 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5B287606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=strlen.de X-Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003) id DE3DA60796; Sat, 31 Oct 2026 19:50:12 +0100 (CET) X-Cc: netfilter-devel@vger.kernel.org, Pablo Neira Ayuso <pablo@netfilter.org>, coreteam@netfilter.org, bridge@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, outbounddisclosures@openai.com 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 X-In-Reply-To: <20261030042155.73844-1-kylebot@openai.com>