Skip to content

Apple: Cross-process SpectreRSB/ret2spec vulnerability in macOS

Moderate
u269c published GHSA-g79q-75p5-733r Aug 14, 2020

Package

macOS

Affected versions

10.15.6

Patched versions

None

Description

Summary

An information disclosure vulnerability exists in current versions of macOS (at least through version 10.15.6, released July 15, 2020) allowing an unprivileged application to read memory of other applications by influencing speculative execution through the return stack buffer (RSB).

Severity

Moderate. Allows local information disclosure across privilege boundaries.

Proof of Concept

The ret2spec_ca program from Google's Safeside project demonstrates an information leak across processes on macOS 10.15.6 running on x86.

Since macOS doesn't provide APIs to set core affinity, a slight modification is necessary: instead of pinning parent and child to a single core, we force coscheduling by fork()ing enough times that at least two processes are coscheduled on the same core by the pigeonhole principle.

An updated version that supports macOS will be available shortly.

Analysis

The return stack buffer (RSB) allows the processor to predict the target of "return" instructions by storing the return address of the corresponding "call". The RSB relies on calls and returns occurring in matched pairs -- an assumption which generally holds while a program is running uninterrupted but which can be violated when a context switch replaces the running task with a new one.

A hostile program can put entries into the RSB that will be used to predict return addresses in a different process. With this capability, an attacker can leak information from the target process by directing speculative execution to a disclosure gadget.

Attacks using the RSB have been known since the initial Spectre and Meltdown disclosures, and were subsequently described in literature in July 2018 as either SpectreRSB or ret2spec. (ref, ref)

The generally-accepted mitigation is to fill or "stuff" the RSB with benign entries on context switch between processes: see e.g. https://www.kernel.org/doc/Documentation/admin-guide/hw-vuln/spectre.rst. It does not appear macOS implements this mitigation.

This advisory is specific to x86. We have not tested macOS or iOS on ARM processors.

Timeline

2020-05-15: Report to product-security@apple.com confirming 90-day disclosure deadline of August 13. Apple confirms receipt.
2020-05-29: Apple asks for further information. Google responds.
2020-06-05: Apple confirms receipt of new information.
2020-07-24: Google asks Apple if a CVE has been assigned or if an advisory is planned.
2020-08-07: Google notifies Apple the behavior still reproduces on macOS 10.15.6.
2020-08-10: Google shares draft of disclosure with Apple, reaffirms plan to publish on August 13.
2020-08-13: Details published.

Attribution

This vulnerability was discovered by Anthony Steinhauser of Google's Safeside project.

Severity

Moderate

CVE ID

No known CVE

Weaknesses

No CWEs

Credits