CVE-2024-50217·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix use-after-free of block device file in __btrfs_free_extra_devids() Mounting btrfs from two images (which have the same one fsid and two different dev_uuids) in certain executing order may trigger an UAF for variable 'device->bdev_file' in __btrfs_free_extra_devids(). And following are the details: 1. Attach image_1 to loop0, attach image_2 to loop1, and scan btrfs devices by ioctl(BTRFS_IOC_SCAN_DEV): / btrfs_device_1 → loop0 fs_device \ btrfs_device_2 → loop1 2. mount /dev/loop0 /mnt btrfs_open_devices btrfs_device_1->bdev_file = btrfs_get_bdev_and_sb(loop0) btrfs_device_2->bdev_file = btrfs_get_bdev_and_sb(loop1) btrfs_fill_super open_ctree fail: btrfs_close_devices // -ENOMEM btrfs_close_bdev(btrfs_device_1) fput(btrfs_device_1->bdev_file) // btrfs_device_1->bdev_file is freed btrfs_close_bdev(btrfs_device_2) fput(btrfs_device_2->bdev_file) 3. mount /dev/loop1 /mnt btrfs_open_devices btrfs_get_bdev_and_sb(&bdev_file) // EIO, btrfs_device_1->bdev_file is not assigned, // which points to a freed memory area btrfs_device_2->bdev_file = btrfs_get_bdev_and_sb(loop1) btrfs_fill_super open_ctree btrfs_free_extra_devids if (btrfs_device_1->bdev_file) fput(btrfs_device_1->bdev_file) // UAF ! Fix it by setting 'device->bdev_file' as 'NULL' after closing the btrfs_device in btrfs_close_one_device().
- Severity
- high
- Software
- Kernel
- Fixed in
- 6.11.7
- Published
- 2024-11-09
Affected versions
From: 4.8
Until: 6.11.7
Fixed in: 6.11.7
How to fix this CVE
Update your Linux kernel to version 6.11.7 or later to resolve this use-after-free vulnerability in btrfs device handling. This fix ensures that device file pointers are properly nullified after closure, preventing kernel crashes and potential privilege escalation during multi-device btrfs mount operations. Systems running kernel versions 4.8 through 6.11.6 should prioritize this update.
sudo dnf update kernel kernel-devel && sudo rebootDefensia detects this vulnerability
How to check if you are affected
- Check installed kernel version: uname -r
- Verify if btrfs is in use: grep btrfs /proc/filesystems
- List mounted btrfs filesystems: mount | grep btrfs
- Search kernel logs for UAF signatures: sudo dmesg | grep -i 'use-after-free\|bdev_file\|btrfs_close'
- Confirm kernel update applied: uname -r (should show 6.11.7 or later)
FAQ
What is CVE-2024-50217?
This is a use-after-free vulnerability in the Linux kernel's btrfs filesystem driver that occurs when mounting multiple btrfs images with identical filesystem IDs but different device UUIDs. The bug leaves freed memory pointers accessible, potentially causing kernel crashes or privilege escalation.
Is CVE-2024-50217 being actively exploited?
No, this vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog and has no public exploits available. However, it requires immediate patching due to its high CVSS score of 7.8.
What versions of Kernel are affected by CVE-2024-50217?
Linux kernel versions 4.8 through 6.11.6 are vulnerable. The fix is included in kernel 6.11.7 and later stable releases.
How do I check if my server is vulnerable to CVE-2024-50217?
Run 'uname -r' to check your kernel version. If it shows a version between 4.8 and 6.11.6, your system is vulnerable. For example, 6.11.5 or 6.10.0 would be affected.
Does Defensia detect CVE-2024-50217?
Yes — Defensia's CVE advisory scanner compares installed kernel package versions against the NVD database. If Kernel is installed on a monitored server, CVE-2024-50217 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/47a83f8df39545f3f552bb6a1b6d9c30e37621dd
- https://git.kernel.org/stable/c/aec8e6bf839101784f3ef037dcdb9432c3f32343
- http://www.openwall.com/lists/oss-security/2025/04/10/4
- http://www.openwall.com/lists/oss-security/2025/04/10/5
- http://www.openwall.com/lists/oss-security/2025/04/10/6
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-50217. Free for 1 server.
Get started free