Description
Windows' standard DLL search path contains directories that can be vulnerable to DLL pre-loading attacks. An application can use the SetDefaultDllDirectories
API to specify a default DLL search path for the process that eliminates the most vulnerable directories and limits the other directories that are searched.
For example, as a precaution, Firefox removes the current directory from the DLL search path and then restricts the DLL search path to the application's installation directory, the Windows system directory, and any paths explicitly added using the AddDllDirectory
or SetDllDirectory
APIs.
To help protect against DLL pre-loading attacks, the Rust compiler could emit similar code to restrict its DLL search path for all Windows Rust programs. Changing the DLL search path could cause compatibility problems for Windows Rust programs that assume they can implicitly load DLLs in the current directory without explicitly configuring their DLL search path. The workaround is for those programs to configure their DLL search path using the the AddDllDirectory
or SetDllDirectory
APIs.
See MSDN for SetDefaultDllDirectories
: