Jump to content
Fi8sVrs

macOS / iOS Kernel IOSurfaceRootUserClient Double-Free

Recommended Posts

  • Active Members

macOS and iOS suffer from a kernel double free vulnerability due to IOSurfaceRootUserClient not respecting MIG ownership rules.

advisory-info.txt

iOS/MacOS kernel double free due to IOSurfaceRootUserClient not respecting MIG ownership rules 

CVE-2017-13861


I have previously detailed the lifetime management paradigms in MIG in the writeups for:
  CVE-2016-7612 [<a href="https://bugs.chromium.org/p/project-zero/issues/detail?id=926" title="" class="" rel="nofollow">https://bugs.chromium.org/p/project-zero/issues/detail?id=926</a>]
and
  CVE-2016-7633 [<a href="https://bugs.chromium.org/p/project-zero/issues/detail?id=954" title="" class="" rel="nofollow">https://bugs.chromium.org/p/project-zero/issues/detail?id=954</a>]

If a MIG method returns KERN_SUCCESS it means that the method took ownership of *all* the arguments passed to it.
If a MIG method returns an error code, then it took ownership of *none* of the arguments passed to it.

If an IOKit userclient external method takes an async wake mach port argument then the lifetime of the reference
on that mach port passed to the external method will be managed by MIG semantics. If the external method returns
an error then MIG will assume that the reference was not consumed by the external method and as such the MIG
generated coode will drop a reference on the port.
 
IOSurfaceRootUserClient external method 17 (s_set_surface_notify) will drop a reference on the wake_port
(via IOUserClient::releaseAsyncReference64) then return an error code if the client has previously registered
a port with the same callback function.
 
The external method's error return value propagates via the return value of is_io_connect_async_method back to the
MIG generated code which will drop a futher reference on the wake_port when only one was taken.

This bug is reachable from the iOS app sandbox as demonstrated by this PoC.
 
Tested on iOS 11.0.3 (11A432) on iPhone 6s (MKQL2CN/A)
Tested on MacOS 10.13 (17A365) on MacBookAir5,2

This bug is subject to a 90 day disclosure deadline. After 90 days elapse
or a patch has been made broadly available, the bug report will become
visible to the public.




Found by: ianbeer

 

Download GS20171212052309.tgz (2.1 KB)

 

https://packetstormsecurity.com/files/145365/macOS-iOS-Kernel-IOSurfaceRootUserClient-Double-Free.html

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...