CVE-2023-53311: nilfs2: fix use-after-free of nilfs_root in dirtying inodes via iput
In the Linux kernel, the following vulnerability has been resolved:
nilfs2: fix use-after-free of nilfs_root in dirtying inodes via iput
During unmount process of nilfs2, nothing holds nilfs_root structure after
nilfs2 detaches its writer in nilfs_detach_log_writer(). Previously,
nilfs_evict_inode() could cause use-after-free read for nilfs_root if
inodes are left in "garbage_list" and released by nilfs_dispose_list at
the end of nilfs_detach_log_writer(), and this bug was fixed by commit
9b5a04ac3ad9 ("nilfs2: fix use-after-free bug of nilfs_root in
nilfs_evict_inode()").
However, it turned out that there is another possibility of UAF in the
call path where mark_inode_dirty_sync() is called from iput():
nilfs_detach_log_writer()
nilfs_dispose_list()
iput()
mark_inode_dirty_sync()
__mark_inode_dirty()
nilfs_dirty_inode()
__nilfs_mark_inode_dirty()
nilfs_load_inode_block() --> causes UAF of nilfs_root struct
This can happen after commit 0ae45f63d4ef ("vfs: add support for a
lazytime mount option"), which changed iput() to call
mark_inode_dirty_sync() on its final reference if i_state has I_DIRTY_TIME
flag and i_nlink is non-zero.
This issue appears after commit 28a65b49eb53 ("nilfs2: do not write dirty
data after degenerating to read-only") when using the syzbot reproducer,
but the issue has potentially existed before.
Fix this issue by adding a "purging flag" to the nilfs structure, setting
that flag while disposing the "garbage_list" and checking it in
__nilfs_mark_inode_dirty().
Unlike commit 9b5a04ac3ad9 ("nilfs2: fix use-after-free bug of nilfs_root
in nilfs_evict_inode()"), this patch does not rely on ns_writer to
determine whether to skip operations, so as not to break recovery on
mount. The nilfs_salvage_orphan_logs routine dirties the buffer of
salvaged data before attaching the log writer, so changing
__nilfs_mark_inode_dirty() to skip the operation when ns_writer is NULL
will cause recovery write to fail. The purpose of using the cleanup-only
flag is to allow for narrowing of such conditions.
Security readout for executives and security teams
Plain-English summary
This is a Linux kernel NILFS2 filesystem bug. A local user can trigger memory misuse during filesystem cleanup, potentially leading to kernel crash or privilege-impacting behavior. It matters most on systems that allow local users or workloads to mount or use NILFS2. No source in the bundle shows active exploitation.
Executive priority
Prioritize this for shared Linux platforms, developer hosts, container-capable systems, and any server using NILFS2. It is high severity because local code execution context may affect kernel confidentiality, integrity, and availability, but urgency depends on whether NILFS2 is present and reachable by local users.
Technical view
CVE-2023-53311 is a NILFS2 use-after-free of nilfs_root when iput() dirties an inode during nilfs_detach_log_writer() cleanup. The vulnerable path reaches nilfs_dirty_inode() and nilfs_load_inode_block() after NILFS2 has released writer state. The fix adds a cleanup-only purging flag checked by __nilfs_mark_inode_dirty().
Likely exposure
Exposure is likely limited to Linux systems with affected kernel versions and NILFS2 filesystem use or mount capability. The CVSS vector is local, low complexity, low privileges, and no user interaction. Systems without NILFS2 enabled or usable by local users have materially lower practical exposure.
Exploitation context
The bundle cites a syzbot reproducer and kernel fix history, but not public exploitation in the wild. KEV is false. Treat this as a local kernel memory-safety issue with serious impact potential, not as a remotely exploitable internet-facing bug based on the supplied evidence.
Researcher notes
The issue follows earlier NILFS2 UAF work but uses a different dirty-inode path introduced by lazytime behavior. The source notes the condition appeared with a later NILFS2 change under syzbot, but may have existed before. The patch deliberately avoids using ns_writer checks to preserve recovery behavior.
Mitigation direction
Update to a kernel containing the referenced stable NILFS2 fix commits.
Check Linux distribution advisories for backported fixed kernel packages.
Restrict NILFS2 use on multi-user or untrusted workload systems until patched.
Remove unnecessary local mount privileges where operationally feasible.
Prioritize patching hosts that permit local shell, containers, or user workloads.
Validation and detection
Inventory Linux kernel versions across systems that use or allow NILFS2.
Confirm whether NILFS2 is built, loaded, or required operationally.
Map installed kernels to distro advisories or the listed stable commits.
Verify patched kernels boot and NILFS2 recovery workflows still function.
Document any compensating restrictions for systems awaiting kernel updates.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-416: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
1ADP providers
9Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-416 · source CWE mapping
Use After Free
Use After Free represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.