CVE-2024-26727
btrfs: do not ASSERT() if the newly created subvolume already got read
Check your servers for CVE-2024-26727
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-2024-26727 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:
btrfs: do not ASSERT() if the newly created subvolume already got read
[BUG] There is a syzbot crash, triggered by the ASSERT() during subvolume creation:
assertion failed: !anon_dev, in fs/btrfs/disk-io.c:1319 ------------[ cut here ]------------ kernel BUG at fs/btrfs/disk-io.c:1319! invalid opcode: 0000 [#1] PREEMPT SMP KASAN RIP: 0010:btrfs_get_root_ref.part.0+0x9aa/0xa60 <TASK> btrfs_get_new_fs_root+0xd3/0xf0 create_subvol+0xd02/0x1650 btrfs_mksubvol+0xe95/0x12b0 __btrfs_ioctl_snap_create+0x2f9/0x4f0 btrfs_ioctl_snap_create+0x16b/0x200 btrfs_ioctl+0x35f0/0x5cf0 __x64_sys_ioctl+0x19d/0x210 do_syscall_64+0x3f/0xe0 entry_SYSCALL_64_after_hwframe+0x63/0x6b ---[ end trace 0000000000000000 ]---
[CAUSE] During create_subvol(), after inserting root item for the newly created subvolume, we would trigger btrfs_get_new_fs_root() to get the btrfs_root of that subvolume.
The idea here is, we have preallocated an anonymous device number for the subvolume, thus we can assign it to the new subvolume.
But there is really nothing preventing things like backref walk to read the new subvolume. If that happens before we call btrfs_get_new_fs_root(), the subvolume would be read out, with a new anonymous device number assigned already.
In that case, we would trigger ASSERT(), as we really expect no one to read out that subvolume (which is not yet accessible from the fs). But things like backref walk is still possible to trigger the read on the subvolume.
Thus our assumption on the ASSERT() is not correct in the first place.
[FIX] Fix it by removing the ASSERT(), and just free the @anon_dev, reset it to 0, and continue.
If the subvolume tree is read out by something else, it should have already get a new anon_dev assigned thus we only need to free the preallocated one.
Exploitation
EPSS 0.23%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 14.5% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 17 Jun 2024):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 2dfb1e43f57dd3aeaa66f7cf05d068db2d4c8788, before 3f5d47eb163bceb1b9e613c9003bae5fefc0046f affected from 2dfb1e43f57dd3aeaa66f7cf05d068db2d4c8788, before e31546b0f34af21738c4ceac47d662c00ee6382f affected from 2dfb1e43f57dd3aeaa66f7cf05d068db2d4c8788, before 66b317a2fc45b2ef66527ee3f8fa08fb5beab88d affected from 2dfb1e43f57dd3aeaa66f7cf05d068db2d4c8788, before 833775656d447c545133a744a0ed1e189ce61430 affected from 2dfb1e43f57dd3aeaa66f7cf05d068db2d4c8788, before 5a172344bfdabb46458e03708735d7b1a918c468 affected from 2dfb1e43f57dd3aeaa66f7cf05d068db2d4c8788, before e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb affected 917d608fe375041eb7f29befa6a6d7fd3cf32dde affected from 5.8.3, before 5.9
Other versions: unaffected
|
| Linux |
affected 5.9 unaffected before 5.9 unaffected from 5.10.210 up to and including 5.10.* unaffected from 5.15.149 up to and including 5.15.* unaffected from 6.1.79 up to and including 6.1.* unaffected from 6.6.18 up to and including 6.6.* unaffected from 6.7.6 up to and including 6.7.* unaffected 6.8 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-2024-26727 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2024-26727
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-2024-26727
trivy image --scanners vuln IMAGE | grep CVE-2024-26727
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/3f5d47eb163bceb1b9e613c9003bae5fefc0046f git.kernel.org
- https://git.kernel.org/stable/c/e31546b0f34af21738c4ceac47d662c00ee6382f git.kernel.org
- https://git.kernel.org/stable/c/66b317a2fc45b2ef66527ee3f8fa08fb5beab88d git.kernel.org
- https://git.kernel.org/stable/c/833775656d447c545133a744a0ed1e189ce61430 git.kernel.org
- https://git.kernel.org/stable/c/5a172344bfdabb46458e03708735d7b1a918c468 git.kernel.org
- https://git.kernel.org/stable/c/e03ee2fe873eb68c1f9ba5112fee70303ebf9dfb git.kernel.org
- https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html lists.debian.org
Source: the record CVE-2024-26727 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse