New issue
Advanced search Search tips
Starred by 1 user
Status: Fixed
Owner:
Closed: Mar 2017
Cc:



Sign in to add a comment
MacOS kernel uaf due to double-release in posix_spawn
Project Member Reported by ianbeer@google.com, Jan 27 2017 Back to list
exec_handle_port_actions is responsible for handling the xnu port actions extension to posix_spawn.

It supports 4 different types of port (PSPA_SPECIAL, PSPA_EXCEPTION, PSPA_AU_SESSION and PSPA_IMP_WATCHPORTS)

For the special, exception and audit ports it tries to update the new task to reflect the port action
by calling either task_set_special_port, task_set_exception_ports or audit_session_spawnjoin and if
any of those calls fail it calls ipc_port_release_send(port).

task_set_special_port and task_set_exception_ports don't drop a reference on the port if they fail
but audit_session_spawnjoin (which calls to audit_session_join_internal) *does* drop a reference on
the port on failure. It's easy to make audit_session_spawnjoin fail by specifying a port which isn't
an audit session port.

This means we can cause two references to be dropped on the port when only one is held leading to a
use after free in the kernel.

Tested on MacOS 10.12.3 (16D32) on MacBookAir5,2
 
spawn.c
1.7 KB View Download
Project Member Comment 1 by ianbeer@google.com, Jan 27 2017
Labels: Reported-2017-Jan-27 Id-658068628
Project Member Comment 2 by ianbeer@google.com, Mar 31 2017
Labels: Fixed-2017-Mar-27 CVE-2017-2472
Status: Fixed
Summary: MacOS kernel uaf due to double-release in posix_spawn (was: MacOS/iOS kernel uaf due to double-release in posix_spawn)
CONFIG_AUDIT isn't defined for iOS so I believe this only affected MacOS - I've changed the report title to reflect that.

Fixed in MacOS 10.12.4: https://support.apple.com/en-us/HT207615
Project Member Comment 3 by ianbeer@google.com, Mar 31 2017
Labels: -Product-iOS
Project Member Comment 4 by ianbeer@google.com, Apr 3 2017
Labels: -Restrict-View-Commit
Sign in to add a comment