Skip to main content

CVE-2023-52879: Vulnerability in Linux Linux

High
VulnerabilityCVE-2023-52879cvecve-2023-52879
Published: Tue May 21 2024 (05/21/2024, 15:32:11 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: tracing: Have trace_event_file have ref counters The following can crash the kernel: # cd /sys/kernel/tracing # echo 'p:sched schedule' > kprobe_events # exec 5>>events/kprobes/sched/enable # > kprobe_events # exec 5>&- The above commands: 1. Change directory to the tracefs directory 2. Create a kprobe event (doesn't matter what one) 3. Open bash file descriptor 5 on the enable file of the kprobe event 4. Delete the kprobe event (removes the files too) 5. Close the bash file descriptor 5 The above causes a crash! BUG: kernel NULL pointer dereference, address: 0000000000000028 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 6 PID: 877 Comm: bash Not tainted 6.5.0-rc4-test-00008-g2c6b6b1029d4-dirty #186 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 RIP: 0010:tracing_release_file_tr+0xc/0x50 What happens here is that the kprobe event creates a trace_event_file "file" descriptor that represents the file in tracefs to the event. It maintains state of the event (is it enabled for the given instance?). Opening the "enable" file gets a reference to the event "file" descriptor via the open file descriptor. When the kprobe event is deleted, the file is also deleted from the tracefs system which also frees the event "file" descriptor. But as the tracefs file is still opened by user space, it will not be totally removed until the final dput() is called on it. But this is not true with the event "file" descriptor that is already freed. If the user does a write to or simply closes the file descriptor it will reference the event "file" descriptor that was just freed, causing a use-after-free bug. To solve this, add a ref count to the event "file" descriptor as well as a new flag called "FREED". The "file" will not be freed until the last reference is released. But the FREE flag will be set when the event is removed to prevent any more modifications to that event from happening, even if there's still a reference to the event "file" descriptor.

AI-Powered Analysis

AILast updated: 07/01/2025, 08:11:31 UTC

Technical Analysis

CVE-2023-52879 is a vulnerability in the Linux kernel's tracing subsystem, specifically related to the handling of kprobe events within the tracefs filesystem. The vulnerability arises from improper reference counting of trace_event_file objects that represent kprobe events. When a user creates a kprobe event and opens its 'enable' file descriptor, the kernel maintains a reference to the event's file descriptor. If the kprobe event is deleted while the file descriptor remains open in user space, the kernel frees the event's file descriptor prematurely. Subsequent operations on this stale file descriptor, such as writing to or closing it, lead to a use-after-free condition. This results in a NULL pointer dereference and kernel crash (kernel panic), as demonstrated by the provided commands that cause the kernel to crash with an oops message. The root cause is that while the tracefs file itself is kept alive by open file descriptors, the associated event file descriptor was not reference counted properly, allowing it to be freed too early. The fix involves adding proper reference counting and a 'FREED' flag to prevent further modifications once the event is removed, ensuring the event file descriptor is only freed after the last reference is released. This vulnerability affects multiple Linux kernel versions prior to the patch and can be triggered by local users with access to the tracing subsystem. Exploitation requires the ability to create and manipulate kprobe events in /sys/kernel/tracing, which typically requires elevated privileges or specific capabilities. No known exploits are currently reported in the wild, and no CVSS score has been assigned yet.

Potential Impact

For European organizations, this vulnerability poses a risk primarily to systems running vulnerable Linux kernel versions with tracing enabled and accessible to untrusted or semi-trusted users. The impact is a denial-of-service (DoS) condition caused by a kernel crash, which can disrupt critical services, especially in environments relying on Linux servers for infrastructure, cloud services, or embedded systems. While the vulnerability does not directly enable privilege escalation or code execution, the resulting kernel panic can cause system downtime, data loss, or interruption of business-critical applications. Organizations running Linux-based servers, especially those using tracing for debugging or monitoring, may face operational disruptions. Additionally, if attackers gain local access (e.g., via compromised accounts or containers), they could deliberately trigger this vulnerability to cause service outages. The impact is heightened in sectors with stringent uptime requirements such as finance, healthcare, telecommunications, and critical infrastructure within Europe. Since the vulnerability requires local interaction and specific kernel features, remote exploitation is unlikely without prior access.

Mitigation Recommendations

To mitigate CVE-2023-52879, European organizations should: 1) Apply the official Linux kernel patches that add reference counting and the FREED flag to the trace_event_file descriptor as soon as they become available from their Linux distribution vendors. 2) Restrict access to the /sys/kernel/tracing filesystem and kprobe event creation to trusted administrators only, using Linux capabilities and access control mechanisms (e.g., SELinux, AppArmor, or file permissions). 3) Disable or restrict kernel tracing features on production systems where tracing is not required to reduce the attack surface. 4) Monitor kernel logs and system behavior for signs of kernel crashes or suspicious activity related to tracing. 5) For containerized environments, ensure containers do not have unnecessary privileges to access kernel tracing interfaces. 6) Incorporate this vulnerability into vulnerability management and patching cycles to ensure timely remediation. 7) Consider implementing kernel lockdown features or secure boot mechanisms to prevent unauthorized kernel modifications or tracing manipulations.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-05-21T15:19:24.265Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9831c4522896dcbe780b

Added to database: 5/21/2025, 9:09:05 AM

Last enriched: 7/1/2025, 8:11:31 AM

Last updated: 8/9/2025, 2:50:13 AM

Views: 15

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