Cylance Detects IE Scripting Engine Memory Corruption Vulnerability (CVE-2018-8653)

Cylance's global Research and Intelligence team have been conducting analysis regarding CVE-2018-8653, a vulnerability affecting Microsoft Internet Explorer. The attack is intended to occur within Internet Explorer:

“A remote code execution vulnerability exists in the way that the scripting engine handles objects in memory in Internet Explorer. The vulnerability could corrupt memory in such a way that an attacker could execute arbitrary code in the context of the current user. An attacker who successfully exploited the vulnerability could gain the same user rights as the current user. If the current user is logged on with administrative user rights, an attacker who successfully exploited the vulnerability could take control of an affected system. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights. In a web-based attack scenario, an attacker could host a specially crafted website that is designed to exploit the vulnerability through Internet Explorer and then convince a user to view the website, for example, by sending an email.”

Technical Analysis

CVE-2018-8653 utilizes a use-after-free (UAF) to gain arbitrary code execution within the context of jscript.dll by masquerading as a fake RegExpObj. The exploit uses the code execution to leak the base address of:

  • jscript.dll
  • kernel32!GetModuleHandleA and kernel32!GetProcAddress
  • the shellcode
  • the current stack pointer

With this information in hand, an attacker can avoid using traditional exploitation techniques such as heap spraying, nop sleds, ret sleds, and complicated ROP chains. Instead, the attacker uses the code execution capability to write a simple ROP chain to the current stack pointer in order to change the memory protections on the heap address containing the payload. 

The end result, from a CPU and memory perspective, is the attack looks likes like a traditional Just-In-Time (JIT) compilation where software (browser Javascript engines, Java, etc.) optimizes code on the fly by allocating heap memory, writing byte-code to it, marking the memory as executable, and then executing it.

It bypasses traditional exploit techniques and instead writes a new call stack to the real stack, which then changes memory permissions of heap memory where shellcode is waiting and executes it.

Prevent CVE-2018-8653 Exploitation with Cylance

CylanceOPTICS™ uses machine learning (ML) and artificial intelligence (AI) to identify and prevent widespread security incidents, providing consistent visibility, targeted threat hunting, and fast incident response.

The CylanceOPTICS rule “Internet Explorer to Scripting Engine Pivot” detects this attack, and it can be found in the official ruleset. Contact your Cylance representative for more details.