Skip to content
OnlineHashCrack

How to Extract macOS Password Hashes (OS X 10.0 to 10.11)

Commands to dump the password hash of an OS X or macOS account, from 10.0 Cheetah to 10.11 El Capitan, then recover the password on GPU.

Extracting a password hash from macOS

The short answer

  • The hash format depends on the OS X version: DES crypt up to 10.2, salted SHA1 for 10.4 to 10.6, salted SHA512 for 10.7, PBKDF2-SHA512 from 10.8.
  • From 10.8 the hash sits in a per-user plist under /var/db/dslocal/nodes/Default/users/, readable by root only. It starts with $ml$ and is 203 characters long.
  • Hashcat modes: 122 (10.4 to 10.6), 1722 (10.7) and 7100 (10.8 and later).
  • Modern macOS hashes use PBKDF2 on purpose, so cracking is slow: a good wordlist matters more than raw speed.

Basics

/!\ This is for educational purposes only, and should not be used for unauthorized access, tampering or accessed illegally without owner permission.

This page will help you to retrieve/extract the hash associated to an OSX account. We tried to enumerate all the OS X flavors available, but this article is still "in beta" depending on the new OS X versions.
Once the hash is extracted, you can send it here and we will try to recover it.

OS X 10.0 (Cheetah)

The same as in 10.2 (Jaguar). See below.

OS X 10.1 (Puma)

The same as in 10.2 (Jaguar). See below.

OS X 10.2 (Jaguar)

Dump the hash :

nidump passwd . | grep username | cut -d':' -f2


This hash is created using the Unix DES Crypt(3) function, where the password is first truncated to 8 characters.

OS X 10.3 (Panther)

First find out a users' GUID:

niutil -readprop . /users/username generateduid


Next take that GUID and dump the hash file

cat /var/db/shadow/hash/GUID


The first 64 characters are the NTLM hash (first 32 NT, next 32 LM) and the last 40 characters are the SHA1 hash.

OS X 10.4 (Tiger)

You can obtain the GUID just as in 10.3 (Panther). See above.
After obtaining the GUID, you can dump the passwords just as in 10.5 (Leopard). See below.

OS X 10.5 (Leopard) + OS X 10.6 (Snow Leopard)

First find a users' GUID:

dscl localhost -read /Search/Users/username | grep GeneratedUID | cut -c15-


After getting the GUID you can dump various hashes. By default the only hash stored is the salted SHA1. If the user has turned on SMB file sharing then the NTLM hash will also be stored.
If you upgraded from 10.3->10.4->10.5 then the zero salted SHA1 is also stored.

Salted SHA1 (first 8 characters are the salt)

cat /var/db/shadow/hash/GUID | cut -c105-152


Zero-Salted SHA1 (first 8 characters are the salt and will always be all zeros)

cat /var/db/shadow/hash/GUID | cut -c169-216


NTLM (first 32 characters are NT, next 32 are LM)

cat /var/db/shadow/hash/GUID | cut -c-64

OS X 10.7 (Lion)

Use this tutorial

OS X 10.8 (Mountain) & 10.9 (Mavericks) & 10.10 (Yosemite)

The shadow files are stored on the filesystem at /var/db/dslocal/nodes/Default/users/%user%.plist.
They are in plist format so you'll need to use the plutil command to view them or use the defaults command to extract/write specific keys if desired.
Only the root user has access to the files.
To view the contents of a shadow file for a user:

sudo plutil -p /var/db/dslocal/nodes/Default/users/%username%.plist

To get the hash:

sudo defaults read /var/db/dslocal/nodes/Default/users/%username%.plist ShadowHashData|tr -dc 0-9a-f|xxd -r -p|plutil -convert xml1 - -o -

Where %username% in the above example is the user you're looking for the hash for.

Finally the wanted hash starts with "$ml$" and length is 203 characters.

Few links to help you :
- http://www.michaelfairley.co/blog/2014/05/18/how-to-extract-os-x-mavericks-password-hash-for-cracking-with-hashcat/
- script to automate the process (.app).

OS X 10.11 (El Capitan)

The hashes of the users are stored in:

/var/db/dslocal/nodes/Default/users/%user%.plist

To get the hash:

sudo defaults read /var/db/dslocal/nodes/Default/users/%user%.plist ShadowHashData | tr -dc '0-9a-f ' | xxd -p -r | plutil -convert xml1 - -o -

or directly through directory services:

sudo dscl . read /Users/%user% AuthenticationAuthority
sudo dscl . read /Users/%user% dsAttrTypeNative:ShadowHashData

Tool to automate these steps

Davegrohl tool created in early 2011 is a password hash extractor & companion tool to John the Ripper.
Sadly the development of this tool has been stopped (but could be forked..), the current status is :

Dave compiles fine on Yosemite and will happily (but very slowly) crack user passwords. Out of the box, OS X uses PBKDF2 to encrypt its user passwords which is very slow to crack for one machine. Turning on Windows (SMB) file sharing will disable this feature.

Github project page readme

Credits

Thanks to http://www.skullsecurity.org/wiki/index.php/Mac_OS_X_Commands and HackMac guys.

Got the hash? Recover the passwordSubmit the extracted hash for GPU-accelerated recovery, or convert a plist file with our free extractor first.

macOS password hashes: frequently asked questions

Where does macOS store user password hashes?

From OS X 10.8 onward each account has a plist file in /var/db/dslocal/nodes/Default/users/, readable by root only. Older versions keep the hash in a file named after the account GUID.

What does a modern macOS password hash look like?

It starts with $ml$ and is 203 characters long. It is a PBKDF2-SHA512 hash, which is deliberately slow to test.

Which hashcat mode matches my macOS version?

Mode 122 for OS X 10.4 to 10.6 (salted SHA1), mode 1722 for 10.7 (salted SHA512) and mode 7100 for 10.8 and later (PBKDF2-SHA512).

Can OnlineHashCrack recover a macOS account password?

Yes. Submit the extracted hash and OHC detects the format and runs wordlist, rule and mask attacks on its GPUs. Use it only for accounts you own or are authorized to test.

Is there a guide for newer macOS versions?

Yes, see the dedicated guide on extracting PBKDF2-SHA512 hashes from macOS systems, linked in the further reading section below.

Further reading

Related guides on Online Hash Crack: