Use-After-Free Vulnerability in Microsoft Internet Explorer 9
A specially crafted web-page can trigger a use-after-free vulnerability in Microsoft Internet Explorer 9. During a method call, the this object can be freed and then continues to be used by the code that implements the method. An attacker would need to get a target user to open a specially crafted web-page. Disabling JavaScript should prevent an attacker from triggering the vulnerable code path. By switching the a document's designMode property to on in a deferred script, MSIE 9 can be made to reload a web page using CMarkup::ReloadInCompatView. This method calls CDoc::CompatViewRefresh, which indirectly calls CScriptCollection::~CScriptCollection, which releases the CMarkup object used as this in CMarkup::ReloadInCompatView. Immediately after returning to CMarkup::ReloadInCompatView, the code will use the (now freed) CMarkup object. I did not immediately find a way to control the free memory, so I decided to look for a way to use the freed memory. I noticed that the freed CMarkup object was immediately followed by a CMarkupPointer object. This object contains a pointer to a CMarkup object, which is still valid. By overwriting the pointer in the CMarkupPointer object, I was able to control the CMarkup object that was used after the free.