Mac OS Forensics: Attacking FileVault 2

July 27th, 2016 by Oleg Afonin

In the world of Windows dominance, Apple’s Mac OS X enjoys a healthy market share of 9.5% among desktop operating systems. The adoption of Apple’s desktop OS (macOS seems to be the new name) is steadily growing. This is why we are targeting Mac OS with our tools.

This time, let’s talk about Mac OS X user account passwords. Not only will a user password allow accessing their Mac, but it will also allow decrypting FileVault 2 volumes that are otherwise securely encrypted with virtually unbreakable XTS-AES.

Attacking FileVault 2

FileVault 2 is Apple’s take on whole-disk encryption. Protecting the entire startup partition, FileVault 2 volumes can be unlocked with either of the following:

  • 256-bit XTS-AES key
  • Recovery Key
  • User password from any account with “unlock” privileges

There is also an additional unlock method available called Institutional Recovery Key. These recovery keys are created when system administrators enable FileVault 2 encryption with FileVaultMaster.keychain. This method requires additional steps to activate, and is typically used in organizations with centralized keychain management.

256-bit XTS-AES Key

Location: RAM (only while the encrypted volume is mounted)

The 256-bit XTS-AES key is the actual encryption key that is used by the system to encrypt and decrypt data. This is a binary key. Once the FileVault 2 volume is unlocked, the XTS-AES key is stored in the computer’s RAM.

In order to recover these keys, one would need to dump the content of the computer’s RAM into a file. Note that it is no longer possible to run a FireWire attack on locked or sleeping Macs due to Mac OS X security restrictions, so the RAM capturing tool must be executed on a running computer with FileVault 2 container unlocked and a user logged in.

Recovery Key

Location: printed notes, Apple cloud

Extraction: search, cloud acquisition (coming to Elcomsoft Phone Breaker 6.0), request from Apple

Similar to BitLocker, FileVault 2 employs Recovery Keys to enable users unlock their encrypted volumes if the disk is moved to a different device or if no user account with ‘unlock’ privileges is present in the system. Once FileVault 2 is enabled, the system creates and displays a recovery key. According to http://eprint.iacr.org/2012/374.pdf, the recovery key contains 120 bits (we didn’t check) that are encoded with all letters and numbers 1 through 9, and formatted to look like this:

XDFG-EE8G-KF89-S0FS-9F7Y-XFH8

 

osx-elcapitan-security-privacy-filevault

The user has an option to store the key with Apple. If the user agrees, the recovery key gets stored in the iCloud account associated with the user’s Apple ID (which is required to use the service).

osx-elcapitan-security-privacy-filevault-recovery-key-sheet

While brute-forcing a 120-bit key seems easier than attempting to brute-force a 256-bit key, the security of a 120-bit key is still enough to make the attack unfeasible. This key is only useful if you can obtain it by searching the premises, downloading from the user’s iCloud account or requesting from Apple (if you have a warrant).

Extracting FileVault 2 Keys from iCloud

It is possible to extract a backup FileVault 2 key from the user’s iCloud account. The backup key can be extracted, processed and converted into a binary 256-bit XTS-AES key that can be used to decrypt the volume.

We are currently finalizing development of a tool for extracting and using FileVault 2 recovery keys to mount FileVault 2 volumes. In order to extract the key, you’ll be able to use Elcomsoft Phone Breaker 6.0 (scheduled for release next month). Once the tool is released, you’ll need to do perform the following steps:

  1. Launch Elcomsoft Phone Breaker and choose iCloud. Select “Decrypt FileVault image”.
  2. Specify path to the forensic image of the encrypted volume. Elcomsoft Phone Breaker accepts raw disk images (.dd), EnCase image files (.e01), and Apple Disk Images (.dmg).
  3. In a case the image contains several encrypted partitions, choose the one which you would like to mount (you may see more than one FileVault 2 volumes if several OS X installations are present).
  4. Elcomsoft Phone Breaker displays Apple ID that has the Recovery Key stored in its iCloud account.
  5. Provide authentication credentials (Apple ID password or authentication token extracted from the user’s computer).
  6. Elcomsoft Phone Breaker obtains the recovery key and decrypts the encrypted partition.

As a result, you will get an image of the decrypted partition in a raw (.dd) format.

Then you can use the “hdiutil” tool (OS X) or FTK Imager (Windows) to mount the partition and explore the data.

FileVault 2 Passwords

Location: hashed, /var/db/shadow/hash/<GUID>

Extraction (hash): cat /var/db/shadow/hash/<GUID> | cut -c169-216

Recovery (original password): Elcomsoft Distributed Password Recovery

When setting up a FileVault 2 volume, you may be prompted to enable other user accounts to unlock the encrypted volume:

 

osx-elcapitan-security-privacy-filevault-users-sheet

If this is the case, each user must type their password before they will be able to unlock the disk. In order for other users to be able to unlock FileVault 2, one has to click Enable User and enter the user’s password while setting up encryption (or any time after). If new user accounts are added after FileVault 2 encryption is turned on, they are automatically assigned the correct access rights.

Understanding this scheme is very important from the forensic perspective. If there is more than one user on the computer, you’ll have a much greater chance of recovering at least one of these passwords. This is especially true if the computer was used in a household with kids who tend to use much simpler passwords.

In order to unlock an encrypted volume, you will need to use the original plain-text password. Passwords cannot be extracted from a Mac OS X computer; you can only extract password hashes. In order to recover the original plain-text password, you will have to run an attack using a specialized tool such as Elcomsoft Distributed Password Recovery.

With recent update, Elcomsoft Distributed Password Recovery gained the ability to attack plain-text passwords (in addition to user account passwords) protecting disk volumes encrypted with FileVault 2.

Elcomsoft Distributed Password Recovery uses GPU acceleration techniques making the recovery 20 to 50 times faster compared to a CPU alone. You can choose between dictionary attacks with various mutations and GPU-accelerated brute force. Since attacking a password can be lengthy business, Elcomsoft Distributed Password Recovery can utilize multiple computers to simultaneously attack passwords.

Elcomsoft Distributed Password Recovery can recover passwords for popular disk encryption containers. In order to attack a FileVault 2 password with Elcomsoft Distributed Password Recovery, perform the following steps.

Preparing the Attack

  1. Make an image of the hard drive (physical device) or an image of the encrypted partition and save it into a file. The following formats can be used: Raw disk image (.dd), EnCase image file (.e01), Apple Disk Image (.dmg).
  2. Run EDPR Disk Encryption Info (EDEI) utility located in Start Menu -> Elcomsoft Password Recovery -> Tools.
  3. Specify path to the disk image you created on Step 1.edpr1edpr2
  4. If more than one encrypted partition is available, specify the volume to attack.
  5. EDEI will extract the necessary information about the encrypted volume.
  6. Save the .esprf file created by EDEI.

Running the Attack

  1. Launch Elcomsoft Distributed Password Recovery.
  2. Open the .esprf file that was saved by EDEI.
  3. If several Mac OS accounts appear, choose account to attack.
  4. Configure the attack (dictionary, mutations, brute force).
  5. Run the attack.
  6. Once the password is discovered, you can use it to unlock the Mac that contains the encrypted volume.

Mounting the Volume

After recovering the password to any user account with “Unlock” privileges, you can do the following to mount the encrypted container.

Option 1: [OS X ] In Mac OS X, use “diskutils” to mount the disk volume. Enter the recovered password when prompted. (Applications -> Disk Utility -> File -> Open Disk image -> select image and click Open).

disk

Option 2: [OS X ] You can also use Terminal to mount the encrypted image. Launch Terminal and use the following command line to mount the disk image:

hdiutil mount <image>.dd

You can also mount a .dmg image with the following command line:

hdiutil mount /<image>.dmg

More information on FileVault 2: https://support.apple.com/en-us/HT204837

Tags: , , , , ,

Sign up for free ElcomSoft Password Recovery Software newsletter

Leave a Reply

11 Comments on "Mac OS Forensics: Attacking FileVault 2"

Notify of
avatar
Chuck Swanson
Guest
Chuck Swanson

If someone is logged in to one’s account, as you wrote, then you can access the owner’s hard disk. Well, that’s obvious.

Your second method is to get a warrant IF one is stupid enough to store the recovery key in one’s iCloud account with Apple. Yawn. Who does that?

Your third method is to brute force a user’s password. Mine is 17 digits, upper and lower case, numbers and symbols, randomly selected. You’ve got a few centuries or a quantum computer?

Why don’t you guys just use a 5 dollar wrench?

Good luck with your software. Ha!

Dean
Guest

We need to be careful and not assume our password will always be the last one guessed. I always hark back that someone wins those 100 million dollar lotteries without buying 270 million tickets, so passwords can be guessed or brute forced.

That is why length, mixed case/symbols/numbers and randomness are important to reduce likelihood , not of if, but when our password can be guessed. Good job on your password Chuck!

Tim
Guest

What is the number of passwords/s you can check with the Bruteforce Method on Filevault 2 if I will use an GPU accelerator and without?
You dont Say something about that. It might be interessting.

Best Regards

Vladimir Katalov
Admin

On CPU, the speed is only from 20 to 50 passwords per second; on NVIDIA GTX 1080, the speed is about 10,000 p/s (which is actually also not much).

Guest
Guest

Vladimir.
Is it possible to use 4 or 5 GPUs to speed up the Bruteforce Attack to 40000 or 50000 p/s?
Or is 10000 the maximum per second on filevault 2?

Thanks a lot for answering.

Vladimir Katalov
Admin

10,000 passwords per second is the speed on a single GeForce GTX 1080. So if you get 4 such cards (in a single computer or in your network), the speed will be 40,000 p/s (well, almost).

JOSEF
Guest

Hi
Ist possible to Speed up with a Tesla K80? Or does EDPR mit Support Tesla Cards?
Best Regards

Vladimir Katalov
Admin

Yes, EDPR support all Tesla cards (including the latest P100), of course.

Kevin
Guest

Hi
My ex wife, so i found out recently, was committing fraud via her Mac book Air a year ago. I remember her talking about encrypting her laptop but I never took any notice. It now appears that there may be evidence of this on her Mac and I’d like to be able to prove it to the relevant authorities. The fraud is pretty serious and I cannot get access to what i believe is incriminating evidence. Is there anything that I can do?

Vladimir Katalov
Admin

Kevin,

Sorry, do you mean that the laptop in question is protected with FileVault and you need to recover the password? Please contact me at v.katalov@elcomsoft.com with more details.

Interested Buyer
Guest
Interested Buyer
I am planning on purchasing this software if it is able to extract the hashes I need to work with. They are all protected by FileVault. However, while testing trial version, I cannot extract the .esprf file from any images created with recent OSX systems. I have tried using different image formats with no success. I had an old image from a previous case which was protected by file vault and i was able to extract the .esprf file. This image was created well over a year ago. I’m concerned I won’t be able to access the hashes I need… Read more »
wpDiscuz