Skip to main content
Vulnerability Database/CVE-2024-39503

CVE-2024-39503: Linux Kernel Race Condition Vulnerability

CVE-2024-39503 is a race condition flaw in Linux Kernel's netfilter ipset that enables use-after-free attacks during namespace cleanup. This article covers the technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-39503 Overview

CVE-2024-39503 is a race condition vulnerability in the Linux kernel's netfilter ipset subsystem. The flaw affects the list:set type, where namespace cleanup races with the garbage collector (GC). Namespace cleanup can destroy list:set sets while the GC waits to run in RCU cleanup, causing the GC to operate on freed data. This results in a use-after-free condition classified under [CWE-362].

Lion Ackermann reported the race condition. The fix removes garbage collectors before destroying sets, corrects the ordering for single-set destruction, adds missing RCU locking in the userspace test case, and introduces proper RCU list handling for the list:set type.

Critical Impact

A local authenticated user with network namespace privileges can trigger memory corruption in kernel space, potentially leading to privilege escalation or kernel panic.

Affected Products

  • Linux kernel versions prior to the fix commits in stable branches
  • Linux kernel 6.8 release candidates (rc3 through rc7) and 6.8 GA
  • Linux kernel 6.10 release candidates (rc1 through rc3)

Discovery Timeline

  • Vulnerability reported by Lion Ackermann
  • 2024-07-12 - CVE-2024-39503 published to NVD
  • 2026-10-15 - Last updated in NVD database

Technical Details for CVE-2024-39503

Vulnerability Analysis

The vulnerability resides in the netfilter: ipset subsystem, specifically in the list:set set type. The ipset framework allows administrators to define sets of IP addresses, networks, ports, or other sets referenced from iptables rules. The list:set type contains references to other ipsets, enabling hierarchical set construction.

When a network namespace is destroyed, the kernel tears down all ipset resources associated with that namespace. In parallel, a garbage collector scheduled through Read-Copy-Update (RCU) may be queued to run against the same list:set instances. The destruction path removes sets before guaranteeing that all pending RCU callbacks have completed, allowing the GC to dereference memory already freed by the namespace cleanup path.

Root Cause

The root cause is improper ordering between resource destruction and RCU callback drainage ([CWE-362] Concurrent Execution using Shared Resource with Improper Synchronization). The list:set destruction logic did not consistently remove garbage collectors first and wait for in-flight callbacks before freeing the backing set structures. Additionally, the userspace test code path omitted required rcu_read_lock() protection, and the list traversal did not use RCU-safe list primitives.

Attack Vector

Exploitation requires local access and the CAP_NET_ADMIN capability within a network namespace, which is accessible to unprivileged users on systems that permit unprivileged user namespaces. An attacker constructs list:set ipsets inside a namespace, triggers garbage collection activity, then forces namespace teardown to race the GC against set destruction. Successful races produce a use-after-free on kernel heap memory. The attack complexity is high because it depends on precise timing between the GC worker and the namespace cleanup thread.

No verified public proof-of-concept exploit code was referenced in the advisory. The vulnerability is described in prose in the upstream commit messages linked in the kernel.org references.

Detection Methods for CVE-2024-39503

Indicators of Compromise

  • Kernel oops or panic messages referencing ip_set_list_set functions or list_set_gc in the call trace
  • KASAN (Kernel Address Sanitizer) reports of use-after-free in net/netfilter/ipset/ip_set_list_set.c
  • Unexpected network namespace teardown failures correlated with ipset activity in dmesg

Detection Strategies

  • Enable KASAN on test and staging kernels to surface memory corruption triggered during ipset fuzzing or workload replay
  • Audit kernel package versions across the fleet and flag hosts running affected Linux 6.8 and 6.10 release candidates
  • Correlate workload telemetry for processes creating network namespaces alongside heavy ipset manipulation using tools such as nsenter or unshare

Monitoring Recommendations

  • Monitor /var/log/kern.log and journalctl -k for use-after-free or RCU stall warnings tied to the netfilter subsystem
  • Track container runtimes and orchestrators for abnormal rates of namespace creation and destruction from non-system accounts
  • Alert on execution of ipset commands by non-root UIDs operating inside user namespaces

How to Mitigate CVE-2024-39503

Immediate Actions Required

  • Apply the latest stable Linux kernel update from your distribution that incorporates the upstream fixes
  • Inventory systems running Linux 6.8 and 6.10 release candidate kernels and prioritize them for patching
  • Restrict creation of unprivileged user namespaces where operationally feasible by setting kernel.unprivileged_userns_clone=0 or equivalent

Patch Information

The fix was merged into the mainline kernel and backported to stable trees through commits 0f1bb77c6d83, 2ba35b37f780, 390b353d1a1d, 4e7aaa6b82d6, 90ae20d47de6, 93b53c202b51, and c0761d1f1ce1. The patch depends on prior commit c1193d9bbbd3 (netfilter: ipset: Add list flush to cancel_gc). Vendor advisories are also published by Debian LTS and Siemens (SSA-265688, SSA-355557, SSA-613116).

Workarounds

  • Disable the ip_set_list_set kernel module via modprobe -r ip_set_list_set and blacklist it where list:set ipsets are not required
  • Prevent unprivileged user namespace creation to limit attacker access to CAP_NET_ADMIN inside namespaces
  • Constrain container workloads with seccomp or AppArmor profiles that block the ipset netlink interface
bash
# Disable unprivileged user namespaces and blacklist the vulnerable module
sysctl -w kernel.unprivileged_userns_clone=0
echo 'blacklist ip_set_list_set' > /etc/modprobe.d/cve-2024-39503.conf

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.