Thursday, August 26

DLL Preloading - Update Microsoft Recommendation

UPDATE September 2nd 2010 - Microsoft has issued new updated guidance and a new tool to help customers manage this within their environments.   This new tool helps configure environments to address the root cause of the issue, while software vendors update applications.  Highly recommend that organizations examine and use this tool to prevent exploitation.

As with most reported vulnerabilities Microsoft has issued a response to the DLL Preloading issue that has been hotly discussed.  Their advisory is interesting;

1.  First they recommend disallowing outbound SMB and WEBDAV access (at the firewall) to prevent users from making preloading connections out to the Internet.  This is a solid recommendation, but more in terms of general guidance instead of specifically to this issue.  The problem is that a malicious user could simply zip up the affected document with a copy of the dll and the user would be able to load it locally - hdmoore provides an audit kit that even builds the dll and sample file that can be used in exactly this way.  This advisory also includes disabling the client WEBDAV service which many legitimate deployed application use.

2.  Second they provide a tool that changes the dynamic library loading behaviour either for the entire system or for applications that are affected.  Again this issue is intended behaviour, there are applications that load DLLs at runtime from the current path in order to start appropriately.  This is a solid recommendation, but their may be significant impact to your client's environment.

3.  Third they recommend that developers of applications change individual application DLL loading behaviour to include explicit path definitions, and to use other routines other than DLL loading for system functionality.  These recommendations can be found in this MSDN article.

I recommend organizations utilize the audit kit provided by metasploit to determine which of their applications are affected by the issue, however make sure that you check applications which might not have their extensions registered with the system as the audit kit uses these extensions to build the list of files to check.  Once you know which applications are affected then make a judgement call on which ones to restrict from loading using the Microsoft tool.  Additionally clients should contact each of the affected vendors to ensure that a fix to the application is provided as soon as possible.

Tuesday, August 24

Windows DLL Injection Vulnerability

Most of the security world has now heard about the vulnerability that was reported by hdmoore regarding the linking of malicious dll files by using remote shares in the windows filesystem.  This issue has also been discussed at slashdot by many users.

Since metasploit is constantly updated with the latest public exploits, I decided to try this one out to see how easy it really is on the Windows 7 platform.  Here is the coles notes and results of my attempts.

1.  Prep my test environment.  I use a Windows 7 box fully patched running Windows Defender as my primary Windows work environment.  I also have the convenience of using VMware fusion to virtualize the environment so it was easy to clone my installation to create a sample copy.  I made sure to use the host-only networking so I can isolate the Windows box with metasploit.

2.  I updated my metasploit environment running on my OSX host.  A quick svn update gave me the latest code.  Version 10133 checked out.

3.  I opened msfconsole and loaded the "windows/browser/webdav_dll_hijacker" exploit.  I also set the payload to be the "windows/meterpreter/reverse_tcp" to get an interactive session with the exploited box.  You need to set some options to have it work, so I set the RHOST and SRVHOST variables to my internal host IP address 192.168.32.1.

4.  The last option to set is with the exploit, and I chose to give the file extension ppt and pptx for the exploited file to trigger an opening of Microsoft's Powerpoint application.  This names the resulting files to policy.ppt and policy.pptx.

5.  Type "exploit" and my listener is started and a webserver is created to host the two exploitable files.

6.  On the Windows 7 box, I enter "http://192.168.1.32/documents/" into the address bar.  The browser notices that this is a webdav supported server and loads explorer to display the remote files in the browser window.

7.  Double clicking on the ppt file alerts me that the browser is trying to access a share that requires additional privileges and asks me to confirm the operation, which I do - I really want to test the exploit!

8.  I choose allow to accept the executable attempt to run, and the exploit is run on the Windows 7 box.  I confirm by checking that there is an active session in meterpreter.