Subvert Trust Controls: Gatekeeper Bypass

Adversaries may modify file attributes that signify programs are from untrusted sources to subvert Gatekeeper controls. In macOS and OS X, when applications or programs are downloaded from the internet, there is a special attribute set on the file called This attribute is read by Apple's Gatekeeper defense program at execution time and provides a prompt to the user to allow or deny execution.

Apps loaded onto the system from USB flash drive, optical disk, external hard drive, or even from a drive shared over the local network won’t set this flag. Additionally, it is possible to avoid setting this flag using Drive-by Compromise. This completely bypasses the built-in Gatekeeper check. [1] The presence of the quarantine flag can be checked by the xattr command xattr /path/to/ for Similarly, given sudo access or elevated permission, this attribute can be removed with xattr as well, sudo xattr -r -d /path/to/ [2] [3]

In typical operation, a file will be downloaded from the internet and given a quarantine flag before being saved to disk. When the user tries to open the file or application, macOS’s gatekeeper will step in and check for the presence of this flag. If it exists, then macOS will then prompt the user to confirmation that they want to run the program and will even provide the URL where the application came from. However, this is all based on the file being downloaded from a quarantine-savvy application. [4]

ID: T1553.001
Sub-technique of:  T1553
Tactic: Defense Evasion
Platforms: macOS
Permissions Required: Administrator, User
Data Sources: Command: Command Execution, File: File Metadata, File: File Modification, Process: Process Creation
Defense Bypassed: Anti-virus, Application control
Version: 1.0
Created: 05 February 2020
Last Modified: 20 June 2020

Procedure Examples

ID Name Description
S0369 CoinTicker

CoinTicker downloads the EggShell mach-o binary using curl, which does not set the quarantine flag.[5]


OSX_OCEANLOTUS.D can delete the file quarantine attribute.[6]


ID Mitigation Description
M1038 Execution Prevention

System settings can prevent applications from running that haven't been downloaded through the Apple Store which can help mitigate some of these issues.


Monitoring for the removal of the flag by a user instead of the operating system is a suspicious action and should be examined further. Monitor and investigate attempts to modify extended file attributes with utilities such as xattr. Built-in system utilities may generate high false positive alerts, so compare against baseline knowledge for how systems are typically used and correlate modification events with other indications of malicious activity where possible.