Windows: CiSetFileCache TOCTOU CVE-2017-11830 Variant WDAC Security Feature Bypass
It is possible to exploit a race condition in the CiSetFileCache kernel function by calling NtSetCachedSigningLevel. It is possible to create an image section with a writable (and executable) handle to the file and no part of CI then checks whether the caller has write access. To exploit this, the section signing level of the current process must be elevated using SetProcessMitigationPolicy or just running in a WDAC/CIG process. Then, a valid signed file must be copied to a known name and a writable and executable handle must be opened to that file. An oplock must be set on a known catalog file which will be checked, and NtCreateSection must be called with the handle requesting SEC_IMAGE. After waiting for the oplock to fire, the file must be rewritten with an untrusted image and NtCreateSection must be called again with the same handle. This will cause the kernel to cache the signature of the untrusted image, bypassing the signature checks.