CVE-2023-53665

Description

A use-after-free vulnerability was found in the Linux kernel multiple device RAID subsystem's device lifetime management. A local user with privileges to manage MD arrays can trigger concurrent device addition and removal operations via sysfs, causing a race condition where the mddev structure is freed when the last rdev is removed but then dereferenced afterward, which leads to memory corruption and can result in denial of service via kernel crash or potentially privilege escalation through heap manipulation.

Statement

The issue arises because of incorrect object lifetime management in the MD RAID device removal path. The mddev->kobject reference is primarily held through rdev->kobject references. When export_rdev() removes the last remaining device from an array, the mddev structure can be freed as its reference count drops to zero. However, the code path in rdev_attr_store() continues to use the mddev pointer after calling export_rdev(), leading to a use-after-free condition. This can be triggered by racing concurrent writes to sysfs: one thread continuously adds devices via /sys/block/md0/md/new_dev while another removes them via /sys/block/md0/md/dev-/state. The race window is narrow, occurring at very low frequency even under stress testing, which justifies the high attack complexity. The general protection fault shows the freed memory contains the SLAB poison pattern (0x6b6b6b6b6b6b6bcb), confirming use-after-free. While use-after-free vulnerabilities are known memory corruption primitives that can enable privilege escalation through careful heap manipulation, successful exploitation requires both timing the race precisely and controlling heap layout, making this significantly more complex than a straightforward memory safety violation.

Mitigation

To mitigate this issue, prevent the md_mod module from loading. See https://access.redhat.com/solutions/41278 for instructions on blacklisting kernel modules.

Common Vulnerability Scoring System (CVSS) Score Details

Info alert:Important note

CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).

CVSS v3 Score Breakdown

Red HatNVDcve.org
Base Score75.5N/A
Attack VectorLocalLocalN/A
Attack ComplexityHighLowN/A
Privileges RequiredLowLowN/A
User InteractionNoneNoneN/A
ScopeUnchangedUnchangedN/A
ConfidentialityHighNoneN/A
Integrity ImpactHighNoneN/A
Availability ImpactHighHighN/A

Vector

Red Hat: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

NVD: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Understanding the Weakness (CWE)

Availability

Technical Impact: DoS: Resource Consumption (Memory); DoS: Resource Consumption (Other)

An adversary that can cause a resource counter to become inaccurate may be able to create situations where resources are not accounted for and not released, thus causing resources to become scarce for future needs.

Availability

Technical Impact: DoS: Crash, Exit, or Restart

An adversary that can cause a resource counter to become inaccurate may be able to force an error that causes the product to crash or exit out of its current operation.

Frequently Asked Questions

Want to get errata notifications? Sign up here.