tinyapps.org / docs / Cracking FileVault 2 (HFS+ or APFS)


0. Determine filesystem

via diskutil list:

1. HFS+

1.1 System volume

1.1.1 Download and compile fvde2john and hashcat on iMac

git clone https://github.com/kholia/fvde2john.git && cd fvde2john/
./configure && make
git clone https://github.com/hashcat/hashcat.git && cd hashcat/
make

1.1.2 Start MacBook Air in Target Disk Mode and connect to iMac via Thunderbolt, FireWire, or USB

$ diskutil list
...
/dev/disk2 (external):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:          Apple_CoreStorage Macintosh HD            250.1 GB   disk2s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk2s3

Offline
                                 Logical Volume Macintosh HD on disk2s2
                                 C59F0385-4F65-7EBA-36DB-3977388EB4AA
                                 Locked Encrypted

$ diskutil mount /dev/disk2s3
Volume Recovery HD on /dev/disk2s3 mounted

$ find /Volumes/Recovery\ HD -name Encry*
/Volumes/Recovery HD/com.apple.boot.S/System/Library/Caches/com.apple.corestorage/EncryptedRoot.plist.wipekey

$ sudo ./fvdetools/fvdeinfo -e /Volumes/Recovery\ HD/com.apple.boot.S/System/Library/Caches/com.apple.corestorage/EncryptedRoot.plist.wipekey -p dummy /dev/disk2s2
...
$fvde$1$16$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$135098$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
...
$ diskutil unmount /Volumes/Recovery\ HD/
Volume Recovery HD on disk2s3 unmounted

1.1.3 Save hash to hash.txt and begin cracking with hashcat, e.g.,

$ ./hashcat -a 0 -m 16700 -o found.txt hash.txt wordlist.txt

1.2 Removable media volume

1.2.1 System volumes vs. removable media volumes:

"For the system volume you'll first need to obtain the EncryptedRoot.plist.wipekey and pass it to fvdemount. For removable media volumes this is not necessary because the relevant data is stored on the encrypted volume."

1.2.2 Download and compile John the Ripper jumbo:

git clone https://github.com/openwall/john.git -b bleeding-jumbo
cd john/src && ./configure && make -s clean && make -sj4

1.2.3 Extract hash from disk (e.g., rdisk4):

sudo python3 ./fvde2john.py /dev/rdisk4
:$fvde$1$16$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$41000$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx::: ::

2. APFS

2.1 System volume

2.1.1 Linux attacker

2.1.1.1 Install apfs-fuse on PC
sudo add-apt-repository universe && sudo apt update
sudo apt install fuse3 libfuse3-dev libbz2-dev cmake git libattr1-dev zlib1g-dev
git clone https://github.com/sgan81/apfs-fuse.git && cd apfs-fuse/
git submodule update --init
mkdir build && cd build
cmake ..
make
2.1.1.2 Start MacBook Pro in Target Disk Mode, connect to PC, and determine device name, e.g.,
$ cat /proc/partitions
major minor  #blocks  name

   8        0  125034840 sda
...
   8       16  118489088 sdb
2.1.1.3 Acquire hash
$ sudo ./apfs-dump-quick /dev/sdb log.txt

Device /dev/sdb opened. Size is 121332826112
Info: Found valid GPT partition table on main device. Dumping first APFS partition.
...
Volume Macintosh HD is encrypted.
...
Enter Password: JUST PRESS ENTER
...
[KEK]
Unk 80  : 0
UUID    : 48BCAEEB-4E7A-C5D2-B7EB-C21DCD1366F9
Unk 82  : 00000000 0002 15 174
KEK Wrpd: 2FDEAFAA0F6A971F674B487270A5AE59578B29FB377F76E35CF23985E045EBB8F70687086B6ED7F5
Iterat's: 100000
Salt    : 692B540738291E8B5248A74444E5B1EF
...
2.1.1.4 Arrange the hash and save to hash.txt
$fvde$2$16$692B540738291E8B5248A74444E5B1EF$100000$2FDEAFAA0F6A971F674B487270A5AE59578B29FB377F76E35CF23985E045EBB8F70687086B6ED7F5
2.1.1.5 Install hashcat (see §1.1.1) and start cracking
$ hashcat -a 0 -m 18300 -o found.txt hash.txt wordlist.txt

2.1.2 macOS attacker

2.1.2.1 Download apfs2hashcat and compile apfs-dump-quick on Mac mini:
brew install cmake pkg-config git
git clone "https://github.com/Banaanhangwagen/apfs2hashcat.git" && cd apfs2hashcat
git submodule update --init --recursive
mkdir build && cd build
cmake .. -DCMAKE_POLICY_VERSION_MINIMUM=3.5
make apfs-dump-quick
2.1.2.2 Start MacBook Pro in Target Disk Mode, connect to Mac mini via Thunderbolt (ejecting target Macintosh HD if it mounts and dismissing password prompt), and determine disk identifier, e.g.,
% diskutil list
...
/dev/disk5 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk5
   1:                        EFI EFI                     209.7 MB   disk5s1
   2:                 Apple_APFS Container disk6         250.8 GB   disk5s2

/dev/disk6 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.8 GB   disk6
                                 Physical Store disk5s2
   1:                APFS Volume Macintosh HD - Data     122.3 GB   disk6s1
   2:                APFS Volume Preboot                 365.5 MB   disk6s2
   3:                APFS Volume Recovery                613.8 MB   disk6s3
   4:                APFS Volume VM                      1.1 GB     disk6s4
   5:                APFS Volume Macintosh HD            24.0 GB    disk6s5
2.1.2.3 Acquire hash
% sudo ./apfs-dump-quick /dev/disk5 log.txt
...
$fvde$1$16$XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX$93003$XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00000000000000000000000000000000
...
2.1.2.4 Install hashcat (see §1.1.1) and begin cracking
hashcat -a 0 -m 16700 -w 4 --force hash.txt combos.txt

2.2 Removable media volume

2.2.1 Download and compile hashcat on Mac mini:

git clone https://github.com/hashcat/hashcat.git && cd hashcat && make

2.2.2 Extract hash from disk (e.g., disk8):

sudo python3 ./tools/apfs2hashcat.py /dev/disk8
...
Found password hash: $fvde$1$16$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx$142377$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3. Notes

4. See also


created: 2019.05.27, updated: 2026.02.25