Windows Metafile vulnerability

From Wikipedia, the free encyclopedia

It has been suggested that this article or section be merged with Windows Metafile. (Discuss)

The Windows Metafile vulnerability is a security vulnerability in Microsoft Windows NT-based operating systems which has been used in a variety of exploits since late December 2005. The vulnerability was first discussed in the computer security community around 26 and December 27, 2005, with the first reports of affected computers subsequently announced within 24 hours. As of January 5, 2006, a high priority update to fix this vulnerability is available via Windows Update (see announcement). No patches are needed for Windows 98, Windows 98 Second Edition or Windows Millennium Edition, as they are unaffected by this vulnerability.

The vulnerability, located in gdi32.dll, arises from the way in which Windows operating systems handle Windows Metafile (WMF) vector images, and permits arbitrary code to be executed on affected computers without the knowledge or permission of their users. The vulnerability therefore facilitates the propagation of various types of malware, typically through drive-by downloads.

Contents

[edit] Affected systems

Windows Metafiles are extensively supported by all versions of the Microsoft Windows operating system. All versions from Windows 3.0 to the latest Windows Server 2003 R2 contain this security flaw. However, versions from Windows XP onwards are more severely affected than earlier versions, since they have a handler and reader for the WMF file in their default installation. [1]

According to Steve Gibson's M.I.C.E. analysis, no versions of Windows made before Windows XP are affected, except for Windows 2000 and Windows NT 4. However, Windows NT 4 may be affected by known exploits if it has an Image Preview Feature enabled. [2] Computers NOT susceptible to known exploits of the flaw (but potentially susceptible to future versions or as-yet undiscovered exploits) include: those running other versions of Windows, without Image Previewing enabled, or those with hardware-based Data Execution Prevention (DEP) effective for all applications [3].

Machines running non-Windows operating systems (e.g. Mac OS, Linux, etc.) are not directly affected. A scenario in which such computers might become vulnerable would be where a third-party program or library, designed to view WMF files on a non-Windows system, used the native Windows GDI DLL [4], or a clone, that copied the design flaw leading to this bug, e.g. through a Windows emulator or compatibility layer. As an example, while Wine has its own version of GDI, it follows the Microsoft GDI so closely (even beyond the documented Windows specifications) that it does, in fact, currently have the flaw [5], although it might not be exploitable in the same way.

More recently, Steve Gibson stated here that the vulnerability could be exploited in Wine, and has provided a tool called MouseTrap to detect this on all Windows systems, together with a command line version called MouseTrapCmd for testing less compatible Wine builds.

[edit] The vulnerability

According to assessments by F-Secure [6], the vulnerability is an inherent defect in the design of WMF files, because the underlying architecture of such files is from a previous era, and includes features which allow actual code to be executed whenever a WMF file opens. The original purpose of this was mainly to handle the cancellation of print jobs during spooling.

According to Secunia, “The vulnerability is caused due to an error in the handling of Windows Metafile files (‘.wmf’) containing specially crafted SETABORTPROC ‘Escape’ records. Such records allow arbitrary user-defined function to be executed when the rendering of a WMF file fails.” According to the Windows 3.1 SDK docs, the SETABORTPROC escape was obsoleted and replaced by the function of the same name in Windows 3.1, long before the WMF vulnerability took advantage of it.

The vulnerability is CVE-2005-4560 in the Common Vulnerabilities and Exposures database, US-CERT reference VU#181038 and Microsoft Knowledge Base Article 912840.

It has been suggested that other vulnerabilities in the function of the WMF file may exist.

[edit] Propagation and infection

Computers can be affected via the spread of infected e-mails which may carry the hacked WMF file as an attachment. Infection may also result from:

Other methods may also be used to propagate infection. Because the problem is within the operating system, using different browsers like Firefox or Opera would not provide complete protection. Users will commonly be prompted to download and view the file, upon which infection would occur. Infected files may be downloaded automatically, which opens the possibility for infection by disk indexing or accidental previewing.

According to assessments from the McAfee antivirus company [7], the vulnerability has been used to propagate the Bifrose backdoor trojan horse. Other forms of malware have also exploited the vulnerability to deliver various malicious payloads.

McAfee claims that the first generation of such exploits had been encountered by more than 6% of their customer base by 31 December 2005.

[edit] Official patch

Microsoft released an official patch (available here) to address the problem on 5 January 2006, five days earlier than originally stated. This patch may be applied in lieu of other corrective measures.

The official patch is available for Windows 2000, Windows XP and Microsoft Windows Server 2003. A patch has not been released for Windows 98 or Windows Me, as Microsoft decided the vulnerability is not a critical one on these operating systems. (Only critical updates are offered by Microsoft for these due to partial support.) Other Windows operating systems that are affected by this will not receive a patch as they are no longer supported by Microsoft. Steve Gibson stated here, in his Security Now! podcast #20, that his company Gibson Research Corporation would make a patch available for Windows 9X systems if Microsoft will not. After further research, in the more recent Security Now! podcast #23, --Steve Gibson states here that Windows 9X and ME users are not vulnerable, and that these systems do not need to be patched. -- (Warning: This is most likely misinformation since websites have been discovered with payloads geared for 9X)

Windows 98 and Windows Me users who were seeking to patch could install Paolo Monti's patch from Eset, the manufacturers of the NOD32 Anti-virus System. The patch is free to download, and claims to work for older systems, but is supplied without warranty. It is available here.

There have been reports of the official patch being automatically installed even when Windows Automatic Update is configured to download the updates automatically but ask before applying them. This results in an automatic reboot, which can cause loss of data (particularly if the user has a program open with unsaved changes). [8]

[edit] Other corrective measures

