← All Binaries

xattr

The xattr command can be used to display, modify or remove the extended attributes of one or more files, including directories and symbolic links. Extended attributes are arbitrary metadata stored with a file, but separate from the filesystem attributes (such as modification time or file size). The metadata is often a null-terminated UTF-8 string, but can also be arbitrary binary data. xattr can be used to bypass Gatekeeper.

Author: Jason Trost (@jason_trost) Created: 2023-04-20

Paths

/usr/bin/xattr

Example Use Cases

Bypass Gatekeeper via xattr #

Use xattr to remove quarantine extended attribute from a file.

xattr -d com.apple.quarantine FILE

Bypass Gatekeeper via xattr #

Use xattr to remove quarantine extended attribute from multiple files or directories.

xattr -d -r com.apple.quarantine *

Clear extended attributes from a file via xattr #

Use xattr -c to clear a file's extended attributes. This removes com.apple.quarantine when present without naming it, so the command line does not contain the string com.apple.quarantine. AMOS ran this form on a dropped payload before executing it.

xattr -c FILE

Recursively clear extended attributes via xattr #

Use xattr -cr to clear extended attributes, including com.apple.quarantine, across an app bundle or directory tree. Seen in MacSync and CrashStealer infections.

xattr -cr DIRECTORY

Detections

Resources

Acknowledgements

  • Liran Ravich (Cribl) - clear-all (-c / -cr) use cases