Linux Kernel TCP Race Condition Exposed as Real Use-After-Free
Vulnerability Disclosure · 6 sources · Updated 3mo ago · First seen May 3, 2024

Researchers disclosed CVE-2024-36904, a seven-year-old race condition in the Linux kernel TCP subsystem that can lead to a real use-after-free involving TIME-WAIT sockets. The flaw was introduced by commit ec94c2696f0b, which changed inet_twsk_hashdance() so a socket could be inserted into the established hash table before its reference counter was initialized, allowing concurrent code in paths such as tcp_twsk_unique() and __inet_check_established() to observe a zero refcount and corrupt socket lifetime handling. The issue was first encountered while investigating a syzkaller report that appeared tied to KCM, but researchers determined it was unrelated and reproducible even with CONFIG_AF_KCM disabled.
Allele Security reproduced the bug on a RHEL-derived 5.14.0-362.24.2.el9_3.x86_64 kernel and on Fedora 39 6.8.6-200.fc39.x86_64, where it initially manifested as refcount warnings. The researchers said Linux refcount protections usually degrade such races into leaks, but in this case a later refcount_set() could overwrite the saturated value and create an unbalanced reference count, enabling premature free; with a modified KASAN-enabled research kernel, they obtained an actual use-after-free report in inet_twsk_put(). Upstream addressed the flaw in commit f2db7230f73a by changing tcp_twsk_unique() to use refcount_inc_not_zero() before taking a reference to the TIME-WAIT socket.
Why it matters
Impact assessment
CVE-2024-36904 affects Linux systems running vulnerable kernel builds with TCP enabled, including enterprise Linux derivatives and Fedora kernels confirmed by researchers. The flaw is a kernel memory-safety issue in TCP TIME-WAIT socket handling that can progress from refcount corruption to a real use-after-free, creating risk of kernel instability, crashes, and potentially further exploitation depending on local conditions.
The exposure is broad at the platform level because the bug lived upstream for about seven years in common Linux networking code, but practical triggering appears race-dependent rather than trivially reliable. The provided references do not report confirmed in-the-wild exploitation; they document researcher reproduction and proof that the condition is a genuine use-after-free rather than only a benign refcount warning.
Affected populations and products
- Linux systems using vulnerable kernel versions in the TCP/IPv4 stack
- Confirmed reproductions on:
- RHEL-derived kernel 5.14.0-362.24.2.el9_3.x86_64
- Fedora 39 kernel 6.8.6-200.fc39.x86_64
- AlmaLinux 9 research environment based on 5.14.0-362.24.2.el9_3.x86_64
- Industries most exposed: any organization operating Linux servers, appliances, containers, or virtualized workloads with significant TCP connection churn
Severity and business effect
- Kernel-level use-after-free can cause:
- system crashes or instability
- service disruption in network-facing workloads
- possible security impact beyond denial of service if exploitability is improved
- Reputational and operational risk is highest for internet-facing Linux services and multi-tenant environments where kernel reliability matters
Scope and exploitation status
- Scope is potentially widespread due to upstream age and placement in core networking code
- Triggering is race-condition dependent and may require sustained or engineered connection activity
- No explicit evidence of active exploitation in the wild is provided in the references
- Researchers demonstrated a real use-after-free with KASAN on a modified kernel, confirming the bug is not merely theoretical


