CVE-2017-7047 : Detail

CVE-2017-7047

8.8
/
High
Overflow
22.49%V4
Network
2017-07-20
14h00 +00:00
2017-08-11
13h57 +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. iOS before 10.3.3 is affected. macOS before 10.12.6 is affected. tvOS before 10.2.2 is affected. watchOS before 3.2.3 is affected. The issue involves the "libxpc" 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 8.8 HIGH CVSS:3.0/AV:N/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.

Network

A vulnerability exploitable with network access means the vulnerable component is bound to the network stack and the attacker's path is through OSI layer 3 (the network layer). Such a vulnerability is often termed 'remotely exploitable' and can be thought of as an attack being exploitable one or more network hops away (e.g. across layer 3 boundaries from routers).

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 6.8 AV:N/AC:M/Au:N/C:P/I:P/A:P 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 : 42407

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

Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=1247 When XPC serializes large xpc_data objects it creates mach memory entry ports to represent the memory region then transfers that region to the receiving process by sending a send right to the memory entry port in the underlying mach message. By crafting our own xpc message (or using an interposition library as this poc does) we can pass different flags to mach_make_memory_entry_64 such that the memory entry received by the target process actually represents a region of shared memory such that when the xpc_data deserialization code maps the memory entry port the memory region remains mapped in the sender's address space and the sender can still modify it (with the receiver seeing the updates.) Perhaps this is intended behaviour but there's definitely plenty of code which doesn't expect the contents of xpc_data objects to change. In this PoC I target NSXPC, a high-level RPC mechanism which uses XPC for its low-level transport layer. NSXPC is widely used across privilege boundaries. NSXPCDecoder is implemented in Foundation. Clients send serialized NSInvocation objects representing the methods they wish to call on the remote objects. These NSInvocations are serialized using the NSSecureCoding method which ends up creating a bplist16 serialized byte stream. That bplist16 buffer gets sent in an xpc message as an xpc_data object. NSXPCDecoder wraps the bplist16 deserialization and for selectors such as decodeCStringForKey: ,if the key is present, the value returned will be a pointer directly into the xpc_data object in which it was received. By crafting our own memory entry object this means the pointers returned by decodeCStringForKey: actually point into shared memory which can still be modified by the caller. This can be turned directly into controlled memory corruption by targetting the serialized method type signature (key 'ty') which is parsed by [NSMethodSignature signatureWithObjCTypes]. This method is implemented in CoreFoundation. If the method signature string isn't in a cache of parsed signatures then the string is passed to __NSMS1. This function calls __NSGetSizeAndAlignment to determine the size of a buffer required to parse the signature string which __NSMS1 then allocates using calloc before parsing the signature string into the allocated buffer. If we change the types represented by the signature string (which is in shared memory) between these two calls we can cause the parsing code to write out of bounds as it assumes that the length computed by __NSGetSizeAndAlignment is correct. The most direct path to trigger memory controlled memory corruption is to use a type signature like this: @"ABCD" That will cause 7 bytes of buffer space to be allocated for the parsed signature (which will just contain a copy of the string.) If we increase the length of the string in shared memory eg to: @"ABCDOVERFLOW_OVERFLOW_OVERFLOW" then __NSMS1 will copy the extra bytes up until it encounters a '"' character. This PoC targets the airportd daemon which runs as root but should work for any NSXPC service. This is a race condition so you may have to run the PoC multiple times (./run.sh) and also use libgmalloc to see the corruption directly rather than its effects. ################################################################################ triple_fetch - ianbeer This is an exploit for CVE-2017-7047, a logic error in libxpc which allowed malicious message senders to send xpc_data objects that were backed by shared memory. Consumers of xpc messages did not seem to expect that the backing buffers of xpc_data objects could be modified by the sender whilst being processed by the receiver. This project exploits CVE-2017-7047 to build a proof-of-concept remote lldb debugserver stub capable of attaching to and allowing the remote debugging all userspace processes on iOS 10.0 to 10.3.2. Please see the README in the nsxpc2pc folder in the attached archive for further discussion and details. ################################################################################ The exploit isn't hugely reliable - the race condition needs quite exact timing and sometimes it just doesn't work or it does but the heap groom fails. You should just hard reboot the device and try again. It may take a couple of attempts but it should work. Once the debugserver is running it should be stable. If you take a look at the xcode stdout/debugger window you can see some more status information. Proof of Concept: https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/42407.zip

Products Mentioned

Configuraton 0

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

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

Apple>>Tvos >> Version To (excluding) 10.2.2

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

References

https://support.apple.com/HT207924
Tags : x_refsource_CONFIRM
https://www.exploit-db.com/exploits/42407/
Tags : exploit, x_refsource_EXPLOIT-DB
https://support.apple.com/HT207925
Tags : x_refsource_CONFIRM
https://support.apple.com/HT207923
Tags : x_refsource_CONFIRM
http://www.securityfocus.com/bid/99883
Tags : vdb-entry, x_refsource_BID
http://www.securitytracker.com/id/1038950
Tags : vdb-entry, x_refsource_SECTRACK
https://support.apple.com/HT207922
Tags : x_refsource_CONFIRM