Overview |
On Windows, a security vulnerability called "DLL hijacking" can occur when an application loads a malicious DLL instead of the intended one. This risk arises when the system searches for application-dependent DLLs in directories that are writable or controlled by unauthorized users, allowing a legitimate DLL to be replaced with a malicious one of the same name. To mitigate this risk for your Java application, the Wrapper allows you to configure where the system will look for DLLs that are loaded by native libraries. Restricting the search to trusted directories helps prevent untrusted libraries from being loaded. The following properties can be used to configure search paths for DLLs: NOTEThe scope of these settings is limited to the Java application's process, meaning the configured search paths are not inherited by child processes.
Additionally, these settings only affect libraries loaded by native code, not those explicitly loaded by Java using methods like system. |
wrapper.java.windows.dll.search.mode Property |
||||||||
This property makes it possible to configure two modes: one leaving DLL searching to the system's default behavior, and the other one restricting the search to only the paths specified by the wrapper.java.windows.dll.search.path.<n> properties. The two modes are represented by the following tokens:
The default value is LEGACY.
NOTEWhen using LEGACY mode, the Wrapper allows the system to use its default mechanism for loading DLLs. Starting with Windows XP Service Pack 2, Windows follows a more secure DLL search order that excludes the application's working directory. This change helps reduce the risk of loading malicious DLLs from insecure locations. However, it's important to note that the search order still includes directories specified in the PATH environment variable. Since PATH is often shared system-wide, it may include directories that are not safe for the application to load libraries from. Specific directories can be added to the beginning of the PATH by using the wrapper.system.library.path.<n> properties. In contrast, when using RESTRICTED mode, the system does not search for DLLs in the directories listed in the PATH environment variable. Although the PATH is always populated with values from wrapper.java.windows.dll.search.path.<n>, the directories specified through these properties are not used by the system when searching for DLLs. RESTRICTED mode is therefore limited to the system32 path, the directory containing the Java command, and the paths specified with wrapper.java.windows.dll.search.path.<n>. WARNINGWhen using the RESTRICTED mode, be cautious as overly restrictive settings that disallow directories expected by the JVM or the application may result in DLL loading failures and runtime errors. |
wrapper.java.windows.dll.search.path.<n> Properties |
||||||||
This property set allows you to configure the paths to search when DLLs are loaded from native libraries. These properties only apply when wrapper.java.windows.dll.search.mode is set to RESTRICTED and are ignored when LEGACY is used.
<n> component:
|
Reference: Library |
|