CVE-2026-99863: fs/ntfs3: bound CreateAttribute asize against record_size in do_action
In the Linux kernel, the following vulnerability has been resolved:
fs/ntfs3: bound CreateAttribute asize against recordsize in doaction
In doaction()'s CreateAttribute case (fslog.c:3286), attr2 points into the on-disk log record and asize = le32tocpu(attr2->size) is therefore attacker-controlled on mount. The guard bounds asize only against the log record itself,
Add2Ptr(attr2, asize) > Add2Ptr(lrh, reclen)
where reclen is the client data length, and separately bounds dlen against the MFT record. Nothing bounds asize against recordsize, but all three writes that follow are into rec, a kmalloc(sbi->recordsize) buffer allocated by miinit() (record.c:105):
memmove(Add2Ptr(attr, asize), attr, used - roff); memcpy(attr, attr2, asize); rec->used = cputole32(used + asize);
With recordsize 0x400, roff 0x38, used 0x160 and asize 0x800 the memcpy writes 2048 bytes at rec + 0x38, 0x438 bytes past the allocation, and rec->used is left at 0x960. dlen is 0x18 here, so the existing dlen check passes: dlen bounds nothing about the size of the copy.
The equivalent non-replay path already refuses this. miinsertattr() performs the same insert and starts with (record.c:488):
if (used + asize > sbi->recordsize) return NULL;
Apply the same bound, spelled as a subtraction to match the neighbouring clause. used <= recordsize holds here because checkfilerecord() validates it (fslog.c:2826) and is called on this record at fslog.c:3172; roff <= used - 4 follows from checkifattr() together with the ATTREND check at fslog.c:2844, so bounding used + asize bounds both copies.
The sibling WriteEndOfFileRecordSegment case does the equivalent check against recordsize at fslog.c:3277.
Reproduced by mounting a crafted image on v7.2-rc5 under KASAN:
BUG: KASAN: slab-out-of-bounds in doaction.isra.0+0x41f6/0x83a0 Write of size 2048 at addr ffff888005c74838 by task mount/69
CPU: 0 UID: 0 PID: 69 Comm: mount Not tainted 7.2.0-rc5-00300-g8ba098e6b6ff #2 Call Trace: kasanreport+0xce/0x100 kasancheckrange+0x105/0x1b0 asanmemcpy+0x3c/0x60 doaction.isra.0+0x41f6/0x83a0 logreplay+0x920a/0xd300 ntfsloadlogandreplay+0x3ef/0x510 ntfsfillsuper+0x1d23/0x4550 gettreebdevflags+0x2ef/0x550 vfsgettree+0x82/0x2f0 fcmount+0x10/0x1b0 pathmount+0x517/0x1df0 x64sysmount+0x20b/0x270 dosyscall64+0xf9/0x540 entrySYSCALL64afterhwframe+0x77/0x7f
Allocated by task 69: kasankmalloc+0x8f/0xa0 kmallocnoprof+0x1b4/0x460 miinit+0x81/0x110 miget+0x6a/0x220 doaction.isra.0+0x1db4/0x83a0 logreplay+0x920a/0xd300 ntfsloadlogandreplay+0x3ef/0x510 ntfsfillsuper+0x1d23/0x4550
The buggy address belongs to the object at ffff888005c74800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 56 bytes inside of allocated 1024-byte region [ffff888005c74800, ffff888005c74c00)
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In fs/ntfs3/fslog.c, before copying the CreateAttribute data, reject the operation if used + asize > sbi->record_size (for example, return NULL).
Event History
Frequently Asked Questions
Who is exposed to this issue?
Systems using the Linux kernel NTFS3 filesystem driver are exposed when mounting an NTFS volume whose on-disk log records are attacker-controlled. This can include removable media or disk images obtained from untrusted sources.
What does an attacker need to exploit it?
The attacker needs to craft an NTFS filesystem log record with a malicious CreateAttribute size value and have the affected system mount or replay that filesystem. The vulnerable size value is read from on-disk data during mount-related processing.
What should be done if patching cannot happen immediately?
Avoid mounting untrusted NTFS volumes or disk images with the NTFS3 driver until the fix is deployed. The issue is resolved by bounding the attribute size against the allocated MFT record size before data is copied.