Disk forensics
Disk forensics analyzes an exact copy of a storage device to reconstruct what it held, what was created, modified or deleted, and when. It is the most mature DFIR discipline and the one that weighs most when a case may end up in court: the image can be re-analyzed as often as needed and any expert can reproduce the results. It starts where the chain of custody ends and feeds the timeline.
What it solves
Section titled “What it solves”Triage collects known artifacts in minutes; disk analysis answers what triage cannot reach:
- Deleted files and remnants in unallocated space.
- File system history: the NTFS change journal (
$UsnJrnl) and shadow copies keep earlier versions. - Hidden data: alternate data streams (ADS), unmounted partitions or volumes, leftover space at the end of files (slack).
- Document attribution: office, image and PDF metadata that say who, with what and when.
Layers of a disk
Section titled “Layers of a disk”flowchart TD
D["Disk image<br/>(dd, E01)"] --> V["Volume: partition table<br/>MBR or GPT · mmls"]
V --> FS["File system<br/>NTFS · ext4 · APFS · fsstat"]
FS --> M["Metadata<br/>MFT entry · inode · istat"]
FS --> N["Names<br/>directories · fls"]
M --> C["Content<br/>clusters or blocks · icat"]
D --> U["Unallocated space<br/>carving · foremost · PhotoRec"]
The Sleuth Kit organizes its tools by layer: mm* (partitions), fs* (file system), f* (names), i* (metadata) and blk* (blocks). Knowing which layer each piece of data lives in explains what can and cannot be recovered.
Acquisition
Section titled “Acquisition”Acquisition with a write blocker, hash and log is covered in chain of custody. Disk-specific points:
- Full disk encryption (BitLocker, FileVault, LUKS): an image of the powered-off disk only contains encrypted data. Options: acquire live with the volume unlocked, retrieve the recovery key (from Active Directory, Entra ID or the MDM) or extract the key from memory.
- SSDs and TRIM: the controller may physically erase freed blocks shortly after a deletion. On SSDs, deleted file recovery and carving yield far less than on magnetic disks.
- Cloud: snapshot of the instance’s disk, copied to an isolated forensic account and attached to an analysis workstation; hash the exported image.
- Virtualization: VMDK, VHDX or QCOW2 files can be analyzed directly or converted; hypervisor snapshots serve as a point-in-time image.
Analysis with The Sleuth Kit
Section titled “Analysis with The Sleuth Kit”Outputs from a lab image with an MBR table and one ext4 partition:
mmls disk.img # partition table and offsetsDOS Partition Table Slot Start End Length Description000: Meta 0000000000 0000000000 0000000001 Primary Table (#0)001: ------- 0000000000 0000002047 0000002048 Unallocated002: 000:000 0000002048 0000081919 0000079872 Linux (0x83)fsstat -o 2048 disk.img # file system type and parametersfls -o 2048 -r disk.img # file tree with inode or MFT entry numbersistat -o 2048 disk.img 14 # an entry's metadata: times, size, blocksicat -o 2048 disk.img 14 > f # content from the metadata-o 2048 is the partition offset in sectors, taken from mmls. Sleuth Kit tools built with libewf read E01 images directly; otherwise, mount the image with ewfmount and work on the raw file it exposes.
Autopsy is the graphical front end on top of Sleuth Kit: keyword indexing, file views by type, known hashes (NSRL to rule out system files), timeline, and Windows and browser artifact modules.
NTFS: what it keeps
Section titled “NTFS: what it keeps”| Structure | What it provides |
|---|---|
$MFT |
One entry per file with $STANDARD_INFORMATION, $FILE_NAME (two sets of timestamps) and $DATA; files under roughly 700 bytes fit inside the entry itself (resident) |
$UsnJrnl:$J |
Change journal: creation, rename, write and deletion with time and reason; survives the file’s deletion |
$LogFile |
Transactional metadata log; useful for very recent operations |
$I30 |
Directory indexes; their slack may still hold names of deleted files |
| ADS | Alternate data streams: Zone.Identifier (download origin) or data hidden by the attacker |
| Volume Shadow Copies | Volume snapshots with earlier versions of files, hives and event logs |
Shadow copies are explored on the image with vshadowinfo and vshadowmount (libvshadow); they often contain the event log or the executable that the attacker later deleted.
Deleted file recovery and carving
Section titled “Deleted file recovery and carving”Deleting a file does not erase its content: the system marks the entry and its blocks as free. What can be recovered depends on the file system:
- NTFS: the MFT entry is marked unused but keeps its attributes and cluster list until reused;
fls -dlists it andicatusually recovers the content. - ext4: on deletion the kernel usually zeroes the inode’s extent information, so the name shows up but
icatreturns no content. Carving is what is left. - Carving: searching the raw bytes for headers and footers of known formats (JPEG, PDF, ZIP), independent of the file system.
Lab test on the image above, after deleting nominas.jpg:
$ fls -o 2048 -r -d disk.imgr/r * 14: docs/nominas.jpg
$ foremost -t jpg,pdf -i disk.img -o carve$ sha256sum original/nominas.jpg carve/jpg/00015360.jpgc11fae3c0e4a449ecc4e37ece21957e194c97f99f06f89d4d3ec8ca6363fa123 original/nominas.jpgc11fae3c0e4a449ecc4e37ece21957e194c97f99f06f89d4d3ec8ca6363fa123 carve/jpg/00015360.jpgThe asterisk in fls marks the deleted entry; the carved file has the same hash as the original. In the test the deletion was done with debugfs on the image, which did not clear the block pointers, so icat also recovered the content; with the kernel’s ext4 driver that is usually not the case.
- Carving loses name, path and timestamps: the file is named after its offset on the disk.
- Fragmented files come back badly or incomplete; PhotoRec and bulk_extractor complement foremost (bulk_extractor also pulls emails, URLs and card numbers from anywhere on the disk).
Document metadata
Section titled “Document metadata”exiftool -a -G1 document.docx # author, last modified by, application, internal datesexiftool -gps:all photo.jpg # camera coordinatesA document’s internal dates (creation and modification in its properties) are independent of the file system’s: if they do not match, someone copied, edited or tampered with the file.
Anti-forensics
Section titled “Anti-forensics”- Secure deletion (
sdelete,shred,cipher /w): overwrites content. The tool’s footprint (Prefetch,$UsnJrnl) and the pattern of zeros or random data remain. - Deleting shadow copies before encryption, typical of ransomware.
- Timestomping: detected by comparing
$SIand$FNand checking against$UsnJrnl(timeline). - Hiding: data in ADS, unmounted partitions, the volume’s leftover space or encrypted containers (VeraCrypt) that look like noise.
- Disk encryption: without the key the image is useless; hence the priority of capturing memory while the machine is unlocked.
Real-world cases
Section titled “Real-world cases”- The BTK killer (Wichita, 2005): Dennis Rader sent a local TV station a floppy disk with a Word document. Its metadata named the organization “Christ Lutheran Church” and showed it had last been modified by a user called “Dennis”, which led police to him. Lesson: documents’ internal metadata survives even when the visible content reveals nothing, and it is usually the first thing people forget to clean.
Checklist
Section titled “Checklist”- Image verified by hash and logged in the chain of custody
- Encryption identified and keys obtained (recovery key, memory or live acquisition)
- Partitions and unallocated gaps between them reviewed (
mmls) - File tree including deleted entries (
fls -r -d) -
$MFT,$UsnJrnland$LogFileextracted and processed - Shadow copies enumerated and compared with the current volume
- Carving of unallocated space (foremost, PhotoRec, bulk_extractor)
- Known hashes excluded (NSRL) and indicators searched (YARA, keywords)
- Metadata of relevant documents extracted
- Everything merged into the timeline
References
Section titled “References”- The Sleuth Kit and Autopsy: https://www.sleuthkit.org/
- libvshadow (
vshadowinfo,vshadowmount): https://github.com/libyal/libvshadow - foremost: https://foremost.sourceforge.net/
- PhotoRec: https://www.cgsecurity.org/wiki/PhotoRec
- bulk_extractor: https://github.com/simsong/bulk_extractor
- ExifTool: https://exiftool.org/
- NIST, National Software Reference Library (NSRL): https://www.nist.gov/itl/ssd/software-quality-group/national-software-reference-library-nsrl
- NIST SP 800-86, Guide to Integrating Forensic Techniques into Incident Response: https://csrc.nist.gov/pubs/sp/800/86/final