This blog is the third in a series from CrowdStrike’s RSA 2019 keynote, “Hacking Exposed: Hacking Macs,” where I joined CrowdStrike’s co-founders, CEO George Kurtz and CTO Dmitri Alperovitch, as we demonstrated real-world attacks against MacOS machines and networks. In this video, I demonstrate the third stage of an attack, “Credential Theft.” In my previous blogs, I focused on the first attack stage, “Delivery,” and the second stage, “Privilege Escalation.”
In the first demo in this series, I showed how the Delivery stage of an attack is accomplished via a CustomURLScheme. We saw in the Privilege Escalation demo how attackers can gain root privileges to perform a number of different tasks — including “Credential Theft,” the subject of this blog.
Mimikatz — which Dmitri calls the “AK47 of cyber” — has become a popular tool for achieving credential theft in Windows environments. In fact, CrowdStrike has observed it in almost every Windows-based attack we’ve seen, regardless of the adversary. This is because Mimikatz is often able to hand the attacker plain-text passwords by pulling them from memory. Macs, however, present more of a challenge to attackers.
On Macs, login passwords are often stolen from the files located inside of the /var/db/dslocal/nodes/Default/users/ directory, where each user on the system has his own plist file. Inside this plist file is an entry titled “ShadowHashData,” which can be used to build a password hash.
Until recently, the “defaults” command was the most commonly used tool to access this hash data. However, Apple’s System Integrity Protection has started preventing processes from opening files within the /var/db/dslocal/nodes/Default/users/ directory. The most convenient way to access this data now is by using the dscl command, which is Apple’s go-to tool for various administrative tasks.
Walking Through an Attack
In the demo video, we show you what a hash collector looks like as a Python script — here is how this stage unfolds:
- First, the attacker uses the dscl command to dump all the data necessary to build a password hash.
- Next, the attacker passes that data to the xxd command, which will greatly reduce the number of steps it would take to manually convert this hex data to a usable binary plist format.
- Finally, the attacker converts the binary plist to xml so that it’s readable. He can now use the pieces of this xml to build a password hash.
Once this process is complete, an attacker can take the stolen password hash and plug it into something like OCLHashcat to perform a number of different password cracking techniques aimed at acquiring a plain-text password.
The video also addresses some countermeasure that can defend your organization against this stage of an attack. The following are recommendations for avoiding credential theft:
- It’s critical to use strong passwords. This may sound like a simple prescriptive, but the more complex your passwords are, the harder they are to crack. If nothing else, having a strong password can buy you more time.
- It’s also imperative that organizations include solutions such as endpoint detection and response (EDR), which can monitor and alert on activities such as hash dumping.
- Ensure that your keychain password is different from your login password. This will keep attackers from decrypting the rest of the passwords in your keychain, should they manage to decrypt your login password.
- Watch the video that demonstrates a Credential Theft stage attack against MacOS.
- Read the blog and watch Part 1 of this series, demonstrating the Delivery stage of a MacOS attack.
- Read the blog and watch Part 2 of this series on the Privilege Escalation stage of a MacOS attack.
- Learn about a new Mac forensics tool in this blog: “AutoMacTC: Automating Mac Forensic Triage.”
- Download the 2020 Global Threat Report
- Learn more about the CrowdStrike Falcon platform by visiting the web page.
- Get a full-featured free trial of CrowdStrike Falcon Prevent™ and learn how true next-gen AV performs against today’s most sophisticated threats.