Skip to main content
Mallory
← Back to News
endpoint-software-vulnerabilityopen-source-dependency-vulnerability

Linux Kernel TCP Race Condition Exposed as Real Use-After-Free

Vulnerability Disclosure · 6 sources · Updated 3mo ago · First seen May 3, 2024

Linux Kernel TCP Race Condition Exposed as Real Use-After-Free

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
Do you run this?See affected versions and whether adversaries are exploiting it.
Check your exposure
Event timeline

How this story unfolded

Events from the most recent confirmed update back to the earliest known activity.

4 events · Dec 13, 2017 – Jul 21, 2025
  1. Jul 21, 20251y ago

    Allele publishes CVE-2024-36904 research repository and PoC materials

    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.

    research/CVE-2024-36904 at master · alleleintel/research · GitHub
  2. Reported Feb 5, 20252y ago

    Allele Security discloses CVE-2024-36904 analysis

    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.

    Accidentally uncovering a seven years old vulnerability in the Linux kernel
  3. May 3, 20243y ago

    Upstream patch fixes tcp_twsk_unique refcount bug

    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.

    tcp: Use refcount_inc_not_zero() in tcp_twsk_unique(). · torvalds/linux@f2db723 · GitHub
  4. Dec 13, 20179y ago

    Linux commit introduces TCP time-wait refcount race

    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.

    tcp/dccp: avoid one atomic operation for timewait hashdance · torvalds/linux@ec94c26 · GitHub
Linked entities

Related entities

Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.

Open in app →

Affected products

1 linked
Linux Kernel
Do you run this?See whether adversaries are exploiting this yet, and where the affected versions run in your environment.
Check Your Exposure
Mallory platform

See the full picture, correlated to your attack surface.

This page covers what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which threat actors are using it right now, and what to deploy next.

Exposure mappingMap indicators from this story to your assets and identify affected systems in minutes.
Threat actor evidenceEvery observed campaign, victim, and pivot linked to actors named in this story.
Associated malwareMalware, exploits, and IOCs connected to the activity described here.
Detection signaturesYARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Scheduled alertsGet matching new stories delivered to your team as they break, not the next morning.
AI threadsAsk questions about this story and take action on the answers.