CVE-2025-38677 Overview
CVE-2025-38677 is an out-of-bounds read vulnerability in the Linux kernel's Flash-Friendly File System (f2fs). The flaw resides in f2fs_get_dnode_of_data() within fs/f2fs/node.c and is triggered when mounting a corrupted f2fs image where a direct node (dnode) shares the same node id as its inode. During block address lookup, the code parses the dnode as an inode node, causing an out-of-boundary page access. A local, low-privileged attacker who can mount or supply a crafted f2fs image can trigger kernel memory corruption, resulting in denial of service or disclosure of adjacent kernel memory.
Critical Impact
Local attackers with the ability to mount a crafted f2fs image can cause kernel out-of-bounds access, leading to system crashes and potential information disclosure.
Affected Products
- Linux Kernel (multiple stable branches prior to the fix commits)
- Debian Linux 11.0 (LTS)
- Siemens products referenced in advisory SSA-032379
Discovery Timeline
- 2025-08-30 - CVE-2025-38677 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-38677
Vulnerability Analysis
The vulnerability is classified as an out-of-bounds read [CWE-125] in the f2fs filesystem code. The issue was reported by Jiaming Zhang and reproduced by KASAN (Kernel Address Sanitizer), which captured the invalid access during a write() syscall path.
The call chain traverses vfs_write() → f2fs_file_write_iter() → f2fs_write_begin() → prepare_write_begin() → f2fs_reserve_block() → f2fs_get_dnode_of_data(). Inside f2fs_get_dnode_of_data(), the kernel calls data_blkaddr() (defined in fs/f2fs/f2fs.h:3053) to read a block address from the dnode page. The read reaches beyond the page boundary because the code treats a direct node as if it were an inode node.
Root Cause
In a maliciously crafted or corrupted f2fs image, a direct node (dnode) is written with the same node id as its parent inode. When f2fs_get_dnode_of_data() walks the node tree to retrieve the block address at offset 934, get_dnode_addr() returns 360 (the inode header offset) instead of 0 (the dnode offset). The read then computes 360 + 934 * 4 = 4096 and attempts to fetch 4 bytes at that location, one page past the mapped dnode page. The upstream fix adds a sanity check on the node id of all direct nodes during f2fs_get_dnode_of_data() to reject inconsistent metadata before performing the address computation.
Attack Vector
Exploitation requires local access with the ability to trigger a mount or filesystem operation against a crafted f2fs image. Typical scenarios include an unprivileged user plugging in USB media containing a malicious f2fs volume, or a low-privileged account issuing writes against an already-mounted image. No user interaction beyond filesystem I/O is required, and the flaw is triggered synchronously in the write path. No public proof-of-concept exploit has been published, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog.
See the Linux kernel commit f1d5093 for the upstream sanity-check patch and the KASAN report referenced in the commit message.
Detection Methods for CVE-2025-38677
Indicators of Compromise
- KASAN slab-out-of-bounds or use-after-free reports referencing data_blkaddr, f2fs_data_blkaddr, or f2fs_get_dnode_of_data in dmesg or the kernel log.
- Unexpected kernel oops or panic messages emitted during write() syscalls against f2fs-mounted volumes.
- Mount events for f2fs volumes originating from removable media on systems where such media is not expected.
Detection Strategies
- Monitor kernel ring buffer output for f2fs stack traces containing f2fs_get_dnode_of_data+0x, f2fs_reserve_block, or prepare_write_begin symbols.
- Audit mount syscalls (sys_mount) via auditd or eBPF, filtering for -t f2fs and unusual source devices such as loopback files in user-writable directories.
- Correlate f2fs filesystem errors with process-level telemetry to identify which user or service triggered the corrupt image access.
Monitoring Recommendations
- Forward /var/log/kern.log and journalctl -k output to a central logging system for pattern matching on f2fs and KASAN signatures.
- Alert on repeated kernel warnings or panics from the same host, which may indicate active fuzzing or exploitation attempts.
- Track the installed kernel package version across the fleet to identify hosts still running vulnerable builds.
How to Mitigate CVE-2025-38677
Immediate Actions Required
- Apply the latest stable kernel update from your distribution vendor that includes the upstream sanity-check commits.
- For Debian systems, install the kernel updates announced in Debian LTS Announcement #00007 and Debian LTS Announcement #00008.
- For Siemens industrial products, follow the guidance in Siemens Security Advisory SSA-032379.
- Reboot affected systems after patch installation to load the corrected kernel.
Patch Information
The fix has been backported across multiple Linux stable branches. Relevant upstream commits include f1d5093, 6b7784e, 77de19b, 888aa66, 901f62e, 92ef491, a650654, and ee4d13f. Each patch adds validation of the node id for direct nodes inside f2fs_get_dnode_of_data().
Workarounds
- Disable automatic mounting of removable media (udisks2, autofs) on multi-user systems until patches are applied.
- Restrict the mount capability to trusted administrators via sudoers or Polkit policies to prevent low-privileged users from mounting arbitrary f2fs images.
- Blacklist the f2fs kernel module on systems that do not require the filesystem: add blacklist f2fs to /etc/modprobe.d/blacklist.conf and rebuild the initramfs.
# Configuration example: prevent unprivileged f2fs mounts and load
echo 'blacklist f2fs' | sudo tee /etc/modprobe.d/disable-f2fs.conf
sudo update-initramfs -u
# Verify installed kernel version includes the fix
uname -r
apt-cache policy linux-image-$(uname -r)
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

