Overview
CVE-2025-40213 identifies a recently resolved vulnerability within the Linux kernel’s Bluetooth management (MGMT) subsystem. The vulnerability involves issues in the set_mesh_sync and set_mesh_complete functions, potentially leading to a kernel crash. Specifically, a stack-out-of-bounds write and a double list deletion were identified and subsequently fixed.
Technical Details
The vulnerability manifests in two primary ways:
- Stack-Out-Of-Bounds Write in
set_mesh_sync: Amemcpyoperation from a badly declared on-stack flexible array in theset_mesh_syncfunction caused a stack-out-of-bounds write. This occurs because the array was not properly defined, allowing the copy operation to write beyond the allocated memory, triggering a KASAN (Kernel Address Sanitizer) error and ultimately a crash. - Double List Deletion in
set_mesh_complete: Theset_mesh_completefunction experienced a double list deletion issue due to calling bothmgmt_pending_validandmgmt_pending_remove. This attempts to remove the same command from the pending list twice, leading to a crash.
The fixes implemented address these issues by:
- Using
DEFINE_FLEXmacro to correctly define the flexible array inset_mesh_syncto prevent out-of-bounds writes. - Replacing
mgmt_pending_validwithmgmt_pending_freeto avoid double deletions. - Reporting the status of operations in case of errors.
CVSS Analysis
Currently, a CVSS score has not been assigned to CVE-2025-40213. Further analysis is required to determine the exploitability and impact in order to assign a proper CVSS score.
Possible Impact
The exploitation of this vulnerability can lead to a kernel crash, resulting in a denial-of-service (DoS) condition. A successful attack could potentially disrupt Bluetooth functionality and system stability. While the specific exploitability remains under investigation, the potential for system instability makes patching crucial. A malicious Bluetooth device or application could potentially trigger the vulnerable code path.
Mitigation and Patch Steps
The recommended mitigation is to update your Linux kernel to a version that includes the fix for CVE-2025-40213. Consult your Linux distribution’s security advisories for specific instructions on how to update your kernel. The fixes are included in stable kernel releases following the commits referenced below.
Steps to apply the patch (if manually patching):
- Identify the impacted kernel version.
- Obtain the patch files from the provided references.
- Apply the patches to your kernel source code.
- Recompile and install the patched kernel.
- Reboot your system to boot into the patched kernel.