GDI Scan Tutorial and how to fix the GDI+ JPEG VulnerabilityBy Lawrence Abrams on September 28, 2004 | Last Updated: February 27, 2012 | Read 25,572 times.
Table of Contents
GDI+ is a programming interface or API that enables programs to use graphics and formatted text on a video display or printer. A vulnerability, GDI+ JPEG Vulnerability, was found in the DLL gdiplus.dll used by GDI+ that has faulty code when processing JPEG images. People who know how this code can be exploited can craft a specially designed JPEG that can exploit this bug and possibly take control of your machine. If you view an image using an application that has this vulnerability, then it is possible for the remote program to issue commands on your computer at the same security level as your user account. Therefore if your user account is an administrator of your machine, then the remote code will have administrative privileges and be able to have full access to the security of your computer.
Microsoft has released an update for this vulnerability which you can get by going to Windows Update for the operating system update and Office Update for the Microsoft office update. Be sure to do those updates immediately as this tutorial assumes you already have them and is focused on resolving issues for 3rd party applications that may be affected by the GDI+ JPEG vulnerability.
A major problem with this vulnerability is that there are 3rd party, non-microsoft, applications that ship with this exploitable DLL. Since Microsoft's update only updates the DLL that came with the Operating System software, you still may be vulnerable from other applications that it does not upgrade. Microsoft released a GDI+ Detection Tool which will scan your computer and tell you if it found any MICROSOFT programs that may be vulnerable. Unfortunately it does not tell you WHAT programs are vulnerable and just directs you back to windows update and office update. Even worse, it does not let you know if any 3rd party software may be affected, leaving you still in the dark.
Because of this Tom Liston, the person who developed the LaBrea Tarpit honeypot software, has created a tool called GDI Scan that will scan a drive on your computer for files that are possibly vulnerable to the GDI+ JPEG exploit. When it has completed scanning the partition it will create a log that will show all possibly vulnerable DLLs found. You can then use this information to determine what programs are affected and then attempt to upgrade these programs so they are no longer vulnerable.
When you run this tool it will scan the partition you specify for any of the following files:
gdiplus.dll (known to be exploitable)
If it finds these files it will attempt to determine if they are vulnerable to the GDI JPEG exploit. If they are, they will be listed in red in the resulting log file.
It is important to note that the previously listed DLLs can be found in more than one location on your hard drive. If they are located in multiple locations on your computer, the program will check the following locations for the DLL, in this order, and if found uses the DLL it finds first:
It is therefore possible for the operating system to be properly patched, but for a copy of the exploitable DLL to still be found elsewhere in your computer, which still allows for the vulnerability.
Step 1: Download GUI version of gdiscan.exe
You can download GDI Scan from the following link:
Download the GUI version to a location you will remember later.
Once it is downloaded, double-click on gdiscan.exe and a screen similar to the one below will appear:
For Windows 95/98/ME Users
It is important to note that this application was designed specifically for XP,2000, or NT. This does not mean, though, that you can not use it in Windows 95, 98, or ME. In order to view the results properly we will need to create an RTF (Rich Text Format) document. Run the program as described above and when it is finished scanning your partition follow these steps:
Now that we have this log, I bet you are wondering what you are supposed to do with it. Well as of right now, the only DLL that we know for sure is exploitable is the gdiplus.dll. So we focus on those listings that contain that DLL and are the proper version or lower.
If it states that it finds DLLs in directories like Windows\$NtUniinstallKB you can safely ignore them. These directories are created in case you want to uninstall various Microsoft updates. Therefore it would not be strange to see the older DLLs there.
NOTE: Previously I had stated that files found in the \Windows\WinSxS directory could be safely ignored. It has been brought to my attention that this information was actually incorrect. The \Windows\WinSxS directory is where Windows stores it's side-by-side DLLs. Side-by-side DLLs are used to allow multiple versions of the same DLL to exist in Windows at the same time. The Operating System maintains a list of which applications use which side-by-side DLL. This allows different versions of the same DLL to coexist on the same computer and have multiple applications share them. Therefore if you see outdated DLLs found here you may want to see if they can be updated via OfficeUpdate, Windows Update, or replacing it with the redistributable. As always make a backup copy first of the DLL found in the \WinSxS first. - Thanks to Donald Smith for the clarification.
Lets take an example from the log above and see how we can interpret the results:
As you can see from the above figure, gdiscan found two exploitable copies of gdiplus.dll on my machine. One is in the FolderSizes directory and the other is in the WS_FTP Pro directory. I now know that I need to visit the web sites of these applications and see if there are any updates available. If there are, we download them, install them, and hope they fix the problem, which we can check by running gdiscan.exe again after the installation is complete. If the problem still exists, then you should contact the software manufacturer and explain the situation.
Another workaround may be to download the latest gdiplus.dll from Microsoft. This fix may cause problems with your software if the developers of that software added extra functionality into their copy of the gdiplus.dll. Therefore, please make a backup of the existing gdiplus.dll before you do this method.
You can download this file from the following link:
Now that you know how to check your system for GDI+ JPEG exploit it is advisable that you do so immediately. At the time of this writing more reports are coming out about tools and sample code to take advantage of this vulnerability. The sooner you run this tool and fix any of the exploitable copies of this DLL on your system, the safer you will be.
Comments:blog comments powered by Disqus
|Tech Support Forums | The Computer Glossary | RSS Feeds | Startups | The File Database | Virus Removal Guides | Downloads|