{"id":"CVE-2026-99448","state":"PUBLISHED","title":"ufs: use u64 for directory size in ufs_last_byte","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nufs: use u64 for directory size in ufs_last_byte\n\nufs1_read_inode() and ufs2_read_inode() copy the untrusted 64-bit\non-disk size into inode->i_size.  ufs_last_byte() then truncates that\nvalue to an unsigned int before calculating the valid extent of a\ndirectory folio.\n\nA directory size of exactly 4 GiB is truncated to zero.  In\nufs_find_entry(), subtracting the requested record length from that zero\nforms an endpoint almost 4 GiB beyond the mapped folio.  A crafted UFS2\nimage produces:\n\n  BUG: KASAN: use-after-free in ufs_find_entry+0x583/0x6e0 [ufs]\n  Read of size 1\n  ...\n  ufs_find_entry\n  ufs_inode_by_name\n  ufs_lookup\n  __lookup_slow\n  path_lookupat\n\nThe KASAN classification reflects that the adjacent physical page was\nfree; the source-level operation is an out-of-folio read.  A controlled\nUFS1 test with CONFIG_UFS_FS_WRITE enabled also made ufs_find_entry()\nreturn a directory entry from an adjacent anonymous page.  unlink() then\npassed that pointer to ufs_delete_entry(), which cleared the adjacent\npage's 3\n2-bit d_ino.  This write result reproduced three out of three\ntimes.\n\nUFS normally requires a privileged mount path.  A relevant boundary is\na privileged automounter or image-processing service handling an\nattacker-supplied filesystem.  The write primitive additionally requires\nUFS1 to be mounted read-write with CONFIG_UFS_FS_WRITE enabled; the read\nis reachable with read-only UFS2.\n\nKeep the intermediate size arithmetic at 64 bits so non-final pages are\nbounded at PAGE_SIZE.  With this change, the same controlled tests reach\nthe real on-disk directory entry and produce no adjacent-page write or\nKASAN report.  A reproducer and full validation logs are available on\nrequest.\n\nThe vulnerable helper is present in v7.2-rc3, v7.1, v6.18.38, v6.12.95,\nv6.6.111, and upstream master at 1229e2e57a5c.  Runtime reproduction and\nfix validation were performed in an x86-64 QEMU guest running v7.2-rc3\nwith generic KASAN.","publishedAt":"2026-11-19T14:41:37.703Z","updatedAt":"2026-11-22T11:08:18.931Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"ae50223c56b9a1c27d4f824c9e2fbbefc8686891","versionType":"git"},{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"c792858491ee39e8f6e1547c45422595cf25b415","versionType":"git"},{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"ac2859c61ecf52a9e39b44b35c981dbfeb8ad54b","versionType":"git"},{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"1eff23433e73d7da4f9e3529d2701e34962b161f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ufs/dir.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.18","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ufs/dir.c"]}],"references":["https://git.kernel.org/stable/c/ae50223c56b9a1c27d4f824c9e2fbbefc8686891","https://git.kernel.org/stable/c/c792858491ee39e8f6e1547c45422595cf25b415","https://git.kernel.org/stable/c/ac2859c61ecf52a9e39b44b35c981dbfeb8ad54b","https://git.kernel.org/stable/c/1eff23433e73d7da4f9e3529d2701e34962b161f"],"weaknesses":[],"ingestedAt":"2026-11-22T11:18:06.032Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/99xxx/CVE-2026-99448.json","commit":"247cc9beefd85903834df0592e88a44f4d599223","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-99448","state":"PUBLISHED","datePublished":"2026-11-19T14:41:37.703Z","dateUpdated":"2026-11-22T11:08:18.931Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.415Z"},"containers":{"cna":{"title":"ufs: use u64 for directory size in ufs_last_byte","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nufs: use u64 for directory size in ufs_last_byte\n\nufs1_read_inode() and ufs2_read_inode() copy the untrusted 64-bit\non-disk size into inode->i_size.  ufs_last_byte() then truncates that\nvalue to an unsigned int before calculating the valid extent of a\ndirectory folio.\n\nA directory size of exactly 4 GiB is truncated to zero.  In\nufs_find_entry(), subtracting the requested record length from that zero\nforms an endpoint almost 4 GiB beyond the mapped folio.  A crafted UFS2\nimage produces:\n\n  BUG: KASAN: use-after-free in ufs_find_entry+0x583/0x6e0 [ufs]\n  Read of size 1\n  ...\n  ufs_find_entry\n  ufs_inode_by_name\n  ufs_lookup\n  __lookup_slow\n  path_lookupat\n\nThe KASAN classification reflects that the adjacent physical page was\nfree; the source-level operation is an out-of-folio read.  A controlled\nUFS1 test with CONFIG_UFS_FS_WRITE enabled also made ufs_find_entry()\nreturn a directory entry from an adjacent anonymous page.  unlink() then\npassed that pointer to ufs_delete_entry(), which cleared the adjacent\npage's 3\n2-bit d_ino.  This write result reproduced three out of three\ntimes.\n\nUFS normally requires a privileged mount path.  A relevant boundary is\na privileged automounter or image-processing service handling an\nattacker-supplied filesystem.  The write primitive additionally requires\nUFS1 to be mounted read-write with CONFIG_UFS_FS_WRITE enabled; the read\nis reachable with read-only UFS2.\n\nKeep the intermediate size arithmetic at 64 bits so non-final pages are\nbounded at PAGE_SIZE.  With this change, the same controlled tests reach\nthe real on-disk directory entry and produce no adjacent-page write or\nKASAN report.  A reproducer and full validation logs are available on\nrequest.\n\nThe vulnerable helper is present in v7.2-rc3, v7.1, v6.18.38, v6.12.95,\nv6.6.111, and upstream master at 1229e2e57a5c.  Runtime reproduction and\nfix validation were performed in an x86-64 QEMU guest running v7.2-rc3\nwith generic KASAN."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"ae50223c56b9a1c27d4f824c9e2fbbefc8686891","versionType":"git"},{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"c792858491ee39e8f6e1547c45422595cf25b415","versionType":"git"},{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"ac2859c61ecf52a9e39b44b35c981dbfeb8ad54b","versionType":"git"},{"version":"b71034e5e67d1577424cebe7bbb7d0ce134a4cd8","status":"affected","lessThan":"1eff23433e73d7da4f9e3529d2701e34962b161f","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ufs/dir.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.18","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ufs/dir.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/ae50223c56b9a1c27d4f824c9e2fbbefc8686891"},{"url":"https://git.kernel.org/stable/c/c792858491ee39e8f6e1547c45422595cf25b415"},{"url":"https://git.kernel.org/stable/c/ac2859c61ecf52a9e39b44b35c981dbfeb8ad54b"},{"url":"https://git.kernel.org/stable/c/1eff23433e73d7da4f9e3529d2701e34962b161f"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The on-disk directory ui_size is copied into inode->i_size by ufs1_read_inode() or ufs2_read_inode() from the inode block read with sb_bread(). ufs_last_byte() is reached from path_lookupat() through ufs_lookup(), ufs_inode_by_name() and ufs_find_entry(), or from getdents() through ufs_readdir().\nAC:L - A directory ui_size of 4294967296 makes ufs_last_byte() truncate inode->i_size to unsigned 0 on page 0, and ufs_find_entry() adds the unsigned wrap of 0 minus UFS_DIR_REC_LEN(namelen) to the folio address. The image supplies that ui_size and a check-passing directory block, so the first lookup takes this path.\nPR:N - The party who supplies the image has no host credentials. ufs_fs_type.fs_flags is FS_REQUIRES_DEV, so mount_capable() requires capable(CAP_SYS_ADMIN) of the mounting process; ufs_lookup() then only applies may_lookup() to the ui_mode loaded by ufs1_read_inode().\nUI:R - ufs_fill_super() reaches ufs_iget(UFS_ROOTINO) and d_make_root(). The ufs_last_byte() underflow runs when a person mounts the crafted image and looks up a name or calls getdents on that directory.\nS:U - The folio overrun in ufs_find_entry() and the dir->d_ino store in ufs_delete_entry() both affect memory of the same kernel that mounted the volume.\nC:H - After the unsigned wrap, the ufs_find_entry() and ufs_readdir() end pointer lies almost 4GiB past the address from ufs_get_folio(). The loops parse the next physical page as ufs_dir_entry records, and ufs_readdir() passes de->d_name and ufs_get_de_namlen() to dir_emit() when d_ino is nonzero.\nI:H - ufs_unlink() passes the ufs_find_entry() pointer to ufs_delete_entry(), which stores 0 to dir->d_ino. With a 4GiB directory that pointer addresses the next physical page; the reported UFS1 run with CONFIG_UFS_FS_WRITE cleared that adjacent 32-bit d_ino on three of three tries.\nA:H - The read is the KASAN use-after-free in ufs_find_entry() reached from path_lookupat(). If the following dirent's d_reclen is 0, ufs_next_entry() returns the same pointer and the ufs_find_entry() loop does not reach its endpoint."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-22T11:08:18.931Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.18","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.18","versionEndExcluding":"6.18.61"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.18","versionEndExcluding":"7.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.18","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}