Windows: LUAFV Delayed Virtualization MAXIMUM_ACCESS DesiredAccess EoP
The LUAFV is an enabled by default file system filter driver introduced in Windows Vista to support old applications which write to administrative locations such a System32 by virtualizing file access when certain criteria are met. The initial criteria is the process’ token needs to have the VirtualizationEnabled flag set to TRUE. This is done automatically for certain process types for app-compat but can be changed through NtSetInformationToken as long as the VirtualizationAllowed flag is also TRUE. This is the case for all normal users, even on Windows 10 1809. Outside of the token enable flag the file being opened must also meet a set of criteria: 1) The file being opened is in one of a number of protected locations. 2) The file can’t be owned by TrustedInstaller, but must have an ACE which grants the administrator full access. 3) The file name must not have one of a number of banned extensions, such as .exe. 4) The caller must be denied one of a set of write accesses when opening the file. If the file is virtualized a copy of the real file or directory is placed in the user’s VirtualStore inside %LOCALAPPDATA%, however for performance reasons (presumably) the driver won’t always do the copy immediately. If a caller’s file creation request meets the four criteria for a file which already exists, but a copy does not currently exist in the VirtualStore then the driver enables Delayed Virtualization on the file. This results in the file being opened with the requested access rights with the original file opened with read only access. The problem is that the driver reuses the file’s create request DesiredAccess parameter, which can include MAXIMUM_ACCESS, when virtualizing a file.