Bug 325902 - [launcher] Windows LoadLibrary search cwd DLL exploit
Summary: [launcher] Windows LoadLibrary search cwd DLL exploit
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Launcher (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: 3.6.2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: security
Depends on:
Blocks: 325903
  Show dependency tree
 
Reported: 2010-09-21 16:18 EDT by Andrew Niefer CLA
Modified: 2011-06-10 14:28 EDT (History)
6 users (show)

See Also:


Attachments
patch (3.46 KB, patch)
2010-12-20 15:44 EST, Andrew Niefer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Niefer CLA 2010-09-21 16:18:25 EDT
On windows, the default search when loading native libraries with LoadLibrary without an absolute path searches the current working directory before the windows search path. [1]

Therefore, native code trying to load a shared library that it expects to find on the windows search path is vulnerable to a malicious dll being placed in the current working directory in a manner similar to bug 325294

The proposed fix is to call SetDllDirectory[2] to remove the cwd from the search.

For > 3.6.x we may want to also add the cwd to the end of the PATH env variable to preserve finding libraries there but still closing the vulnerability.  We must also ensure that this change affects the child vm process when the vm is not in-process.

[1] http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx
[2] http://msdn.microsoft.com/en-us/library/ms686203%28v=VS.85%29.aspx
Comment 1 Andrew Niefer CLA 2010-10-08 15:29:37 EDT
Test shows that adjusting the the dll directory in the launcher has no affect when java is forked in a new process.
Comment 2 Andrew Niefer CLA 2010-10-08 16:22:28 EDT
I have not been able to find any method for securing the child java process.
Comment 3 Andrew Niefer CLA 2010-12-20 15:44:26 EST
Created attachment 185593 [details]
patch

Patch adds the current working directory to the end of the search path.
Comment 4 Andrew Niefer CLA 2011-01-11 10:14:56 EST
Patch was released to 3.6.2