{"id":"CVE-2023-53804","state":"PUBLISHED","title":"nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()\n\nDuring unmount process of nilfs2, nothing holds nilfs_root structure after\nnilfs2 detaches its writer in nilfs_detach_log_writer().  However, since\nnilfs_evict_inode() uses nilfs_root for some cleanup operations, it may\ncause use-after-free read if inodes are left in \"garbage_list\" and\nreleased by nilfs_dispose_list() at the end of nilfs_detach_log_writer().\n\nFix this issue by modifying nilfs_evict_inode() to only clear inode\nwithout additional metadata changes that use nilfs_root if the file system\nis degraded to read-only or the writer is detached.","publishedAt":"2025-12-09T00:01:01.787Z","updatedAt":"2026-08-05T09:16:07.269Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"f31e18131ee2ce80a4da5c808221d25b1ae9ad6d","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"2a782ea8ebd712a458466e3103e2881b4f886cb5","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"116d53f09ff52e6f98e3fe1f85d8898d6ba26c68","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"6b4205ea97901f822004e6c8d59484ccfda03faa","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"b8427b8522d9ede53015ba45a9978ba68d1162f5","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"acc2a40e428f12780004e1e9fce4722d88f909fd","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"fb8e8d58f116d069e5939e1f786ac84e7fa4533e","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"9b5a04ac3ad9898c4745cba46ea26de74ba56a8e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/nilfs2/inode.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.37","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.37","versionType":"semver"},{"version":"4.14.316","status":"unaffected","lessThanOrEqual":"4.14.*","versionType":"semver"},{"version":"4.19.284","status":"unaffected","lessThanOrEqual":"4.19.*","versionType":"semver"},{"version":"5.4.244","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.181","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.113","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.30","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.3.4","status":"unaffected","lessThanOrEqual":"6.3.*","versionType":"semver"},{"version":"6.4","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/nilfs2/inode.c"]}],"references":["https://git.kernel.org/stable/c/f31e18131ee2ce80a4da5c808221d25b1ae9ad6d","https://git.kernel.org/stable/c/2a782ea8ebd712a458466e3103e2881b4f886cb5","https://git.kernel.org/stable/c/116d53f09ff52e6f98e3fe1f85d8898d6ba26c68","https://git.kernel.org/stable/c/6b4205ea97901f822004e6c8d59484ccfda03faa","https://git.kernel.org/stable/c/b8427b8522d9ede53015ba45a9978ba68d1162f5","https://git.kernel.org/stable/c/acc2a40e428f12780004e1e9fce4722d88f909fd","https://git.kernel.org/stable/c/fb8e8d58f116d069e5939e1f786ac84e7fa4533e","https://git.kernel.org/stable/c/9b5a04ac3ad9898c4745cba46ea26de74ba56a8e"],"weaknesses":[],"ingestedAt":"2026-10-29T20:06:33.064Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2023/53xxx/CVE-2023-53804.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2023-53804","state":"PUBLISHED","datePublished":"2025-12-09T00:01:01.787Z","dateUpdated":"2026-08-05T09:16:07.269Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-12-08T23:58:35.276Z"},"containers":{"cna":{"title":"nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()\n\nDuring unmount process of nilfs2, nothing holds nilfs_root structure after\nnilfs2 detaches its writer in nilfs_detach_log_writer().  However, since\nnilfs_evict_inode() uses nilfs_root for some cleanup operations, it may\ncause use-after-free read if inodes are left in \"garbage_list\" and\nreleased by nilfs_dispose_list() at the end of nilfs_detach_log_writer().\n\nFix this issue by modifying nilfs_evict_inode() to only clear inode\nwithout additional metadata changes that use nilfs_root if the file system\nis degraded to read-only or the writer is detached."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"f31e18131ee2ce80a4da5c808221d25b1ae9ad6d","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"2a782ea8ebd712a458466e3103e2881b4f886cb5","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"116d53f09ff52e6f98e3fe1f85d8898d6ba26c68","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"6b4205ea97901f822004e6c8d59484ccfda03faa","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"b8427b8522d9ede53015ba45a9978ba68d1162f5","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"acc2a40e428f12780004e1e9fce4722d88f909fd","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"fb8e8d58f116d069e5939e1f786ac84e7fa4533e","versionType":"git"},{"version":"e912a5b66837ee89fb025e67b5efeaa11930c2ce","status":"affected","lessThan":"9b5a04ac3ad9898c4745cba46ea26de74ba56a8e","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/nilfs2/inode.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.37","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.37","versionType":"semver"},{"version":"4.14.316","status":"unaffected","lessThanOrEqual":"4.14.*","versionType":"semver"},{"version":"4.19.284","status":"unaffected","lessThanOrEqual":"4.19.*","versionType":"semver"},{"version":"5.4.244","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.181","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.113","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.30","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.3.4","status":"unaffected","lessThanOrEqual":"6.3.*","versionType":"semver"},{"version":"6.4","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/nilfs2/inode.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/f31e18131ee2ce80a4da5c808221d25b1ae9ad6d"},{"url":"https://git.kernel.org/stable/c/2a782ea8ebd712a458466e3103e2881b4f886cb5"},{"url":"https://git.kernel.org/stable/c/116d53f09ff52e6f98e3fe1f85d8898d6ba26c68"},{"url":"https://git.kernel.org/stable/c/6b4205ea97901f822004e6c8d59484ccfda03faa"},{"url":"https://git.kernel.org/stable/c/b8427b8522d9ede53015ba45a9978ba68d1162f5"},{"url":"https://git.kernel.org/stable/c/acc2a40e428f12780004e1e9fce4722d88f909fd"},{"url":"https://git.kernel.org/stable/c/fb8e8d58f116d069e5939e1f786ac84e7fa4533e"},{"url":"https://git.kernel.org/stable/c/9b5a04ac3ad9898c4745cba46ea26de74ba56a8e"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The flaw is reached only through a locally mounted nilfs2 volume — attacker-supplied on-disk metadata plus ordinary local file syscalls and the unmount path; nothing in fs/nilfs2 parses data from a remote peer.\nAC:L - The attacker fully authors the on-disk image, so the `__nilfs_error()`→`SB_RDONLY` degeneration and the resulting `-EROFS` bail in `nilfs_segctor_do_construct()` are deterministic, and the free-then-use ordering inside `nilfs_detach_log_writer()` is a fixed code sequence rather than a race; syzbot reproduced it reliably.\nPR:L - An unprivileged local desktop/kiosk user is enough: udisks2/polkit lets an active local session mount and eject removable media without a password, and the writes that strand inodes on `ns_dirty_files` are ordinary unprivileged VFS operations — matching the PR:L assigned to the same-family nilfs2 crafted-image CVEs.\nUI:N - On an auto-mounting host the attacker performs every step themselves — supply the image, dirty the inodes, trigger the eject/unmount — so no action by a separate victim is required.\nS:U - The freed `nilfs_root` and `ifile` objects and any resulting corruption stay entirely within the kernel's own security authority; no hypervisor, IOMMU, or sandbox boundary is crossed.\nC:H - After `kfree(root)`, `nilfs_evict_inode()` reads `ii->i_root->ifile` from a reclaimable general-purpose slab object and passes it to `nilfs_ifile_get_inode_block()`/`nilfs_palloc_*`, so a groomed replacement object yields an attacker-chosen inode pointer and arbitrary kernel memory read; `root->ifile` itself is also already freed and its address_space is read out of freed memory.\nI:H - `atomic64_dec(&ii->i_root->inodes_count)` writes directly into the freed slab object at a fixed offset, and `nilfs_ifile_delete_inode()` performs `raw_inode->i_flags = 0` plus `mark_buffer_dirty()` through the attacker-reclaimable `->ifile` pointer, giving write primitives suitable for control-flow hijacking as well as corrupting ifile/allocator metadata written back to disk.\nA:H - This is a use-after-free that syzbot detected via KASAN; dereferencing the freed `nilfs_root` and the already-`iput()`ed ifile inode during unmount readily oopses or panics the kernel, and the corruption drives further filesystem failure."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T09:16:07.269Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"4.14.316"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"4.19.284"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.4.244"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.10.181"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"5.15.113"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"6.1.30"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"6.3.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.37","versionEndExcluding":"6.4"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}