In the Linux kernel, the following vulnerability has been resolved:
nfsd: fix possible fh_compose of wrong dentry in nfsd4_create_file()
dentry_create() can hypothetically provide a different dentry than the
one passed in. This could happen, for example, if the exported
filesystem is NFS, and the server returned to OPEN a filehandle which
matched a directory that was already in the dcache. Clearly this would
not be expected!
If this were to happen the dentry (child) that was already stored in
resfhp could be freed and later dereferenced.
We shouldn't call fh_compose() until we are certain that we have the
final dentry, so this patch moved the fh_compose() call to two places:
one for the case where the target already exists, and one after
dentry_create() where it was created.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8
AV:N - The flaw is in nfsd4_create_file(), reached from a remote NFSv4 COMPOUND OPEN(CREATE) on in-kernel nfsd (TCP/2049) via nfsd4_proc_compound(), nfsd4_open(), and do_open_lookup(), so a network NFS client can hit it with no local access on the server.
AC:L - On nfsd re-exports of filesystems with ->atomic_open (NFS, CIFS, FUSE, Ceph, GFS2), a client can populate the dcache with directory lookups and then issue OPEN(CREATE) so dentry_create()/atomic_open()/d_splice_alias() returns a different dentry than fh_compose() stored; no race or layout beyond the attacker's requests is required.
PR:N - In the highest reasonable deployment a writable NFS export uses AUTH_SYS, AUTH_NULL, or host-based access, so a remote client can spoof a create-capable identity and reach nfsd4_create_file() without a real server account, Kerberos, or init-namespace privilege.
UI:N - Exploitation is solely the attacker's own NFSv4 OPEN(CREATE) compound after nfsd and the export are already running; no victim user must mount, open a file, or otherwise interact.
S:U - The use-after-free corrupts dentry state in the NFS server kernel under the same host security authority and does not cross a VM, IOMMU, or guest-to-host boundary.
C:H - fh_compose() stores the lookup dentry in resfhp, then atomic_open()/d_splice_alias() can drop that object so later nfsd_create_setattr(), nfsd_check_obj_isreg(), and nfsd4_process_open2() dereference a freed dentry, which is a use-after-free read primitive over kernel heap.
I:H - A freed struct dentry can be reallocated and sprayed, corrupting d_inode, d_op, and related VFS objects used on the OPEN path, which is a write/control-flow hijack primitive equivalent to other kernel dentry use-after-frees.
A:H - The stale resfhp->fh_dentry is used in the same request (including d_inode() in nfsd_check_obj_isreg() and fh_getattr()), so the use-after-free oopses or panics nfsd and can take down the host kernel.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:N - The flaw is in nfsd4_create_file(), reached from a remote NFSv4 COMPOUND OPEN(CREATE) on in-kernel nfsd (TCP/2049) via nfsd4_proc_compound(), nfsd4_open(), and do_open_lookup(), so a network NFS client can hit it with no local access on the server.
AC:L - On nfsd re-exports of filesystems with ->atomic_open (NFS, CIFS, FUSE, Ceph, GFS2), a client can populate the dcache with directory lookups and then issue OPEN(CREATE) so dentry_create()/atomic_open()/d_splice_alias() returns a different dentry than fh_compose() stored; no race or layout beyond the attacker's requests is required.
PR:N - In the highest reasonable deployment a writable NFS export uses AUTH_SYS, AUTH_NULL, or host-based access, so a remote client can spoof a create-capable identity and reach nfsd4_create_file() without a real server account, Kerberos, or init-namespace privilege.
UI:N - Exploitation is solely the attacker's own NFSv4 OPEN(CREATE) compound after nfsd and the export are already running; no victim user must mount, open a file, or otherwise interact.
S:U - The use-after-free corrupts dentry state in the NFS server kernel under the same host security authority and does not cross a VM, IOMMU, or guest-to-host boundary.
C:H - fh_compose() stores the lookup dentry in resfhp, then atomic_open()/d_splice_alias() can drop that object so later nfsd_create_setattr(), nfsd_check_obj_isreg(), and nfsd4_process_open2() dereference a freed dentry, which is a use-after-free read primitive over kernel heap.
I:H - A freed struct dentry can be reallocated and sprayed, corrupting d_inode, d_op, and related VFS objects used on the OPEN path, which is a write/control-flow hijack primitive equivalent to other kernel dentry use-after-frees.
A:H - The stale resfhp->fh_dentry is used in the same request (including d_inode() in nfsd_check_obj_isreg() and fh_getattr()), so the use-after-free oopses or panics nfsd and can take down the host kernel.
CVSS 3.1