CVE-2024-50130 netfilter: bpf: must hold reference on net namespace

High 7.8 Published Updated

A use-after-free vulnerability in the Linux kernel's netfilter BPF subsystem allows attackers to potentially execute code or escalate privileges.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-50130?

CVE-2024-50130 is a high-severity use after free vulnerability in Linux kernel, published on 5 Nov 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

In the Linux kernel, the following vulnerability has been resolved:

netfilter: bpf: must hold reference on net namespace

BUG: KASAN: slab-use-after-free in __nf_unregister_net_hook+0x640/0x6b0 Read of size 8 at addr ffff8880106fe400 by task repro/72= bpf_nf_link_release+0xda/0x1e0 bpf_link_free+0x139/0x2d0 bpf_link_release+0x68/0x80 __fput+0x414/0xb60

Eric says: It seems that bpf was able to defer the __nf_unregister_net_hook() after exit()/close() time. Perhaps a netns reference is missing, because the netns has been dismantled/freed already. bpf_nf_link_attach() does : link->net = net; But I do not see a reference being taken on net.

Add such a reference and release it after hook unreg. Note that I was unable to get syzbot reproducer to work, so I do not know if this resolves this splat.

Weakness: CWE-416

Which versions are affected by CVE-2024-50130?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-50130?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2024-50130 being exploited?

There is no known exploitation of CVE-2024-50130 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-52332, BELL-CVE-2024-50130, DEBIAN-CVE-2024-50130, GHSA-wqmj-2mp9-xqmr, UBUNTU-CVE-2024-50130.

Is CVE-2024-50130 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free