Dumping Account Hashes via Built-In Commands on macOS
This rule detects the execution of macOS built-in commands such as `defaults`, `mkpassdb`, and `dscl` used by adversaries to dump user account hashes for credential access and lateral movement.
This detection rule identifies the execution of macOS built-in commands that can be used to dump user account hashes. Adversaries may attempt to dump credentials to obtain account login information in the form of a hash. These hashes can then be cracked or leveraged for lateral movement within the network. The rule specifically targets the defaults, mkpassdb, dscl, plutil, cat, strings, xxd, and head commands when used with arguments indicative of hash dumping, such as ShadowHashData or file paths to user .plist files in /var/db/dslocal/nodes/Default/users/. This activity is often performed post-exploitation to gain further access to systems and sensitive data. The rule requires data from Elastic Defend.
Attack Chain
- An attacker gains initial access to a macOS system through an exploit, phishing, or other means.
- The attacker executes the
defaultscommand with arguments such asShadowHashDatato attempt to retrieve shadow hash data. - Alternatively, the attacker uses the
mkpassdbcommand with the-dumpargument to dump the password database. - The attacker might use the
dsclcommand with arguments containingShadowHashDatato query user information, including hashes. - The attacker attempts to read user .plist files from
/var/db/dslocal/nodes/Default/users/usingplutil,cat,strings,xxd, orhead. - The attacker extracts the password hashes from the output of the commands.
- The attacker cracks the password hashes using tools like hashcat or John the Ripper.
- The attacker uses the cracked credentials to move laterally to other systems or access sensitive data.
Impact
Successful execution of these commands allows an attacker to obtain user account hashes, which can then be cracked to reveal passwords. This can lead to unauthorized access to sensitive data, lateral movement within the network, and potentially complete compromise of the affected systems and the network as a whole. A successful attack can impact all macOS systems within an organization.
Recommendation
- Enable Elastic Defend integration for macOS endpoints to collect the necessary process execution data (as described in the rule setup).
- Deploy the “Dumping Account Hashes via Built-In Commands” rule to your Elastic SIEM environment and tune false positives using the guidance in the rule’s note section.
- Monitor process creation events for the execution of
defaults,mkpassdb,dscl,plutil,cat,strings,xxd, andheadwith arguments indicative of hash dumping (see the rule’s query definition). - Investigate any alerts generated by the “Dumping Account Hashes via Built-In Commands” rule, following the triage steps in the rule’s note section.
Detection coverage 3
Detect macOS Account Hash Dumping via defaults Command
highDetects macOS account hash dumping attempts using the `defaults` command with ShadowHashData.
Detect macOS Account Hash Dumping via mkpassdb -dump
highDetects macOS account hash dumping attempts using the `mkpassdb` command with the `-dump` argument.
Detect macOS Account Hash Dumping via plist file access
mediumDetects macOS account hash dumping attempts by reading user .plist files.
Detection queries are available on the platform. Get full rules →