...
This approach will not work on all platforms. For example, on an Intel Core i5-2400 machine running Windows 7 Enterprise, all fileKey
attributes are null.
This solution is not perfect. Like the previous compliant solution, it has a TOCTOU race window between when the file's attributes are read and when the file is first opened. Likewise, there is another TOCTOU between the second attributes are read and the file is reopened.
Applicability
Many file-related vulnerabilities are exploited to cause a program to access an unintended file. Proper file identification is necessary to prevent exploitation.
...