Nytro Posted May 1, 2014 Report Posted May 1, 2014 CVE-2014-1776 (IE 0day) AnalysisFireEye Research Labs identified a new Internet Explorer zero-day exploit used in targeted attacks. The vulnerability nearly affects all Internet Explorer versions (6/7/8/9/10/11). The exploit bypasses ASLR/DEP. CVE-2014-1776 was assigned to the vulnerability by Microsoft. There is not any public PoC / Exploit of the vulnerability on web. So we will not share it too. Vulnerability and Analysis Firstly, Websense’s claim is not truth, the vulnerability is not a buffer overflow. This is exactly a use after free. The vulnerability exists within the object used by MSHTML!CMarkup::IsConnectedToPrimaryMarkup+0×6. Exploit forces to re-use a dangling pointer of the object and this causes use-after-free error. Here is the crash point when we trigger the vulnerability with PoC.html. Crash occurs on MSHTML!CMarkup::IsConnectedToPrimaryMarkup+0×6 function. The function tries to “mov” an object that ESI points. After running !heap command for a quick analysis, we see that ESI points to an object which has been already free-ed: The object is free-ed by MSHTML!Cmarkup: PrivateRelease function as we see in heap trace. If we look at these functions , we will see that it calls HeapFree function: And this free-ed object re-used by MSHTML!CMarkup::IsConnectedToPrimaryMarkup+0×6 and this causes the use after free condition. Exploitation Exploit uses Flash vector object technique to bypass ASLR and DEP successfully. This is a common technique which used by fresh exploits nowadays. Exploit loads a flash file (SWF) before triggering the vulnerability and prepare the heap with this technique. To exploit use after free vulns, firstly we should know what size of object allocated before it becomes free-ed ? If we can create a fake object with same size using heap spray, then it’s possible to exploit this vulnerability. So I looked the crash function and wanted to follow where ESI comes from etc. So I put a breakpoint on MSHTML!CMarkup::IsConnectedToPrimaryMarkup and want to look at the heap allocations until it crashes. Here is the windbg command that I use; BP MSHTML!CMarkup::IsConnectedToPrimaryMarkup “!heap -p -a esi; g”and this is the result of windbg until it crashes:address 21be4bd8 found in_DPH_HEAP_ROOT @ 1f1000in busy allocation ( DPH_HEAP_BLOCK: UserAddr UserSize - VirtAddr VirtSize) 21a038bc: 21be4bd8 428 - 21be4000 2000MSHTML!CMarkup::`vftable'553b8e89 verifier!AVrfDebugPageHeapAllocate+0x0000022977270d96 ntdll!RtlDebugAllocateHeap+0x000000307722af0d ntdll!RtlpAllocateHeap+0x000000c4771d3cfe ntdll!RtlAllocateHeap+0x0000023a60cc0ee7 MSHTML!CDoc::CreateMarkupFromInfo+0x0000015860d0de89 MSHTML!CDoc::CreateMarkup+0x00000064612a6329 MSHTML!RemoveDOMNodeHelper+0x0000009360ed48a3 MSHTML!CElement::removeNode+0x00000033611d87bf MSHTML!Method_IDispatchpp_oDoVARIANTBOOL+0x0000006f61019697 MSHTML!CBase::ContextInvokeEx+0x000002b660e257a5 MSHTML!CElement::ContextInvokeEx+0x0000004c61025e62 MSHTML!CElement::VersionedInvokeEx+0x0000002a60d9f492 MSHTML!CBase::PrivateInvokeEx+0x0000006d690c5ef6 jscript9!HostDispatch::CallInvokeEx+0x000000ae690ce85a jscript9!HostDispatch::InvokeMarshaled+0x0000004b690ce79a jscript9!HostDispatch::InvokeByDispId+0x000001cf690ce5c3 jscript9!DispMemberProxy::DefaultInvoke+0x0000002368fe7530 jscript9!Js::InterpreterStackFrame::Process+0x00001e3c68fe7028 jscript9!Js::InterpreterStackFrame::InterpreterThunk+0x000001e8address 21be4bd8 found in_DPH_HEAP_ROOT @ 1f1000in free-ed allocation ( DPH_HEAP_BLOCK: VirtAddr VirtSize)21a038bc: 21be4000 2000553b90b2 verifier!AVrfDebugPageHeapFree+0x000000c277271564 ntdll!RtlDebugFreeHeap+0x0000002f7722ac29 ntdll!RtlpFreeHeap+0x0000005d771d34a2 ntdll!RtlFreeHeap+0x00000142769514ad kernel32!HeapFree+0x0000001460df4d1a MSHTML!CMarkup::`vector deleting destructor'+0x0000002560c60492 MSHTML!CBase::PrivateRelease+0x0000010360c59909 MSHTML!CMarkup::PrivateRelease+0x0000002c60f6f811 MSHTML!CMarkup::ProcessPeerTask+0x0000006660fd88a1 MSHTML!CMarkup::ProcessPeerTaskContext+0x0000008e60fd8803 MSHTML!CMarkup::ProcessPeerTasks+0x0000003f60fd9016 MSHTML!CElement::VersionedGetDispID+0x0000008f61037a70 MSHTML!CBase::PrivateGetDispID+0x00000041690c5d1c jscript9!HostDispatch::GetDispID+0x0000009169172421 jscript9!HostDispatch::EnsureDispIdForProperty+0x0000003d69172544 jscript9!HostDispatch::PutValue+0x0000001969172521 jscript9!HostDispatch::SetPropertyCore+0x0000004669172686 jscript9!HostDispatch::SetProperty+0x0000003268fe29e1 jscript9!Js::JavascriptOperators::SetProperty_Internal+0x0000005c6901fde7 jscript9!Js::JavascriptOperators::OP_SetProperty+0x000000406901fe43 jscript9!Js::JavascriptOperators::PatchPutValueNoFastPath+0x0000004d6901f931 jscript9!Js::InterpreterStackFrame::Process+0x0000319d68fe7028 jscript9!Js::InterpreterStackFrame::InterpreterThunk+0x000001e8(24c8.218c): Access violation - code c0000005 (first chance)First chance exceptions are reported before any exception handling.This exception may be expected and handled.eax=00000000 ebx=00000000 ecx=21be4bd8 edx=0a4bad54 esi=21be4bd8 edi=00000000eip=60e15956 esp=0a4bad84 ebp=0a4badd4 iopl=0 nv up ei pl zr na pe nccs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00210246MSHTML!CMarkup::IsConnectedToPrimaryMarkup+0x6:60e15956 8b86a4000000 mov eax,dword ptr [esi+0A4h] ds:002b:21be4c7c=????????So the object size is 0×428 and we should create a fake object with this size using heap spray technique to exploit this vulnerability. Solution Actually VML is the not the root cause of the vulnerability so unregistering VGX.DLL will only block the current exploit in the wild. We are working with ZEMANA to release a 3rd party patch for this vulnerability soon. We will update you about the patch soon.Sursa: CVE-2014-1776 (IE 0day) Analysis - SignalSEC Corp. : SignalSEC Corp. Quote