KernelScan.io

HIGH

netfilter NFTables Chain UAF

CVE-2026-23231

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI7.8HIGH

01

In the Linux kernel, the following vulnerability has been resolved: netfilter: nf_tables: fix use-after-free in nf_tables_addchain() nf_tables_addchain() publishes the chain to table->chains via list_add_tail_rcu() (in nft_chain_add()) before registering hooks. If nf_tables_register_hook() then fails, the error path calls nft_chain_del() (list_del_rcu()) followed by nf_tables_chain_destroy() with no RCU grace period in between. This creates two use-after-free conditions: 1) Control-plane: nf_tables_dump_chains() traverses table->chains under rcu_read_lock(). A concurrent dump can still be walking the chain when the error path frees it. 2) Packet path: for NFPROTO_INET, nf_register_net_hook() briefly installs the IPv4 hook before IPv6 registration fails. Packets entering nft_do_chain() via the transient IPv4 hook can still be dereferencing chain->blob_gen_X when the error path frees the chain. Add synchronize_rcu() between nft_chain_del() and the chain destroy so that all RCU readers -- both dump threads and in-flight packet evaluation -- have finished before the chain is freed.

02

Engine v0.2.0

Risk summary

A use-after-free vulnerability in netfilter's nf_tables allows memory corruption when chain creation fails. An attacker with network admin privileges could potentially trigger this during chain setup failures, leading to kernel crashes or possible privilege escalation. The vulnerability affects both packet processing and administrative operations.

Affectednet/netfilter/nf_tables_api.c

Vulnerability analysis

Root Cause: In nf_tables_addchain(), the chain is published to table->chains via list_add_tail_rcu() before hook registration. If nf_tables_register_hook() fails, the error path calls nft_chain_del() (list_del_rcu()) followed immediately by nf_tables_chain_destroy() without waiting for RCU grace period. This creates a race where RCU readers can still access the chain while it's being freed.

Attack Surface: Network-accessible through netfilter packet processing and netlink control interface. Requires CAP_NET_ADMIN privileges to create chains, but the race can be triggered during legitimate chain creation failures. Affects both IPv4 and IPv6 packet paths when NFPROTO_INET is used.

Fix Mechanism: The patch adds synchronize_rcu() between nft_chain_del() and chain destruction in the error path. This ensures all RCU readers (both control-plane dump operations and packet processing) complete before the chain memory is freed, eliminating the use-after-free condition.

03

BranchFixed inPatch commit
6.16.1.1652a6586ecfa4c
6.126.12.75f3fe58ce3792
6.186.18.14dbd0af8083dd
6.196.19.42f9a4ffeb763
6.66.6.1287017745068a9
mainline7.071e99ee20fc3