MapsUpdateTask Task DLL side loading vulnerability

Abstract

A DLL side loading vulnerability was found in the MapsUpdateTask Task DLL that ships with Windows 10. This issue can be exploited by loading COM control as an embedded OLE object. When instantiating the object Windows will try to load the DLL phoneinfo.dll from the current working directory. If an attacker convinces the user to open a specially crafted (Office) document from a directory also containing the attacker's DLL file, it is possible to execute arbitrary code with the privileges of the target user. This can potentially result in the attacker taking complete control of the affected system.

See also

  • CVE-2016-0041
  • MS16-014: Security Update for Microsoft Windows to Address Remote Code Execution (3134228)

Tested versions

This issue was successfully verified on Windows 10 + Office 2016 64-bit.

Fix

Microsoft released MS16-014 that fixes this vulnerability.

Introduction

OLE is a technology that enables an application to create compound documents that contain information from a number of different sources. For example, a document in an OLE-enabled word processor can accept an embedded spreadsheet object. Unlike traditional "cut and paste" methods where the receiving application changes the format of the pasted information, embedded documents retain all their original properties. If the user decides to edit the embedded data, Windows activates the originating application and loads the embedded document.

OLE objects are loaded via a CLSID or indirectly via a programmatic identifier (ProgID). The CLSID is used to look up its associated DLL in the Windows Registry. In order to check if the provided CLSID is in fact an OLE object, this DLL needs to be loaded in memory first, even if the CLSID is not really an OLE object. Since the DLL may not be designed to be loaded this way, loading it can introduce security issues like side loading of malicious DLLs.

Vulnerability details

It was discovered that in the MapsUpdateTask Task DLL of Windows is affected by DLL side loading. Loading the COM control with CLSID {B9033E87-33CF-4D77-BC9B-895AFBBA72E4} as an OLE object will result in Windows trying to load the DLL phoneinfo.dll from the current working directory.

This issue exists in ztrace_maps.dll, which is loaded from the DllMain() function of MosHostClient.dll. MosHostClient.dll is loaded from mapsupdatetask.dll via its import table.

DllMain() calls ZTraceInit() from ztrace_maps.dll that calls ZTraceContext::Init(), which calls ZTraceContext::WriteStampAndStuff().

ZTraceContext::WriteStampAndStuff() contains a call to LoadLibraryExW(L"phoneinfo.dll", NULL, 0);. Since this call to LoadLibraryExW uses a relative path, it is vulnerable to side loading.

Figure 1: phoneinfo.dll loaded from a relative path

An attacker can exploit this issue by convincing a target user into opening a specially crafted (Office) document from a directory containing the attacker's DLL. This allows for the execution of arbitrary code that will be executed with the privileges of the target user, potentially resulting in a full compromise of the affected system.

Questions or feedback?