CVE-2026-143126: ntfs: check the file name against the key length of an index entry
In the Linux kernel, the following vulnerability has been resolved:
ntfs: check the file name against the key length of an index entry
ntfsindexentryinconsistent() checks that the file name of a $FILENAME key fits in the index entry. It does not check that the name fits in the key, which is what keylength describes. Code that works on the key alone relies on that.
ntfsreaddir() copies keylength bytes of the key of the next entry to resume the enumeration, and later uses the copy to search the index. If filenamelength is larger than the key holds, the name comparison reads past the copy:
BUG: KASAN: slab-out-of-bounds in ntfsfilecomparevalues+0x2d1/0x4b0 Read of size 2 at addr ffff88800a4ef2ce by task init/1 ntfsfilecomparevalues ntfscollate ntfsielookup ntfsindexlookup ntfsreaddir iteratedir Allocated by task 1: kmemdupnoprof ntfsreaddir The buggy address is located 0 bytes to the right of allocated 78-byte region
Two bytes of an image from mkntfs are enough: in an entry whose name has six characters (keylength 78), change filenamelength from 6 to 7, so the key claims 80 bytes. The entry itself is 96 bytes, so the existing check lets it pass. The next readdir of the directory reads the extra bytes.
Check the name against keylength, and check that the key is large enough to hold filenamelength in the first place.