Bug 2301467 (CVE-2024-42104) - CVE-2024-42104 kernel: nilfs2: add missing check for inode numbers on directory entries
Summary: CVE-2024-42104 kernel: nilfs2: add missing check for inode numbers on directo...
Keywords:
Status: NEW
Alias: CVE-2024-42104
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security DevOps Team
QA Contact:
URL:
Whiteboard:
Depends On: 2301762
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-07-30 08:21 UTC by OSIDB Bzimport
Modified: 2024-09-23 08:14 UTC (History)
4 users (show)

Fixed In Version: kernel 4.19.318, kernel 5.4.280, kernel 5.10.222, kernel 5.15.163, kernel 6.1.98, kernel 6.6.39, kernel 6.9.9, kernel 6.10
Doc Type: If docs needed, set a value
Doc Text:
A vulnerability was found in the Linux kernel in the nilfs2 filesystem where a lack of proper sanity checks can cause a use-after-free of the metadata file inodes, caused when the link count of a metadata file gets corrupted to 0 and the system attempts to delete that inode. This vulnerability can lead to memory corruption or crashes.
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description OSIDB Bzimport 2024-07-30 08:21:35 UTC
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.

Comment 1 Mauro Matteo Cascella 2024-07-30 18:27:32 UTC
Upstream advisory:
https://lore.kernel.org/linux-cve-announce/2024073019-CVE-2024-42104-7aa4@gregkh/T

Comment 2 Mauro Matteo Cascella 2024-07-30 18:27:53 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 2301762]


Note You need to log in before you can comment on or make changes to this bug.