Microsoft HLINK.DLL Hyperlink Object Library Buffer Overflow Vulnerability

This vulnerability allows remote attackers to execute arbitrary code on vulnerable applications that utilize Microsoft Hyperlink Component Object Model (COM) objects. Specifically, this includes at least Microsoft Word, PowerPoint and Excel. Exploitation over the web is doable via Office Web Components (OWC). It is not required for the target to have OWC installed.

The specific flaw exists within HLINK.DLL in the routine HrShellOpenWithMonikerDisplayName(). The vulnerability is due to an unchecked WzCopy (wide char string copy) to a stack based buffer from user-supplied data in the following call chain:


The specific WzCopy() responsible for the overflow is shown in the following disassembly snippet from HLINK.DLL version 5.2.3790.227 from Windows XP SP2:

    7682DA6B lea eax, [ebp+overflowed_buffer]
    7682DA71 push eax
    7682DA72 push [ebp+var_E30]
    7682DA78 call WzCopy(ushort const *,ushort *)

The overflowed buffer is at frame pointer offset 0x0E2C, requiring a 3,628 byte write before breaking out of the holding stack frame. Simply specifying a long URI string will not trigger the vulnerability. However, by requesting a URI that does a redirect with the HTTP "Location:" tag to a long URI, then the vulnerable code will be reached and a previous call to HrGetFullDisplayName() will pass the long URI to the vulnerable WzCopy(). The long URI must actually exist, otherwise the URI expansion will fail and the WzCopy() will never be reached.

TippingPoint Advisory