CVE-2025-38172
NoneCVSS
—
EPSS
0.2%
Published
Jul 3, 2025
CISA due date
—
Cloudanix analysis
A bug in the Linux kernel's file system code could let an attacker crash the system or run malicious code when certain storage devices are mounted together.
- Exploitation
- Local Privilege
- Attacker needs
- Low Privilege
- Complexity
- Moderate
- Impact
- Privilege Gain
- Component
- OS kernel
- Class
- Use After Free
- Remediation
- Patch
- Effort
- Medium
- Patch risk
- Low
What it actually does
Use-after-free in erofs filesystem mount handling when primary device is a block device and extra device is file-backed, causing erofs_init_device to return ENOTBLK (ignored in erofs_fc_get_tree) followed by deactivate_locked_super freeing sbi and subsequent filp_open write to freed structure.
Why it matters to the business
Kernel instability or potential code execution on Linux systems using erofs with multiple devices; widespread impact given Linux kernel prevalence across servers, embedded, and cloud workloads, though exploitation requires specific device configuration.
How an attack unfolds
Attacker supplies an erofs mount request with mismatched device types (block primary, file-backed extra) to trigger ENOTBLK return path in erofs_fc_get_tree, leading to sbi free-then-use sequence during superblock initialization.
How to fix it
Upgrade Linux kernel to commit 65115472f741ca000d7ea4a5922214f93cd1516e or later stable releases containing the fix that converts ENOTBLK to -EINVAL in erofs_init_device error handling.
How to confirm the fix worked
Verify kernel source contains the erofs error conversion logic or confirm running kernel version includes the referenced commit; test mount operations with mixed device types to ensure -EINVAL is returned instead of proceeding to UAF.
Typical attack path
- Prepare erofs filesystem image and mismatched device files (block vs regular file)
- Invoke mount syscall or mount command targeting erofs with multiple devices
- Trigger erofs_fc_get_tree -> get_tree_bdev_flags -> erofs_read_superblock -> erofs_init_device returning ENOTBLK
- deactivate_locked_super frees sbi while erofs_fc_get_tree continues to access sbi->dif0
- Achieve UAF write via subsequent filp_open assignment
How to detect it
Review kernel logs for erofs mount failures involving ENOTBLK or device type mismatches; inspect auditd or dmesg entries around mount syscalls targeting erofs; correlate with unexpected superblock deallocation patterns.
What your security team should do
- Apply kernel update containing commit 65115472f741ca000d7ea4a5922214f93cd1516e immediately on all systems using erofs
- Audit erofs mount configurations and disable multi-device setups until patched
- Monitor kernel update channels for stable backports and schedule distribution-wide rollout
- Review any custom erofs tooling or initramfs that may trigger the mount path
The record
In the Linux kernel, the following vulnerability has been resolved: erofs: avoid using multiple devices with different type For multiple devices, both primary and extra devices should be the same type. `erofs_init_device` has already guaranteed that if the primary is a file-backed device, extra devices should also be regular files. However, if the primary is a block device while the extra device is a file-backed device, `erofs_init_device` will get an ENOTBLK, which is not treated as an error in `erofs_fc_get_tree`, and that leads to an UAF: erofs_fc_get_tree get_tree_bdev_flags(erofs_fc_fill_super) erofs_read_superblock erofs_init_device // sbi->dif0 is not inited yet, // return -ENOTBLK deactivate_locked_super free(sbi) if (err is -ENOTBLK) sbi->dif0.file = filp_open() // sbi UAF So if -ENOTBLK is hitted in `erofs_init_device`, it means the primary device must be a block device, and the extra device is not a block device. The error can be converted to -EINVAL.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:13 | linux | 0 | No fix |
| Linux | Kernel | 6.12.0 | 6.12.34 |
| openSUSE:Leap 16.0 | dtb-aarch64 | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-64kb | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-default | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-default-base | 0 | 6.12.0-160000.6.1.160000.2.4 |
| openSUSE:Leap 16.0 | kernel-docs | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-kvmsmall | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-obs-build | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-obs-qa | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-rt | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-source | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-syms | 0 | 6.12.0-160000.6.1 |
| openSUSE:Leap 16.0 | kernel-zfcpdump | 0 | 6.12.0-160000.6.1 |
Related vulnerabilities
- CVE-2025-39885 In the Linux kernel, the following vulnerability has been resolved: ocfs2: fix recursive… Also affects linux
- CVE-2025-39883 In the Linux kernel, the following vulnerability has been resolved: mm/memory-failure… Also affects linux
- CVE-2025-39884 In the Linux kernel, the following vulnerability has been resolved: btrfs: fix subvolume… Also affects linux
- CVE-2025-39886 In the Linux kernel, the following vulnerability has been resolved: bpf: Tell memcg to… Also affects linux
- CVE-2025-39876 In the Linux kernel, the following vulnerability has been resolved: net: fec: Fix… Also affects linux
- CVE-2025-39880 In the Linux kernel, the following vulnerability has been resolved: libceph: fix invalid… Also affects linux
- CVE-2025-39881 In the Linux kernel, the following vulnerability has been resolved: kernfs: Fix UAF in… Also affects linux
- CVE-2025-39882 In the Linux kernel, the following vulnerability has been resolved: drm/mediatek: fix… Also affects linux