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

CVE-2024-38667: Linux Kernel Privilege Escalation Vulnerability

CVE-2024-38667 is a privilege escalation vulnerability in Linux Kernel affecting secondary idle threads through pt_regs corruption. This security flaw can lead to kernel stack corruption during CPU hotplug operations. This post explains its technical details, affected versions, impact, and mitigation steps.

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-38667 Overview

CVE-2024-38667 is a Linux kernel vulnerability affecting the RISC-V architecture. The flaw allows corruption of the pt_regs structure for secondary idle threads during boot and CPU hotplug operations. The top of the kernel thread stack should be reserved for pt_regs, but secondary boot harts had their stacks overlap with this structure. The function smp_callin stored registers on the stack, overwriting fields including status, which caused the kernel to save or restore nonexistent vector context. The issue surfaced during CPU hotplug tests with the RISC-V V (vector) extension enabled. The vulnerability maps to [CWE-787] (Out-of-Bounds Write) and affects multiple stable Linux kernel branches.

Critical Impact

Local attackers with low privileges can trigger kernel memory corruption on RISC-V systems, potentially enabling privilege escalation, data integrity loss, or denial of service through corrupted CPU register state.

Affected Products

  • Linux Kernel on RISC-V architecture (multiple stable branches)
  • Linux Kernel 6.10-rc1
  • Systems using RISC-V V (vector) extension with CPU hotplug enabled

Discovery Timeline

  • 2024-06-24 - CVE-2024-38667 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-38667

Vulnerability Analysis

The vulnerability resides in the RISC-V boot path for secondary harts. In the Linux kernel, each task has a kernel stack with the top region reserved for the pt_regs structure, which holds the saved CPU register state used during context switches and exception handling. For the primary hart, commit c7cdd96eca28 previously addressed this by reserving task_pt_regs(p) early. That fix was not propagated to secondary harts.

When secondary harts boot, the smp_callin function stores several registers on the idle thread's kernel stack. Because the stack and pt_regs overlap, the write operations overwrite fields inside pt_regs, including the status register. Corrupted status bits mislead the kernel into saving or restoring vector register state that does not exist for that context.

Root Cause

The root cause is incomplete propagation of a stack layout fix. The idle threads for secondary boot harts were not updated to reserve space for pt_regs at the top of the kernel stack. Normal stack writes performed during early CPU bring-up therefore clobber the register save area, producing an out-of-bounds write relative to the intended usable stack region.

Attack Vector

Exploitation requires local access with low privileges on a RISC-V system that supports CPU hotplug and the V extension. An attacker who can trigger CPU online or offline operations may force the corrupted code path and influence subsequent context switches. The vulnerability does not require user interaction and operates within the local scope.

No verified public exploit code is available for this issue. See the upstream kernel commits for the technical fix.

Detection Methods for CVE-2024-38667

Indicators of Compromise

  • Unexpected kernel oops or panic messages referencing vector register save/restore paths on RISC-V hosts
  • Kernel log entries showing illegal instruction faults or corrupted status field values during secondary CPU bring-up
  • System instability or crashes correlated with echo 1 > /sys/devices/system/cpu/cpuX/online operations

Detection Strategies

  • Inventory Linux hosts running RISC-V builds and identify kernels not patched with commits 0c1f28c3, 3090c06d, a638b046, or ea22d419
  • Correlate kernel crash telemetry with CPU hotplug events to identify systems exhibiting the fault pattern
  • Monitor for unauthorized local processes attempting to invoke CPU hotplug interfaces via sysfs

Monitoring Recommendations

  • Collect dmesg and /var/log/kern.log output from RISC-V systems and ship to a centralized log pipeline
  • Alert on repeated secondary hart boot failures or vector-related exceptions
  • Track package versions and kernel build metadata to confirm patched releases are deployed across the fleet

How to Mitigate CVE-2024-38667

Immediate Actions Required

  • Apply the upstream Linux kernel patches referenced below to all RISC-V systems in the environment
  • Restrict local shell access and limit which accounts can invoke CPU hotplug operations through sysfs
  • Prioritize patching on RISC-V hosts that enable the V (vector) extension and perform runtime CPU hotplug

Patch Information

Fixes have been merged across stable branches. Reference the upstream commits: Kernel Patch Commit 0c1f28c, Kernel Patch Commit 3090c06d, Kernel Patch Commit a638b046, and Kernel Patch Commit ea22d419. The fix reserves task_pt_regs(p) early for secondary harts, mirroring the earlier correction applied to the primary hart in commit c7cdd96eca28.

Workarounds

  • Disable CPU hotplug operations on affected RISC-V hosts until patched kernels are deployed
  • Boot kernels without the RISC-V vector extension where feasible to avoid the corrupted save/restore path
  • Reduce local attack surface by enforcing least privilege and restricting access to CPU control interfaces in sysfs
bash
# Verify running kernel version and architecture on affected hosts
uname -rm

# Restrict access to CPU hotplug sysfs interface (example)
chmod 600 /sys/devices/system/cpu/cpu*/online

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.