Microsoft this week shared details on CVE-2022-42821, a Gatekeeper bypass vulnerability that Apple recently addressed in macOS Ventura, Monterey, and Big Sur.
Identified in July 2022, the security defect is described as a logic issue that could be exploited to bypass Gatekeeper checks, potentially allowing threat actors to execute malicious code on vulnerable systems.
“Gatekeeper bypasses such as this could be leveraged as a vector for initial access by malware and other threats and could help increase the success rate of malicious campaigns and attacks on macOS,” Microsoft says.
On macOS, files downloaded from the internet are assigned the com.apple.quarantine extended attribute that is used to enforce security policies, including Gatekeeper’s application execution restrictions or mitigations that prevent a sandbox escape.
Users are required to provide consent to launch a downloaded application that is validly signed and notarized, or are informed that the application cannot be executed, if the app is untrusted.
The com.apple.quarantine attribute contains information about the source of the file and details on how Gatekeeper should handle it, including flags to enforce restrictions if necessary.
To allow for metadata to be transferred between operating systems, Apple has introduced a mechanism called AppleDouble, which saves the metadata to a new file next to the original. When files are restored from an archive, macOS processes AppleDouble files and assigns the metadata accordingly.
While analyzing the various mechanisms that Apple has implemented to extend the traditional permission model, Microsoft discovered that it was possible to abuse Access Control Lists (ACLs) to bypass Gatekeeper.
ACLs allow fine-grained permissions to files and directories, and Microsoft discovered that adding very restrictive ACLs to files can “prohibit Safari (or any other program) from setting new extended attributes, including the com.apple.quarantine attribute”.
Microsoft has created proof-of-concept (PoC) code – dubbed Achilles – that bypasses Gatekeeper by creating a fake directory structure with an arbitrary icon and payload, and creating an AppleDouble file with restrictive ACL.
The code and the AppleDouble file can be placed in an archive that can be hosted on the internet, the tech giant explains.
“We note that Apple’s Lockdown Mode, introduced in macOS Ventura as an optional protection feature for high-risk users that might be personally targeted by a sophisticated cyberattack, is aimed to stop zero-click remote code execution exploits, and therefore does not defend against Achilles,” Microsoft says.