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.

See affected versions and whether adversaries are exploiting it.
4 events from the most recent confirmed update back to the earliest known activity.
Allele published a GitHub repository containing research artifacts for CVE-2024-36904, including the original and minimized syzkaller reproducers, a custom trigger, and a modified research kernel setup used to obtain a KASAN splat confirming a real use-after-free. The materials documented testing on AlmaLinux 9 and showed the modified kernel could trigger the KASAN splat in under 30 minutes.
An upstream Linux kernel commit titled "tcp: Use refcount_inc_not_zero() in tcp_twsk_unique()" added a conditional refcount_inc_not_zero() check and removed a later sock_hold() call. The change addressed the TIME-WAIT socket lifetime race associated with CVE-2024-36904.
A Linux kernel commit titled "tcp/dccp: avoid one atomic operation for timewait hashdance" moved time-wait socket refcount initialization until after releasing the bucket lock and changed the count from 4 to 3. This change introduced the race condition later tracked as CVE-2024-36904.
Allele Security published its analysis of CVE-2024-36904, describing a seven-year-old race condition in the Linux kernel TCP subsystem affecting time-wait sockets. The researchers said they had reported the issue upstream and explained how the bug could lead to a real use-after-free rather than only refcount warnings.
Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.
See whether adversaries are exploiting this yet, and where the affected versions run in your environment.
6 references tracked. Mallory keeps watching after this page renders.
allelesecurity.com
Open sourcegithub.com
Open sourceallelesecurity.com
Open sourcegithub.com
Open sourcelore.kernel.org
Open sourcegithub.com
Open sourceMap indicators from this story to your assets and identify affected systems in minutes.
Every observed campaign, victim, and pivot linked to actors named in this story.
Malware, exploits, and IOCs connected to the activity described here.
YARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Get matching new stories delivered to your team as they break — not the next morning.
Ask questions about this story and take action on the answers.