CVE-2026-31504 net: fix fanout UAF in packet_release() via NETDEV_UP race

High 7.8 Published Updated

A race condition in the Linux kernel packet socket release path allows a use-after-free, potentially enabling local attackers to 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-2026-31504?

CVE-2026-31504 is a high-severity use after free vulnerability in Linux kernel, published on 22 Apr 2026. 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:

net: fix fanout UAF in packet_release() via NETDEV_UP race

`packet_release()` has a race window where `NETDEV_UP` can re-register a socket into a fanout group's `arr[]` array. The re-registration is not cleaned up by `fanout_release()`, leaving a dangling pointer in the fanout array. `packet_release()` does NOT zero `po->num` in its `bind_lock` section. After releasing `bind_lock`, `po->num` is still non-zero and `po->ifindex` still matches the bound device. A concurrent `packet_notifier(NETDEV_UP)` that already found the socket in `sklist` can re-register the hook. For fanout sockets, this re-registration calls `__fanout_link(sk, po)` which adds the socket back into `f->arr[]` and increments `f->num_members`, but does NOT increment `f->sk_ref`.

The fix sets `po->num` to zero in `packet_release` while `bind_lock` is held to prevent NETDEV_UP from linking, preventing the race window.

This bug was found following an additional audit with Claude Code based on CVE-2025-38617.

Weakness: CWE-416, CWE-362

Which versions are affected by CVE-2026-31504?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2026-31504?

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-2026-31504 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as AZL-83231, BELL-CVE-2026-31504, DEBIAN-CVE-2026-31504, GHSA-5v9p-3rfc-6rw2, ROOT-OS-DEBIAN-11-CVE-2026-31504, ROOT-OS-DEBIAN-12-CVE-2026-31504 and 4 more.

Is CVE-2026-31504 in your software?

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

Check your SBOMs for free