CVE-2026-99819: ntfs3: fix out-of-bounds read in ntfs_read_mft()
In the Linux kernel, the following vulnerability has been resolved:
ntfs3: fix out-of-bounds read in ntfsreadmft()
ntfsreadmft() walks the attributes of an MFT record and, for each FILENAME attribute, compares the resident on-disk name with the name being looked up. The only size check before the compare is rsize >= SIZEOFATTRIBUTEFILENAME, which covers the fixed header up to and including namelen, but not the variable-length name that follows it.
namelen comes straight from disk and is not validated against the resident datasize. A crafted image can set namelen large while keeping datasize at the header size, so ntfscmpnamescpu() reads namelen le16 characters past the end of the MFT record buffer:
BUG: KASAN: slab-out-of-bounds in ntfscmpnamescpu (fs/ntfs3/upcase.c:84) Read of size 2 at addr ffff888031879c00 by task a.out ntfscmpnamescpu (fs/ntfs3/upcase.c:84) ntfsiget5 (fs/ntfs3/inode.c:209) dirsearchu (fs/ntfs3/dir.c:265) ntfslookup (fs/ntfs3/namei.c:85) lookupslow (fs/namei.c:1915) lookupslow (fs/namei.c:1932) pathlookupat (fs/namei.c:2278) vfsstatx (fs/stat.c) vfsfstatat (fs/stat.c) dosysnewfstatat (fs/stat.c)
Allocated by task: miinit (fs/ntfs3/record.c) ntfsiget5 (fs/ntfs3/inode.c) dirsearchu (fs/ntfs3/dir.c) ntfslookup (fs/ntfs3/namei.c)
Check that the name fits in the resident data before using it.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In ntfs_read_mft(), validate that the variable-length FILE_NAME value fits within the resident data_size before using or comparing the name.
Event History
Frequently Asked Questions
What input can trigger this issue?
A crafted NTFS filesystem image containing a malformed FILE_NAME attribute can trigger the out-of-bounds read. The malformed attribute declares a name length larger than its resident data size.
What operation reaches the vulnerable code?
The vulnerable comparison is reached while the kernel looks up a name in an NTFS directory. The provided trace shows it occurring through pathname lookup and stat-related operations, including newfstatat.
How might an affected system reveal the problem?
The supplied report shows KASAN detecting a slab out-of-bounds read in ntfs_cmp_names_cpu, reached from ntfs_read_mft() through NTFS directory lookup code. A KASAN-enabled kernel may therefore report this signature when processing a malicious image.