CVE-2024-42104: nilfs2: add missing check for inode numbers on directory entries
In the Linux kernel, the following vulnerability has been resolved:
nilfs2: add missing check for inode numbers on directory entries
Syzbot reported that mounting and unmounting a specific pattern of
corrupted nilfs2 filesystem images causes a use-after-free of metadata
file inodes, which triggers a kernel bug in lru_add_fn().
As Jan Kara pointed out, this is because the link count of a metadata file
gets corrupted to 0, and nilfs_evict_inode(), which is called from iput(),
tries to delete that inode (ifile inode in this case).
The inconsistency occurs because directories containing the inode numbers
of these metadata files that should not be visible in the namespace are
read without checking.
Fix this issue by treating the inode numbers of these internal files as
errors in the sanity check helper when reading directory folios/pages.
Also thanks to Hillf Danton and Matthew Wilcox for their initial mm-layer
analysis.
Security readout for executives and security teams
Plain-English summary
A locally accessible, corrupted NILFS2 filesystem can trigger a Linux kernel use-after-free during mounting and unmounting. Successful abuse could crash the system or potentially compromise kernel-level confidentiality and integrity. Exposure depends on whether NILFS2 is available and an attacker can cause a crafted filesystem image or device to be mounted.
Executive priority
Prioritize patching systems where users, tenants, or automated workflows can mount externally supplied filesystems. Treat shared hosts and systems processing disk images as higher urgency. Other affected systems should follow routine high-severity kernel maintenance after confirming vendor package status.
Technical view
NILFS2 failed to reject directory entries referencing internal metadata inode numbers. A corrupted image could reduce a metadata inode link count to zero, causing nilfs_evict_inode() to delete it and producing a use-after-free observed in lru_add_fn(). The fix treats these internal inode references as directory-validation errors.
Likely exposure
Systems running affected Linux kernels are most exposed when NILFS2 is enabled and a low-privileged local actor can influence filesystem mounting. Servers that never use NILFS2 or prevent untrusted users from supplying and mounting filesystem images have lower practical exposure. Exact distribution package status requires vendor confirmation.
Exploitation context
The supplied CVSS 3.1 score is 7.8, with local access, low complexity, low privileges, and no user interaction. Syzbot reproduced a kernel failure using a corrupted NILFS2 image. The supplied sources and KEV status do not establish active exploitation in the wild.
Researcher notes
The source bundle identifies multiple stable-kernel fix commits but presents ambiguous flattened version data, including repeated commit identifiers and version boundaries. Use distribution advisories or upstream stable history for precise package mapping. Evidence supports a reproducible use-after-free condition, but not confirmed weaponization or real-world exploitation.
Mitigation direction
Install a vendor kernel update incorporating the applicable upstream NILFS2 fix.
Check distribution advisories to determine the fixed package for each deployed kernel.
Until updated, prevent low-privileged users from mounting untrusted NILFS2 images or devices.
Disable unnecessary NILFS2 support according to vendor guidance where operationally acceptable.
Validation and detection
Inventory running kernel versions and compare them with vendor-specific CVE advisories.
Determine whether NILFS2 support is installed, enabled, or required on each system.
Review mount permissions and workflows for exposure to untrusted filesystem images or devices.
Confirm the updated kernel contains the applicable upstream fix and is currently running.
Review kernel logs for related NILFS2 errors or lru_add_fn() bug reports.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2024-42104 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.