Skip to main content

CVE-2024-38596: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2024-38596cvecve-2024-38596
Published: Wed Jun 19 2024 (06/19/2024, 13:45:45 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg A data-race condition has been identified in af_unix. In one data path, the write function unix_release_sock() atomically writes to sk->sk_shutdown using WRITE_ONCE. However, on the reader side, unix_stream_sendmsg() does not read it atomically. Consequently, this issue is causing the following KCSAN splat to occur: BUG: KCSAN: data-race in unix_release_sock / unix_stream_sendmsg write (marked) to 0xffff88867256ddbb of 1 bytes by task 7270 on cpu 28: unix_release_sock (net/unix/af_unix.c:640) unix_release (net/unix/af_unix.c:1050) sock_close (net/socket.c:659 net/socket.c:1421) __fput (fs/file_table.c:422) __fput_sync (fs/file_table.c:508) __se_sys_close (fs/open.c:1559 fs/open.c:1541) __x64_sys_close (fs/open.c:1541) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) read to 0xffff88867256ddbb of 1 bytes by task 989 on cpu 14: unix_stream_sendmsg (net/unix/af_unix.c:2273) __sock_sendmsg (net/socket.c:730 net/socket.c:745) ____sys_sendmsg (net/socket.c:2584) __sys_sendmmsg (net/socket.c:2638 net/socket.c:2724) __x64_sys_sendmmsg (net/socket.c:2753 net/socket.c:2750 net/socket.c:2750) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) value changed: 0x01 -> 0x03 The line numbers are related to commit dd5a440a31fa ("Linux 6.9-rc7"). Commit e1d09c2c2f57 ("af_unix: Fix data races around sk->sk_shutdown.") addressed a comparable issue in the past regarding sk->sk_shutdown. However, it overlooked resolving this particular data path. This patch only offending unix_stream_sendmsg() function, since the other reads seem to be protected by unix_state_lock() as discussed in

AI-Powered Analysis

AILast updated: 06/29/2025, 11:41:57 UTC

Technical Analysis

CVE-2024-38596 is a concurrency vulnerability in the Linux kernel's AF_UNIX socket implementation, specifically involving a data race condition between the functions unix_release_sock() and unix_stream_sendmsg(). The issue arises because unix_release_sock() writes to the sk_shutdown field of the socket structure using an atomic WRITE_ONCE operation, but unix_stream_sendmsg() reads this field without atomic protection. This mismatch leads to a data race detected by the Kernel Concurrency Sanitizer (KCSAN), which can cause inconsistent or corrupted socket state. The vulnerability affects Linux kernel versions prior to the patch introduced around commit dd5a440a31fa (Linux 6.9-rc7). The problem is a subtle concurrency bug where the socket shutdown state can be read and written simultaneously without proper synchronization, potentially leading to undefined behavior or kernel instability. Although a previous patch (commit e1d09c2c2f57) addressed similar data races around sk_shutdown, it did not cover this particular code path in unix_stream_sendmsg(). The vulnerability is rooted in kernel-level socket handling code, which is critical for inter-process communication on Linux systems. No known exploits are currently reported in the wild, and the vulnerability requires kernel-level access or the ability to trigger specific socket operations concurrently. The impact is primarily on kernel stability and reliability, with potential for denial of service through kernel crashes or unpredictable behavior. Exploitation does not appear to allow privilege escalation or arbitrary code execution directly, but the race condition could be leveraged in complex attack scenarios involving kernel memory corruption. The vulnerability is technical and requires detailed understanding of Linux kernel internals to exploit or mitigate.

Potential Impact

For European organizations, the impact of CVE-2024-38596 depends on their reliance on Linux-based infrastructure, particularly systems that use AF_UNIX sockets extensively for inter-process communication. Many enterprise servers, cloud platforms, and embedded devices in Europe run Linux kernels potentially affected by this vulnerability. The data race could lead to kernel crashes or instability, resulting in denial of service conditions that disrupt critical services, especially in sectors like finance, telecommunications, healthcare, and government where Linux servers are prevalent. While no direct data breach or privilege escalation is indicated, service outages caused by kernel panics can lead to operational downtime, loss of productivity, and potential regulatory compliance issues under frameworks like GDPR if service availability is impacted. The vulnerability is particularly relevant for organizations running custom or older Linux kernel versions that have not yet applied the patch. Since AF_UNIX sockets are commonly used for local IPC, containerized environments and microservices architectures prevalent in European data centers may also be affected, increasing the risk surface. Overall, the threat poses a medium risk to availability and system integrity but does not directly compromise confidentiality.

Mitigation Recommendations

European organizations should prioritize updating their Linux kernels to versions that include the patch for CVE-2024-38596, specifically those released after commit dd5a440a31fa (Linux 6.9-rc7) or corresponding stable releases. For environments where immediate kernel upgrades are not feasible, organizations should audit and limit the use of AF_UNIX sockets in high-risk or multi-tenant environments to reduce concurrent access scenarios that trigger the race. Employing kernel concurrency sanitizers (KCSAN) in development and testing environments can help detect similar race conditions proactively. Container orchestration platforms should ensure underlying host kernels are patched and consider isolating critical services to minimize impact from kernel instability. Additionally, monitoring kernel logs for KCSAN warnings or unusual socket-related errors can provide early detection of exploitation attempts or instability. Organizations should also review their incident response plans to handle potential denial of service events caused by kernel crashes. Collaboration with Linux distribution vendors to receive timely security updates and backports is essential for maintaining secure kernel versions. Finally, applying strict access controls to limit untrusted users’ ability to create or manipulate AF_UNIX sockets can reduce exploitation risk.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-06-18T19:36:34.931Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9829c4522896dcbe2a7e

Added to database: 5/21/2025, 9:08:57 AM

Last enriched: 6/29/2025, 11:41:57 AM

Last updated: 8/13/2025, 4:01:07 AM

Views: 19

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats