Re: [PATCH] netfilter: nf_conntrack: prevent helper extension relocation

Pablo Neira Ayuso <[email protected]> Fri, 31 Jul 2026 17:37:07 +0200
Newsgroups gmane.linux.kernel,gmane.comp.security.firewalls.netfilter.devel,gmane.linux.network
Message-ID <amzBI6YKhMX3Ezib@chamomile>
On Fri, Jul 31, 2026 at 02:08:10PM +0000, David Lee wrote:
> struct nf_conn_help contains the head of the per-master expectation
> list. hlist_add_head_rcu() makes the first expectation node point back to
> that head, but nf_ct_ext_add() can later move the extension buffer with
> krealloc(). This leaves the node backpointer aimed at freed memory, so
> unlinking the expectation writes through a stale pointer.
> 
> Reserve the full u8-addressable extension space when adding the helper
> extension and reuse the existing buffer once the helper is present. This
> keeps the expectation list head stable while allowing later extensions
> to be added.
> 
> Fixes: 857b46027d6f ("netfilter: nft_ct: add ct expectations support")
> Bug found and triaged by OpenAI Security Research and 
> validated by Trail of Bits.

Thanks for your patch.

This is a duplicate of:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

proposed fix tackles the problem from the ct expectation feature angle:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/