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-38627 Overview
CVE-2024-38627 is a double free vulnerability [CWE-415] in the Linux kernel's System Trace Module (STM) class driver. The flaw resides in the stm_register_device() function, where the put_device(&stm->dev) call triggers stm_device_release(), which frees the stm structure. The subsequent vfree(stm) call on the next line then frees the same memory a second time. A local authenticated attacker with low privileges can leverage this condition to corrupt kernel memory, potentially leading to privilege escalation or denial of service.
Critical Impact
Local attackers can trigger kernel memory corruption via the stm class driver, impacting confidentiality, integrity, and availability of affected Linux systems.
Affected Products
- Linux Kernel (multiple stable branches prior to the referenced fix commits)
- Debian Linux distributions tracked in the Debian LTS advisory
- Downstream Linux distributions shipping the vulnerable stm class driver
Discovery Timeline
- 2024-06-21 - CVE-2024-38627 published to the National Vulnerability Database (NVD)
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-38627
Vulnerability Analysis
The vulnerability is a double free condition in the Linux kernel's stm (System Trace Module) class driver, specifically within the stm_register_device() function in drivers/hwtracing/stm/core.c. During an error path in device registration, the code calls put_device(&stm->dev), which decrements the device reference count to zero. This triggers the registered release callback stm_device_release(), which frees the stm structure using vfree(). The error-handling code then explicitly calls vfree(stm) again on the already-freed pointer, producing a classic double free of the same virtually mapped allocation.
Successful exploitation of double free conditions in kernel allocators can corrupt allocator metadata, enable arbitrary write primitives, and ultimately permit privilege escalation from a low-privileged local account. Because the flaw sits in a kernel subsystem, impact spans confidentiality, integrity, and availability of the host.
Root Cause
The root cause is incorrect ownership tracking of the stm allocation. Once put_device() releases the last reference, the lifetime of stm belongs to stm_device_release(), which performs the vfree(). The subsequent cleanup path incorrectly assumes it still owns the pointer and frees it a second time.
Attack Vector
The attack vector is local. An attacker needs the ability to interact with the vulnerable stm class device registration path and reach the error condition that triggers the duplicated free. No user interaction is required, and the attack complexity is low once access to the subsystem is available.
No verified exploitation code is published for this issue. Technical details are available in the upstream kernel commits and the Debian LTS Announcement.
Detection Methods for CVE-2024-38627
Indicators of Compromise
- Unexpected kernel oops, BUG: KASAN: double-free reports, or general protection fault entries referencing stm_device_release or stm_register_device in dmesg or /var/log/kern.log.
- Repeated loading or probing of stm_core and related tracing modules by non-root service accounts.
- Kernel panics or sudden reboots on systems where the stm subsystem is enabled.
Detection Strategies
- Audit installed kernel package versions against the fixed versions referenced in the upstream kernel.org stable commits.
- Monitor kernel ring buffer output for KASAN or SLUB allocator warnings tied to vfree on stm allocations.
- Correlate local process execution with abnormal module load events and kernel crash reports from endpoint telemetry.
Monitoring Recommendations
- Centralize kernel log forwarding so double-free panics and tracing subsystem errors are retained and searchable.
- Alert on local users attempting to interact with /sys/class/stm/ or load stm_core on systems that do not require tracing.
- Track package inventory to confirm all Linux hosts receive the vendor kernel update that remediates this flaw.
How to Mitigate CVE-2024-38627
Immediate Actions Required
- Apply the vendor kernel update that includes the stm class double free fix across all affected Linux hosts.
- Prioritize patching for multi-tenant systems, shared build servers, and hosts where untrusted local users have shell access.
- Reboot patched systems to activate the fixed kernel image, since live-patching may not cover all stable branches.
Patch Information
The Linux kernel maintainers have merged fixes across multiple stable branches. Refer to the upstream commits, including 370c4804, 3df46386, 4bfd48bb, 6cc30ef8, 713fc00c, 7419df1a, a0450d3f, and d782a2db. Debian users should consult the Debian LTS Announcement for distribution-specific package versions.
Workarounds
- Blocklist the stm_core kernel module on systems that do not require System Trace Module functionality by adding an entry to /etc/modprobe.d/.
- Restrict local shell access on sensitive hosts to limit who can reach the vulnerable subsystem until patches are deployed.
- Enforce least privilege on service accounts and containers to reduce the pool of principals able to trigger the code path.
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