[edit] Workaround

As a workaround [9], on 28 December 2005 Microsoft advised Windows users to unregister the dynamic-link library file shimgvw.dll (which can be done by executing the command regsvr32.exe /u shimgvw.dll from the Run menu or the command prompt) which invokes previewing of image files and is exploited by most of these attacks. The DLL can be re-registered once the flaw is fixed by running regsvr32.exe shimgvw.dll. This workaround does not eliminate the vulnerability, it only blocks a common attack vector.

[edit] Third party patch

A third party patch [10] was released by Ilfak Guilfanov on 31 December 2005 to temporarily disable the vulnerable function call in gdi32.dll. This unofficial patch received much publicity due to the unavailability of an official one from Microsoft, receiving the recommendation of SANS Institute Internet Storm Center [11] and F-Secure [12]. Because of the large amount of publicity, including being indirectly slashdotted [13], Guilfanov's website was overrun with more visitors than it could have coped with, causing it to be suspended on 3 January 2006. During the downtime, the patch was available for download from a number of mirrors, including the Internet Storm Center website [14].

Guilfanov's website went back online on 4 January in a much reduced state. No longer providing the patch on site due to bandwidth issues, the homepage provides a list of mirrors where a user can download the patch and the associated vulnerability checker. Also available is the MD5 checksum for the original file, so that a user can check the file they downloaded is an unmodified version.

After Microsoft released its patch, Guilfanov took his offline and urged visitors to install the official patch, as his intention was always to spur the release of a supported and tested patch.

[edit] Risk reduction techniques

Microsoft says its patch removes the flawed functionality in gdi32 that allowed the WMF vulnerability. For computers running a version of Windows that Microsoft has not patched, a defence in depth approach is recommended, to mitigate the risk of infection. Various sources have recommended mitigation efforts that include:

  • Making use of hardware-enforced Data Execution Prevention [15] effective for all applications.
  • Set the default WMF application to be something innocuous such as Notepad.
  • Do not use Internet Explorer or at least turn off downloads by setting the default security settings to HIGH.
  • Be vigilant in keeping all anti-virus software up-to-date. Consider frequent manual updates.
  • Block all WMF files at your network perimeter by file header filtering.
  • Making use of users accounts that are configured with as few user rights as necessary.
  • Disable image loading in Internet Explorer, and all other browsers. [16]
  • Disable image loading in Outlook Express. [17]
  • Disable hyperlinks in MSN Messenger.
  • Disable the Indexing Service on Windows 2000, Windows XP and Windows Server 2003.
  • Disable Desktop Search applications such as Google Desktop or Windows Desktop Search until the problem is corrected.
  • Use a different operating system such as Linux or Mac OS X, especially for high risk activities such as instant messaging or browsing online forums which permit avatars or <img> tags.

According to this SANS Institute Internet Storm Center article, using a web browser other than Internet Explorer may offer additional protection against this vulnerability. Depending on settings, these browsers may ask the user before opening an image with the .wmf extension, but this only reduces the chance of opening the maliciously crafted Windows Metafile and does not protect against the vulnerability being exploited, as these browsers still open the metafile if it is masquerading as another format. It is better to entirely disable image loading in the browser you choose to use.

[edit] Accusations

An independent examination of the vulnerability by Steve Gibson of Gibson Research has suggested that the peculiar nature of the 'bug' is an indication that the vulnerability was actually a backdoor engineered consciously into the system [18]. Some sources have questioned this conclusion [19] [20] [21]. Steve Gibson has since clarified [22] that his use of the term backdoor was never intended to imply anything done by malicious intent. He still maintains that the backdoor was intentional, though not necessarily officially mandated by Microsoft (e.g. a rogue employee may have put it in).

[edit] Notes

  1.   Security Watch: Iniquitous Images Imperil the Internet!, Larry Seltzer, PC Magazine, published on ABC News Website.
  2.   A Description of the Image Preview Feature in Windows Millennium Edition, Microsoft.
  3.   sunbeltblog.blogspot.com Microsoft clarifies DEP issue
  4.   Library for non-Windows operating systems to run WMF files.
  5.   Linux/BSD still exposed to WMF exploit through WINE, ZDNet.
  6.   It's not a bug, it's a feature, F-Secure.
  7.   Exploit-WMF, by McAfee
  8.   Does Windows Patch Without Permission?
  9.   Microsoft Security Advisory (912840) - Vulnerability in Graphics Rendering Engine Could Allow Remote Code Execution, Microsoft Official Advisory on the vulnerability.
  10.   http://www.hexblog.com/2005/12/wmf_vuln.html, unofficial patch by Ilfak Guilfanov.
  11.   Trustworthy Computing, SANS Institute Internet Storm Center.
  12.   Ilfak to the rescue!, F-Secure.
  13.   Trustworthy Computing, Slashdot. Linking to SANS Institute Internet Storm Center's article titled Trustworthy Computing (see above).
  14.   .MSI installer file for WMF flaw available, SANS Institute Internet Storm Center.
  15.   How to Configure Memory Protection in Windows XP SP2, software-enforced Data Execution Prevention (DEP) feature in Microsoft Windows XP SP 2.
  16.   How to improve browsing performance in Internet Explorer (KB153790), Microsoft.
  17.   Images are blocked when you open an e-mail message in Outlook Express on a Windows XP Service Pack 2-based computer (KB843018), Microsoft.
  18.   http://www.nod32.ch/en/download/tools.php Unofficial WMF patch by Paolo Monti distributed by ESET.
  19.   http://blogs.securiteam.com/index.php/archives/210 Unofficial Windows 98SE patch by Tom Walsh.

[edit] External links

In other languages