CVE-2024-50217
btrfs: fix use-after-free of block device file in __btrfs_free_extra_devids()
Mitigation
- No fix listed yet: follow the vendor advisory.
Who should check
- Anyone running Linux >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < 47a83f8df39545f3f552bb6a1b6d9c30e37621dd; >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < aec8e6bf839101784f3ef037dcdb9432c3f32343
- Anyone running Linux 4.8
Vulnerability facts
- Affected
- Linux >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < 47a83f8df39545f3f552bb6a1b6d9c30e37621dd; >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < aec8e6bf839101784f3ef037dcdb9432c3f32343; Linux 4.8
- Fixed in
- Linux 47a83f8df39545f3f552bb6a1b6d9c30e37621dd
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 7.8 (v3.1, CNA)CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Privileges required: None
- User interaction: Required
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 0.33% chance of exploitation in 30 days (percentile 19, 2026-11-26)
- CWE
- CWE-416
- Modified
Description
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().
Affected and fixed versions
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2024-50217. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2024-50217.md Affected: Linux >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < 47a83f8df39545f3f552bb6a1b6d9c30e37621dd; >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < aec8e6bf839101784f3ef037dcdb9432c3f32343; Linux 4.8 Fixed in: Linux 47a83f8df39545f3f552bb6a1b6d9c30e37621dd Steps: 1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Patches
FAQ
Is CVE-2024-50217 being exploited?
There is no confirmed exploitation: CVE-2024-50217 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.33% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2024-50217?
High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed). A user has to take an action, such as opening a link, for the attack to work.
Which versions are affected by CVE-2024-50217?
Linux >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < 47a83f8df39545f3f552bb6a1b6d9c30e37621dd; >= 142388194191a3edc9ba01cfcfd8b691e0971fb2, < aec8e6bf839101784f3ef037dcdb9432c3f32343; Linux 4.8.
Is there a fix for CVE-2024-50217?
Yes. Fixed in Linux 47a83f8df39545f3f552bb6a1b6d9c30e37621dd. No fix listed yet: follow the vendor advisory.
How do I check if I'm affected by CVE-2024-50217?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.