CVE-2023-53665
md: don't dereference mddev after export_rdev()
Check your servers for CVE-2023-53665
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2023-53665 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
md: don't dereference mddev after export_rdev()
Except for initial reference, mddev->kobject is referenced by rdev->kobject, and if the last rdev is freed, there is no guarantee that mddev is still valid. Hence mddev should not be used anymore after export_rdev().
This problem can be triggered by following test for mdadm at very low rate:
New file: mdadm/tests/23rdev-lifetime
devname=${dev0##*/} devt=`cat /sys/block/$devname/dev` pid="" runtime=2
clean_up_test() { pill -9 $pid echo clear > /sys/block/md0/md/array_state }
trap 'clean_up_test' EXIT
add_by_sysfs() { while true; do echo $devt > /sys/block/md0/md/new_dev done }
remove_by_sysfs(){ while true; do echo remove > /sys/block/md0/md/dev-${devname}/state done }
echo md0 > /sys/module/md_mod/parameters/new_array || die "create md0 failed"
add_by_sysfs & pid="$pid $!"
remove_by_sysfs & pid="$pid $!"
sleep $runtime exit 0
Test cmd:
./test --save-logs --logdir=/tmp/ --keep-going --dev=loop --tests=23rdev-lifetime
Test result:
general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6bcb: 0000 [#4] PREEMPT SMP CPU: 0 PID: 1292 Comm: test Tainted: G D W 6.5.0-rc2-00121-g01e55c376936 #562 RIP: 0010:md_wakeup_thread+0x9e/0x320 [md_mod] Call Trace: <TASK> mddev_unlock+0x1b6/0x310 [md_mod] rdev_attr_store+0xec/0x190 [md_mod] sysfs_kf_write+0x52/0x70 kernfs_fop_write_iter+0x19a/0x2a0 vfs_write+0x3b5/0x770 ksys_write+0x74/0x150 __x64_sys_write+0x22/0x30 do_syscall_64+0x40/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fix this problem by don't dereference mddev after export_rdev().
Exploitation
EPSS 0.13%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 2.86% of all scored CVEs. Scores of 1 Dec 2026.
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 3ce94ce5d05ae89190a23f6187f64d8f4b2d3782, before ad430ad0669d2757377373390d68e1454fc7a344 affected from 3ce94ce5d05ae89190a23f6187f64d8f4b2d3782, before 7deac114be5fb25a4e865212ed0feaf5f85f2a28
Other versions: unaffected
|
| Linux |
affected 6.5 unaffected before 6.5 unaffected from 6.5.5 up to and including 6.5.* unaffected 6.6 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2023-53665 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2023-53665
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2023-53665
trivy image --scanners vuln IMAGE | grep CVE-2023-53665
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/ad430ad0669d2757377373390d68e1454fc7a344 git.kernel.org
- https://git.kernel.org/stable/c/7deac114be5fb25a4e865212ed0feaf5f85f2a28 git.kernel.org
Source: the record CVE-2023-53665 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse