CVE-2025-38172

7.8 HIGH

📋 TL;DR

This CVE describes a use-after-free vulnerability in the Linux kernel's EROFS filesystem driver. When mounting an EROFS filesystem with multiple devices of different types (block device primary with file-backed secondary), an error handling flaw leads to freeing memory that's later accessed, potentially allowing kernel memory corruption. This affects Linux systems using EROFS with multiple device configurations.

💻 Affected Systems

Products:
  • Linux kernel
Versions: Linux kernel versions with EROFS support before fixes in commits 65115472f741ca000d7ea4a5922214f93cd1516e, 9748f2f54f66743ac77275c34886a9f890e18409, cd04beb9ce2773a16057248bb4fa424068ae3807
Operating Systems: Linux distributions with EROFS support enabled
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when using EROFS filesystem with multiple devices where primary is block device and secondary is file-backed device. Requires CONFIG_EROFS_FS=y in kernel config.

📦 What is this software?

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

Linux Kernel by Linux

The Linux Kernel is the core component of the Linux operating system, serving as the critical interface between computer hardware and software processes. As the heart of millions of servers, cloud infrastructure, embedded systems, Android devices, and IoT deployments worldwide, the Linux Kernel mana...

Learn more about Linux Kernel →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Local attacker with ability to mount EROFS filesystems could exploit the use-after-free to achieve kernel memory corruption, potentially leading to privilege escalation, denial of service, or arbitrary code execution in kernel context.

🟠

Likely Case

Local user could crash the kernel causing system instability or denial of service. Privilege escalation is possible but requires specific memory manipulation.

🟢

If Mitigated

With proper access controls preventing unauthorized users from mounting filesystems, impact is limited to authorized administrators only.

🌐 Internet-Facing: LOW - This requires local filesystem mounting capability, not directly exploitable over network.
🏢 Internal Only: MEDIUM - Local users with filesystem mounting privileges could exploit this vulnerability.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires local access and ability to mount EROFS filesystems. The use-after-free condition must be carefully manipulated for reliable exploitation.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Linux kernel with commits 65115472f741ca000d7ea4a5922214f93cd1516e, 9748f2f54f66743ac77275c34886a9f890e18409, cd04beb9ce2773a16057248bb4fa424068ae3807 applied

Vendor Advisory: https://git.kernel.org/stable/c/65115472f741ca000d7ea4a5922214f93cd1516e

Restart Required: Yes

Instructions:

1. Update Linux kernel to version containing the fix commits. 2. Reboot system to load patched kernel. 3. Verify kernel version with 'uname -r'.

🔧 Temporary Workarounds

Disable EROFS module

linux

Prevent loading of EROFS kernel module to eliminate attack surface

echo 'install erofs /bin/false' >> /etc/modprobe.d/disable-erofs.conf
rmmod erofs 2>/dev/null || true

Restrict filesystem mounting

linux

Limit which users can mount filesystems using sudoers or other access controls

# In /etc/sudoers or sudoers.d file:
# Remove mount privileges for non-admin users

🧯 If You Can't Patch

  • Implement strict access controls to prevent unauthorized users from mounting filesystems
  • Monitor for unusual mount operations or kernel crashes related to EROFS

🔍 How to Verify

Check if Vulnerable:

Check if EROFS module is loaded: 'lsmod | grep erofs'. Check kernel version against patched versions.

Check Version:

uname -r

Verify Fix Applied:

Verify kernel version includes fix commits: 'uname -r' and check kernel source or distribution patch notes.

📡 Detection & Monitoring

Log Indicators:

  • Kernel oops or panic messages mentioning erofs
  • Failed mount attempts with EROFS and multiple devices
  • System crashes during filesystem operations

Network Indicators:

  • Not applicable - local vulnerability

SIEM Query:

source="kernel" AND ("erofs" OR "EROFS") AND ("panic" OR "oops" OR "BUG")

🔗 References

📤 Share & Export