Skip to main content

CVE-2024-47740: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-47740cvecve-2024-47740
Published: Mon Oct 21 2024 (10/21/2024, 12:14:09 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: f2fs: Require FMODE_WRITE for atomic write ioctls The F2FS ioctls for starting and committing atomic writes check for inode_owner_or_capable(), but this does not give LSMs like SELinux or Landlock an opportunity to deny the write access - if the caller's FSUID matches the inode's UID, inode_owner_or_capable() immediately returns true. There are scenarios where LSMs want to deny a process the ability to write particular files, even files that the FSUID of the process owns; but this can currently partially be bypassed using atomic write ioctls in two ways: - F2FS_IOC_START_ATOMIC_REPLACE + F2FS_IOC_COMMIT_ATOMIC_WRITE can truncate an inode to size 0 - F2FS_IOC_START_ATOMIC_WRITE + F2FS_IOC_ABORT_ATOMIC_WRITE can revert changes another process concurrently made to a file Fix it by requiring FMODE_WRITE for these operations, just like for F2FS_IOC_MOVE_RANGE. Since any legitimate caller should only be using these ioctls when intending to write into the file, that seems unlikely to break anything.

AI-Powered Analysis

AILast updated: 06/28/2025, 20:12:18 UTC

Technical Analysis

CVE-2024-47740 is a vulnerability identified in the Linux kernel's F2FS (Flash-Friendly File System) implementation. The issue arises from insufficient permission checks on atomic write ioctls, specifically F2FS_IOC_START_ATOMIC_REPLACE, F2FS_IOC_COMMIT_ATOMIC_WRITE, F2FS_IOC_START_ATOMIC_WRITE, and F2FS_IOC_ABORT_ATOMIC_WRITE. These ioctls allow atomic operations on files, such as starting, committing, or aborting atomic writes. The vulnerability stems from the fact that the kernel only checks inode ownership or capability via inode_owner_or_capable(), which returns true if the caller's FSUID matches the inode's UID. This check bypasses Linux Security Modules (LSMs) like SELinux or Landlock, which are designed to enforce mandatory access control policies and could otherwise deny write access even if the FSUID matches. Consequently, an attacker or process with the same FSUID as the file owner can exploit these ioctls to perform unauthorized operations: truncating a file to zero length or reverting changes made by other processes concurrently. This undermines the integrity of files and can disrupt concurrent file operations. The fix requires that the caller must have FMODE_WRITE (write mode) permission for these atomic write ioctls, aligning with the permission model used by F2FS_IOC_MOVE_RANGE. This change ensures that only processes explicitly granted write access can perform these atomic operations, restoring the ability of LSMs to enforce write restrictions effectively. The vulnerability affects Linux kernel versions identified by the commit hash 88b88a66797159949cec32eaab12b4968f6fae2d and potentially other versions using the vulnerable F2FS ioctl implementation. No known exploits are reported in the wild as of the publication date (October 21, 2024).

Potential Impact

For European organizations, this vulnerability poses a risk primarily to systems running Linux with the F2FS file system, which is commonly used in embedded systems, mobile devices, and some server environments optimized for flash storage. The ability to bypass LSMs like SELinux or Landlock means that even hardened systems relying on these security modules for fine-grained access control could have their file integrity compromised. This could lead to unauthorized data modification, disruption of critical applications relying on atomic file operations, and potential data loss or corruption. Organizations with strict compliance requirements around data integrity and access control, such as those in finance, healthcare, and critical infrastructure sectors, could face increased risk of insider threats or exploitation by malicious software that gains user-level access. While the vulnerability does not directly allow privilege escalation, the undermining of LSM protections can facilitate lateral movement or persistence by attackers. The absence of known exploits currently reduces immediate risk, but the vulnerability should be addressed promptly to prevent future exploitation, especially in environments where F2FS is used and LSMs are enforced.

Mitigation Recommendations

1. Apply the latest Linux kernel patches that address CVE-2024-47740 as soon as they become available from trusted Linux distributions or the kernel mainline. 2. Audit systems to identify usage of the F2FS file system and assess whether atomic write ioctls are in use or could be invoked by applications or users. 3. Strengthen LSM policies (SELinux, Landlock) to minimize the number of processes with write permissions on sensitive files, reducing the attack surface. 4. Implement strict user and process privilege management to ensure that only trusted users and applications have FSUIDs matching file owners, limiting potential misuse. 5. Monitor system logs for unusual ioctl activity related to F2FS atomic writes, which could indicate attempts to exploit this vulnerability. 6. For critical systems, consider additional file integrity monitoring solutions to detect unauthorized truncation or rollback of files. 7. Educate system administrators and security teams about this vulnerability to ensure timely patching and monitoring.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-09-30T16:00:12.959Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9825c4522896dcbe0673

Added to database: 5/21/2025, 9:08:53 AM

Last enriched: 6/28/2025, 8:12:18 PM

Last updated: 7/31/2025, 1:25:46 PM

Views: 14

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats