How to extract hashes and crack Mac OS X Passwords

This page will help you to know how to extract hashes from OS X systems and crack them.

Extract'em all

admin

Apple

Basics

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)

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)

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:

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.