Rapid7 Vulnerability & Exploit Database

Safari Webkit Proxy Object Type Confusion

Back to Search

Safari Webkit Proxy Object Type Confusion

Disclosed
03/15/2018
Created
06/02/2019

Description

This module exploits a type confusion bug in the Javascript Proxy object in WebKit. The DFG JIT does not take into account that, through the use of a Proxy, it is possible to run arbitrary JS code during the execution of a CreateThis operation. This makes it possible to change the structure of e.g. an argument without causing a bailout, leading to a type confusion (CVE-2018-4233). The type confusion leads to the ability to allocate fake Javascript objects, as well as the ability to find the address in memory of a Javascript object. This allows us to construct a fake JSCell object that can be used to read and write arbitrary memory from Javascript. The module then uses a ROP chain to write the first stage shellcode into executable memory within the Safari process and kick off its execution. The first stage maps the second stage macho (containing CVE-2017-13861) into executable memory, and jumps to its entrypoint. The CVE-2017-13861 async_wake exploit leads to a kernel task port (TFP0) that can read and write arbitrary kernel memory. The processes credential and sandbox structure in the kernel is overwritten and the meterpreter payloads code signature hash is added to the kernels trust cache, allowing Safari to load and execute the (self-signed) meterpreter payload.

Author(s)

  • saelo
  • niklasb
  • Ian Beer
  • siguza

Platform

Apple_iOS

Architectures

aarch64

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/apple_ios/browser/webkit_createthis
msf exploit(webkit_createthis) > show targets
    ...targets...
msf exploit(webkit_createthis) > set TARGET < target-id >
msf exploit(webkit_createthis) > show options
    ...show and set options...
msf exploit(webkit_createthis) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;