Example: LUKS Encryption
A GPT disk image with a LUKS-encrypted ext4 partition.
Manifest
{
"schema_version": "1.0",
"disks": [
{
"name": "training_luks",
"label": "LUKSExample",
"type": "GPT",
"size": "512M",
"bootable": true,
"partitions": [
{
"number": 1,
"type": "primary",
"filesystem": "ext4",
"label": "LUKS_EXT4",
"size": "500M",
"bootable": true,
"populate": {
"add_files": [{ "source": "/files/*", "target": "/" }],
"delete_files": ["/text1.txt"]
},
"encrypt": {
"type": "luks",
"passphrase": "secret123"
}
}
]
}
]
}
Note
The encrypt block is on the partition, not the disk. LUKS version defaults to "1" if not specified.
Build
docker run --rm --privileged \
-v "$(pwd)/examples/example_luks:/output" \
-v "$(pwd)/examples/example_luks/manifest.json:/manifests/manifest.json" \
-v "$(pwd)/files:/files" \
diskforge /manifests/manifest.json
Analysis Walkthrough
1. Examine the Partition Table
GUID Partition Table (EFI)
Slot Start End Length Description
004: 000 0000002048 0001026047 0001024000 primary
The partition table looks normal — LUKS encryption is invisible at this level.
2. Detect the LUKS Header
Attach the image and check the partition:
losetup --find --show training_luks.img
kpartx -a /dev/loop0
cryptsetup isLuks /dev/mapper/loop0p1 && echo "LUKS detected!"
3. Examine the LUKS Header
This reveals the LUKS version, cipher, hash, key slots, and other metadata useful for forensic analysis.
4. Decrypt and Mount
echo -n "secret123" | cryptsetup open /dev/mapper/loop0p1 evidence
mount /dev/mapper/evidence /mnt/evidence
ls /mnt/evidence
5. Clean Up
What Students Learn
- LUKS headers are detectable even without the passphrase
cryptsetup luksDumpreveals encryption metadata- Partition tables don't reveal encryption — deeper analysis is needed
- Passphrase recovery/cracking is the key challenge in encrypted evidence