RCE Without Native Code: Exploitation of a Write-What-Where in Internet Explorer
A type confusion in Internet Explorer's fast property dispatch allowed a property put to invoke the getter instead, yielding a write-what-where primitive. The author then built a full exploit that achieved code execution without shellcode by using the write to create an arbitrary read and then subverting the dispatch mechanism to call WinExec.
thezdi.com
Published on thezdi.com
On the last day of 2018, I discovered a type confusion vulnerability in Internet Explorer that yields a clean write-what-where primitive. It patched this April as CVE-2019-0752.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The fast-invoke path checked only for the DISPATCH_PROPERTYPUT flag and failed to account for DISPATCH_PROPERTYPUTREF, so a putref operation was routed to the property's getter, causing a type confusion.
Impact
An attacker could achieve code execution without shellcode; on Windows 10, CFG did not block the WinExec call, though Enhanced Protected Mode would constrain the resulting code execution.
What the attacker needed
Internet Explorer with emulation level IE=8 or lower; VBScript enabled (or a bypass on Windows 10); victim visits a malicious page
The fix
The vulnerability was fixed by Microsoft in April 2019 as CVE-2019-0752.
How it was found
- Assign an instance of a custom class to the scrollLeft property using VBScript, producing a DISPATCH_PROPERTYPUTREF call.
- The dispatch mechanism coerces the object to an integer and invokes the getter instead of the setter.
- The getter interprets the integer as a pointer and writes the current scrollLeft value to that address.
- Allocate a large array so a chosen constant address falls within it, then use the write to corrupt one element into a VT_BYREF|VT_I4 variant.
- Use that corrupted element as a read primitive to leak object addresses.
- Forge a vtable and a COM object that doubles as an ANSI command string, then dispatch a method to call WinExec.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Internet Explorer had a shortcut for quickly reading and writing certain webpage properties. A mistake meant that when a script tried to store an object into a property, the browser sometimes ran the code that reads the property instead. That mix-up let an attacker write a chosen value to a chosen memory address, and the author showed how to turn that into running their own program.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.