Junglewise Threat Intelligence

CVE-2024-40971: Linux Kernel F2FS data corruption during remount race condition

CVE-2024-40971 · Severity: medium · CVSS 5.5 · Published 2024-07-12

Technologies: Linux Kernel. Vendors: Linux.

Executive brief

A vulnerability in the Linux kernel's F2FS file system could lead to data corruption. When the file system is reconfigured (remounted), there is a brief moment where encryption settings are accidentally disabled. If a file is opened or created during this specific window, it may not be properly encrypted, potentially leading to permanent data loss or corruption.

Technical details

A race condition exists in the F2FS file system implementation within the Linux kernel during the remount process. In the `f2fs_remount` function, the `SB_INLINECRYPT` flag is cleared in `default_options` and subsequently re-set in `parse_options`. If a concurrent thread executes `f2fs_file_open` or `f2fs_new_inode` during this window, the `fscrypt_select_encryption_impl` function may fail to utilize inline encryption. This is particularly critical when `wrappedkey_v0` is enabled, as it can result in data corruption. The fix involves removing the code that clears the `SB_INLINECRYPT` flag during the default options initialization.

Affected products

  • Linux Linux Kernel 5.11 to 5.15.162, 5.16 to 6.1.96, 6.2 to 6.6.36, 6.7 to 6.9.7, 3.8 to 5.10.221

Timeline

  • 2024-03-29: patched: Initial patch in mainline kernel
  • 2024-07-12: disclosed: CVE-2024-40971 published

References

Related threats