Recently, a critical use-after-free vulnerability was discovered in the Linux kernel's Netfilter functionality. This flaw, registered as CVE-2023-4147, allows local users to cause crashes or escalate their privileges on the system. In this post, we will take a close look at the vulnerability, its associated code snippet, original references, and exploitation details.


Netfilter is a framework inside the Linux kernel, responsible for filtering and manipulating network packets. It is used by many firewall implementations, including the popular iptables and more recent nftables. The vulnerability (CVE-2023-4147) was found when a user attempts to add a rule with NFTA_RULE_CHAIN_ID in the Netfilter system.

Let us now take a closer look at the code snippet where the use-after-free flaw occurs

1. struct nft_rule *rule;
2. struct nft_chain *chain;
3. ...
4. nft_rule_chain_get(chain, NLA_GET_BE32(info->nlattr[NFTA_RULE_CHAIN_ID]);

In the above code snippet, the function


is used to obtain a chain object and increment its reference count. This is where the use-after-free flaw occurs, with the chain object potentially being freed before the reference count is incremented.

The following are the primary references to this vulnerability

1. Official CVE entry:
2. NVD entry:
3. Linux Kernel Mailing List announcement:

Exploit Details

This vulnerability is particularly dangerous because it allows a local user to escalate their privileges or crash the system. To exploit this flaw, an attacker can construct a crafted netlink message, which they then use to trigger the use-after-free. The exploitation process can then leverage the use-after-free to gain kernel code execution and eventually escalate privileges on the targeted system.

Although there is no known public exploit at this time, it is essential to apply the appropriate security patches to mitigate any potential risk. Various Linux distributions have already released security updates to address this vulnerability. Users are encouraged to apply these patches to ensure the safety of their systems.


CVE-2023-4147 represents a critical security issue in the Linux kernel's Netfilter functionality. With the potential for system crashes and privilege escalations, it is imperative that users and administrators update their systems with the latest security patches. It's essential to stay informed about new vulnerabilities and proactively secure our systems to minimize the risk of exploitation.


Published on: 08/07/2023 14:15:00 UTC
Last modified on: 09/12/2023 16:15:00 UTC