Filesystem Forensics and Data Recovery Questions
Disk and file-system internals for forensic examination and data recovery: NTFS/ext4/APFS/FAT structures (MFT, journaling, inodes), file carving, slack and unallocated space, deleted-file recovery, SSD/TRIM and wear-leveling effects on recoverability, RAID reconstruction, and acquisition/analysis of damaged or encrypted media. Distinct from OS-level artifact analysis (registry, Prefetch, event logs, memory/LSASS, persistence mechanisms) and from timeline construction across sources, which are covered by forensic-artifact-analysis-and-timeline-reconstruction.
You have a 20 GB disk image with thousands of deleted files, and you need to identify and recover Office documents authored by one specific user. Walk through your end-to-end approach: how would you combine MFT analysis, carving, and document metadata (author, last-saved user) to narrow down and recover the right files?
Sample Answer
Direct answer
Chain three filters from cheap to expensive rather than brute-forcing 20 GB of deleted files: MFT analysis first (the MFT, or Master File Table, is NTFS's master index of the volume: one record per file, holding its name, its timestamps, and either its content or a map of where that content sits on disk), to enumerate anything still referenced by an MFT record, even an inactive one, which is fast and gives filenames and timestamps for free; carving second, for whatever survives with no MFT record left; and document metadata filtering last, since embedded author metadata is what actually answers "did this specific user write it," which neither MFT timestamps nor carving alone can tell you.
Structured elaboration
- MFT-first pass. Parse the MFT (The Sleuth Kit's
fls/istat, or a dedicated MFT parser) to enumerate every file record, including inactive ones. This gives filenames, MACE timestamps (Modified, Accessed, Created, and Entry modified, that last one being when the record itself was rewritten rather than the file's content), and parent-directory context essentially for free, and for records whose data runs are still intact you can pull content directly withicatwithout carving at all. - Carve what the MFT cannot reach. For records that are gone entirely, carve using signatures appropriate to the container format:
docx/xlsx/pptxare ZIP archives (PK 03 04local-file-header signature), legacydoc/xls/pptare OLE compound files (signatureD0 CF 11 E0 A1 B1 1A E1). Format-aware carving matters here specifically, since a generic carver that just looks for "ZIP" pulls in every other ZIP-based file on the volume too. - Filter by author metadata. This is the step that narrows to one user. OOXML formats (Office Open XML, the modern
docx/xlsx/pptxfamily, each one really a ZIP archive full of XML parts) store it as plain XML inside the archive, atdocProps/core.xml, underdc:creator(original author) andcp:lastModifiedBy(last-saved-by), both Dublin Core / Open Packaging Convention properties, readable with a stock XML parser once the ZIP is intact enough to open. Legacy OLE formats store the equivalent properties inside aSummaryInformationstream, readable witholetools' metadata module orexiftool. Filter to files wheredc:creatormatches the target user, noting that it can differ fromcp:lastModifiedByif the target authored a document someone else later edited, or vice versa. - Validate and document. Confirm the ZIP or OLE structure parses cleanly, not just that the signature matched, before trusting the metadata inside it; hash every recovered file; and record whether each match came from an intact MFT record or a carve, since that distinction affects how confidently you can state the recovery was complete.
Worked example
Three synthetic recovered .docx files, two authored by the target user and one of those two later edited by someone else, exactly the nuance a raw "last saved by" filter alone would get wrong, filtered by the real dc:creator field:
import zipfile, io
import xml.etree.ElementTree as ET
def make_fake_docx(author, last_saved_by):
core_xml = f"""<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:creator>{author}</dc:creator>
<cp:lastModifiedBy>{last_saved_by}</cp:lastModifiedBy>
</cp:coreProperties>"""
buf = io.BytesIO()
with zipfile.ZipFile(buf, "w") as z:
z.writestr("[Content_Types].xml", "<Types/>")
z.writestr("docProps/core.xml", core_xml)
z.writestr("word/document.xml", "<w:document/>")
return buf.getvalue()
def read_author(docx_bytes):
ns = {"dc": "http://purl.org/dc/elements/1.1/",
"cp": "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"}
with zipfile.ZipFile(io.BytesIO(docx_bytes)) as z:
core = z.read("docProps/core.xml")
root = ET.fromstring(core)
creator = root.find("dc:creator", ns)
last_by = root.find("cp:lastModifiedBy", ns)
return (creator.text if creator is not None else None,
last_by.text if last_by is not None else None)
# simulate three recovered/carved documents, only two authored by the target user
recovered = {
"recovered_0001.docx": make_fake_docx("J. Alvarez", "J. Alvarez"),
"recovered_0002.docx": make_fake_docx("M. Chen", "M. Chen"),
"recovered_0003.docx": make_fake_docx("J. Alvarez", "T. Osei"), # authored by target, last edited by someone else
}
target_author = "J. Alvarez"
matches = []
for name, data in recovered.items():
creator, last_by = read_author(data)
print(f"{name}: dc:creator={creator!r}, cp:lastModifiedBy={last_by!r}")
if creator == target_author:
matches.append(name)
print(f"documents authored by {target_author!r}: {matches}")
Output:
recovered_0001.docx: dc:creator='J. Alvarez', cp:lastModifiedBy='J. Alvarez'
recovered_0002.docx: dc:creator='M. Chen', cp:lastModifiedBy='M. Chen'
recovered_0003.docx: dc:creator='J. Alvarez', cp:lastModifiedBy='T. Osei'
documents authored by 'J. Alvarez': ['recovered_0001.docx', 'recovered_0003.docx']
Filtering on dc:creator correctly keeps recovered_0003.docx even though it was last edited by someone else, which a naive "last saved by" filter would have missed entirely.
Trade-offs & pitfalls
Username fields are not reliable identity, they are just whatever string Office was configured with on the machine that created the file, so normalize for variants (a nickname, a different account on a shared machine) and corroborate with other evidence (which user account owned the parent directory per the MFT, timestamps against known activity windows) rather than trusting the metadata field alone. Partial or corrupted OOXML files, a docx whose ZIP central directory carved incompletely, may still yield a readable core.xml even when the rest of the archive will not open cleanly, since ZIP entries are independently compressed, so do not discard a broken archive without first trying to pull just that one entry.
TRIM is enabled on the SSD you're examining, so the usual 'unallocated space still holds the old data' assumption doesn't hold. You have options ranging from software-level recovery on a logical image up through invasive hardware-level techniques. How would you decide how far up that ladder to go for a given case, and what are you weighing at each step: success likelihood, risk of destroying the evidence, the expertise required, and chain-of-custody?
Sample Answer
Direct answer
Treat this as a staged decision, not a single choice: start with the least invasive, cheapest, most defensible option, probabilistic carving from a logical image, and only climb toward chip-off or vendor/controller-level recovery when there is a specific reason to believe the next rung will find something the current one cannot, weighed explicitly against the risk of destroying evidence, the expertise it demands, and what it does to your chain-of-custody story, the unbroken documented record of who held the evidence and what they did to it that is what lets a court trust the exhibit was not altered.
Structured elaboration: what to weigh at each rung
-
Probabilistic carving from a logical image.
Success likelihood: low to moderate for anything TRIM (the command the operating system sends an SSD to announce that a block is no longer in use) has already reached, since the controller may have already erased the underlying flash; carving can still recover fragments in untrimmed slack or from before the last garbage-collection pass. Risk: minimal, non-destructive, works from a standard forensic image. Expertise: moderate, standard carving tools and format validation. Chain-of-custody: straightforward, a normal write-blocked image and documented process. Escalate past this rung when carving comes up empty or clearly partial AND the case value justifies more. -
Raw NAND acquisition (chip-off).
Why this can beat logical imaging at all: the flash translation layer (FTL) maps host-visible logical block addresses to physical NAND pages, and it is exactly the layer TRIM and garbage collection operate through. A logical image only ever sees what the FTL currently chooses to expose; chip-off reads the physical NAND directly, bypassing the FTL and potentially recovering pages the controller has marked invalid but not yet physically erased, or pages sitting in over-provisioned space the host can never address at all. Risk: high, desoldering and reading chips can permanently damage them, and even a successful read produces raw data that needs reconstructing against that specific controller's wear-leveling and FTL scheme to mean anything. Expertise: high, specialist lab equipment and technique. Chain-of-custody: every physical intervention has to be individually documented; expect scrutiny in court precisely because it is invasive. Escalate past this rung when the case value justifies the cost and risk, an accredited lab is available, and legal authorization covers a destructive technique. -
Controller reprogramming or vendor firmware recovery.
Highest potential payoff: reconstructing FTL mappings via vendor tooling or cooperation can recover data inaccessible any other way, but only when the specific controller and vendor relationship support it, this is not a generic technique applicable to any SSD. Risk: moderate to high, wrong commands can trigger secure-erase routines or accelerate the exact loss being avoided. Expertise: very high, often requiring vendor NDAs and cooperation rather than one examiner working alone. Chain-of-custody and legal/ethical constraints: vendor assistance typically means an NDA and documented external involvement the court needs to understand; non-standard recovery methods invite scrutiny, so the legal authorization for this rung specifically should be settled before starting, not justified after the fact.
Decision framework: what you are actually weighing at each step
Success likelihood given what is already known about this specific case (has TRIM run, how much time has passed, is there other corroborating evidence of the file's existence); the case's evidentiary value, is it worth risking physical damage to the only copy of the evidence; the irreversibility of the next rung, can you still fall back if it fails, or does it consume the option to try anything else; and whether you and your lab actually have the expertise the next rung demands, borrowed expertise under time pressure is where mistakes happen.
Trade-offs & pitfalls
Never treat this as "try the cheap thing, then automatically try the expensive thing"; each escalation should be a deliberate, documented decision with a stated reason, not a default fallback. Vendor or controller-level recovery in particular needs its legal and ethical basis established up front, a warrant or client authorization that specifically covers destructive or vendor-assisted methods, not just the general search authority the case started with.
Walk me through how you'd parse a raw NTFS MFT record by hand (or in a script) to pull out the filename, timestamps, attribute types, and non-resident data runs, without relying on a forensic suite to do it for you. What are the parts examiners commonly get wrong, like bad offsets or compressed attributes, and how would you validate that what you extracted is correct?
Sample Answer
Parsing an MFT record by hand (one entry in the Master File Table, NTFS's fixed-size-record index of every file on the volume) comes down to three passes: verify the record is real and undamaged, walk its attribute list pulling out the fields that matter, and for any non-resident attribute, decode its run list into physical cluster addresses. The parts examiners actually get wrong are almost always the same handful of details, not the overall structure.
The three passes
- Validate the record. Confirm the first four bytes read "FILE", then undo the update sequence array fixup: NTFS deliberately corrupts the last two bytes of every 512-byte sector in the record on disk and stores the real values in a small array near the record header, as a way to detect a torn write (a record that was only partially flushed during a crash). Skipping this step is the single most common hand-parsing mistake: if you don't restore those bytes before reading, everything at a sector boundary, timestamps, filename characters, and run-list bytes if unlucky, comes out corrupted.
- Walk the attributes. Each attribute header gives its type code and total length; use the length to jump to the next one rather than trying to infer boundaries from content. Type 0x10 is
$STANDARD_INFORMATION(four timestamps), type 0x30 is$FILE_NAME(name, parent reference, its own four timestamps), type 0x80 is$DATA. - Decode non-resident runs. If
$DATA's resident flag is clear, its content field is a run list: a sequence of (length, signed LCN delta) pairs, where an LCN is a logical cluster number, a cluster's address counted from the start of the volume, and each pair is prefixed by a header byte whose two nibbles give the byte-width of the length and offset fields that follow.
Worked example
def decode_data_run(raw, offset=0):
"""Decode an NTFS non-resident $DATA run list starting at `offset`.
Returns (runs, bytes_consumed); each run is (length_in_clusters, lcn)."""
runs, current_lcn, i = [], 0, offset
while i < len(raw):
header = raw[i]; i += 1
if header == 0x00:
break # terminator
length_size = header & 0x0F
offset_size = (header >> 4) & 0x0F
length = int.from_bytes(raw[i:i + length_size], "little"); i += length_size
raw_offset = int.from_bytes(raw[i:i + offset_size], "little"); i += offset_size
if raw_offset >> (offset_size * 8 - 1): # sign-extend the offset field
raw_offset -= 1 << (offset_size * 8)
current_lcn += raw_offset
runs.append((length, current_lcn))
return runs, i - offset
# Two runs: 12 clusters at LCN 0x1234, then 8 more clusters, 0x400 further on
raw = bytes([0x31, 0x0C, 0x34, 0x12, 0x00,
0x31, 0x08, 0x00, 0x04, 0x00,
0x00])
runs, consumed = decode_data_run(raw)
for length, lcn in runs:
print(f"run: {length} clusters starting at LCN {lcn} (0x{lcn:X})")
print(f"bytes consumed: {consumed}")
cluster_size = 4096
for length, lcn in runs:
print(f"LCN {lcn} -> physical byte offset {lcn * cluster_size} (0x{lcn * cluster_size:X})")
Output:
run: 12 clusters starting at LCN 4660 (0x1234)
run: 8 clusters starting at LCN 5684 (0x1634)
bytes consumed: 11
LCN 4660 -> physical byte offset 19087360 (0x1234000)
LCN 5684 -> physical byte offset 23281664 (0x1634000)
Note the second run's LCN, 5684, is 0x1234 plus the 0x400 delta, not 0x400 on its own; run offsets are relative to the previous run's LCN, so forgetting to accumulate rather than overwrite current_lcn is a second very common bug.
What examiners commonly get wrong
- Skipping the fixup array, corrupting data at every 512-byte sector boundary.
- Forgetting the run-list offset field is signed, and needs sign-extension based on its own byte width, not treating it as a fixed-width value.
- Treating run offsets as absolute LCNs instead of deltas from the running total.
- Not handling NTFS-compressed attributes: NTFS compression (LZNT1, a variant of LZ77, a scheme that shrinks data by replacing a repeated byte sequence with a short back-reference to the earlier copy of it) operates on 16-cluster compression units, not per individual cluster, so a compressed
$DATAattribute's run list doesn't map 1:1 to file content the way an uncompressed one does, and needs decompression per unit before the bytes mean anything.
Validating what you extracted
Cross-check parent directory references against MFT records that actually exist at that number, confirm timestamps fall within plausible bounds (not before the volume's creation, not in the future relative to the image), and where possible compare your hand-parsed output against a mainstream tool's output (Sleuth Kit's istat, or a dedicated MFT parser) on the same record as a sanity check before trusting your own parser on records it hasn't independently verified.
Trade-offs and pitfalls
Hand-parsing is valuable exactly when you need to explain or defend a result in court, or when a corrupted record confuses an off-the-shelf tool and you need to see the raw bytes yourself; for routine bulk extraction across a whole volume, a maintained parser is faster and less error-prone than re-deriving fixup and sign-extension logic under time pressure.
Explain the mechanics of file deletion on FAT12/16/32 file systems. Describe what changes occur in the directory entry and the FAT table when a file is deleted, how long file name (LFN) entries are represented during deletion, and practical implications for recovering contiguous versus fragmented files on FAT volumes.
Sample Answer
Deleting a file on FAT12/16/32 is cheap by design: the OS edits two small pieces of metadata, the directory entry and the FAT chain, and leaves the actual file data completely untouched, which is exactly what makes FAT recovery straightforward when the file was contiguous and much harder when it wasn't.
What changes in the directory entry
The short filename (SFN) directory entry's very first byte is overwritten with 0xE5, which every FAT implementation treats as "deleted, this slot's space can be reused." Everything else in that 32-byte entry, the rest of the name, size, starting cluster number, and timestamps, is left exactly as it was until something else overwrites that directory slot.
What happens to long file name (LFN) entries
A file with a name longer than 8.3 characters has one or more separate LFN entries stored immediately before its SFN entry, each holding a chunk of the Unicode name. On deletion, each LFN entry's own first byte is also set to 0xE5, marking the whole group deleted together, but again without erasing the Unicode name content itself, so a recovery tool can usually still read the original long name straight out of a "deleted" LFN entry.
What changes in the FAT table
The file's cluster chain, the sequence of FAT-table entries linking one cluster to the next, is cleared (set to the free-cluster value) so the space becomes available for allocation. This is the one piece of information FAT does not preserve after deletion: once the chain entries are zeroed, there is no built-in record left of which clusters, beyond the first one recorded in the directory entry, belonged to the file.
Worked example
A short filename directory entry for REPORT.TXT is 11 bytes of name padding: R,E,P,O,R,T, , ,T,X,T. On deletion, only the first byte changes: 0xE5,'E','P','O','R','T',' ',' ','T','X','T', the size field, starting cluster, and timestamps in the rest of the 32-byte entry are unchanged. If the file was 3 clusters long starting at cluster 100, and it was stored contiguously (100, 101, 102), a recovery tool only needs the starting cluster and the size from that still-intact directory entry to read all 3 clusters directly, no FAT chain needed at all: restore the first byte to a plausible character, then read size / cluster_size clusters starting from the recorded starting cluster.
Practical recovery implications
Contiguous files are close to a sure thing to recover, since the directory entry alone gives you the starting point and the size tells you how far to read. Fragmented files are much harder: without the FAT chain, there's no record of which non-adjacent clusters belonged to the file after the first one, so recovery falls back to content-based carving or heuristic chain reconstruction, both far less reliable than reading a still-intact chain.
Trade-offs and pitfalls
FAT volumes keep two copies of the allocation table (typically FAT #1 and FAT #2); they're normally kept synchronized, but if only one was updated before an interruption, comparing the two can occasionally recover a chain that one copy lost. Always work from an image, since mounting a FAT volume read-write and allowing new files to be created risks the OS immediately reusing the very clusters and directory slots you're trying to recover.
Explain the structure and purpose of the NTFS Master File Table (MFT). In your answer describe the common MFT attributes (e.g., $STANDARD_INFORMATION, $FILE_NAME, $DATA), how resident vs non-resident attributes store content, typical record sizes, and why the MFT is central to forensic recovery and timeline reconstruction.
Sample Answer
The Master File Table (MFT) is NTFS's central metadata database: every file and directory on the volume gets one MFT record, including deleted files until that record slot is reused. For an examiner it is the primary index for both recovery and timeline work, because a single record can hold a file's name, its timestamps, and either the file's actual bytes or a map to where those bytes live on disk.
Record layout
MFT records are fixed-size, commonly 1,024 bytes (some newer large-cluster volumes use 4,096). Each record opens with a header (the signature "FILE", an update sequence number used to detect torn writes (a write that only partially completed, say because power was lost mid-flush, leaving a mix of old and new bytes inside a single sector), a record number, and an in-use flag) followed by a variable list of attributes, each with its own type code, length, and a resident or non-resident flag.
Common attributes
$STANDARD_INFORMATION(type 0x10): the four core timestamps (created, modified, MFT-record-changed, accessed) plus standard DOS-style permission bits. This is the attribute most tools show by default.$FILE_NAME(type 0x30): the filename, a reference to the parent directory's MFT record, and its own copy of the four timestamps, useful when$STANDARD_INFORMATIONis missing or has been altered.$DATA(type 0x80): the file's content, and for a file with alternate data streams, one named$DATAattribute per stream. A directory's entries are NOT stored in$DATA: the name index lives in$INDEX_ROOT(type 0x90) and, once it outgrows the record, spills into$INDEX_ALLOCATION(type 0xA0) with a$BITMAPtracking which index blocks are in use.- Supporting attributes:
$OBJECT_ID,$SECURITY_DESCRIPTOR,$INDEX_ROOT/$INDEX_ALLOCATION(directory indexing), and$ATTRIBUTE_LIST(used when a file has so many attributes they spill into extra records).
Resident versus non-resident
A resident attribute stores its content directly inside the 1,024-byte record; NTFS does this automatically whenever the content is small enough to fit. A non-resident attribute instead stores a run list, a compact map from virtual cluster numbers (VCN) in the file to logical cluster numbers (LCN) on disk, and the actual bytes live in those clusters.
Worked example
A 1,024-byte record has roughly 700-800 bytes left for attribute content after the header and the fixed-size $STANDARD_INFORMATION attribute (about 72 bytes) and a short $FILE_NAME attribute (roughly 70 bytes plus the name itself). A 300-byte config file fits comfortably in that remaining space, so its $DATA attribute is resident, meaning the entire file content sits inside the MFT record itself; even after the OS marks that record deleted, the bytes are still there until the record is reused. Compare a 250 KB file (256,000 bytes) on a volume with 4 KB (4,096-byte) clusters: 256,000 / 4,096 is 62.5, so NTFS has to allocate 63 clusters, with the last one only half used and the rest of it becoming file slack. That is far more than the record can hold, so $DATA is non-resident and the record stores something like "VCN 0-62 maps to LCN 88213-88275" instead of the bytes. Recovering that file means reading those specific 63 clusters from the image; if even one has since been handed to a new file, that portion of the recovered content is gone even though the MFT record describing it is perfectly intact.
Why it anchors recovery and timelines
Deleted-file recovery and timeline reconstruction both lean on the MFT because its records persist after deletion (only the in-use flag clears) until the slot is reused, because the redundant timestamp sets in $STANDARD_INFORMATION and $FILE_NAME give two independent views of file activity, and because, combined with the $Bitmap metadata file that tracks which clusters are actually allocated, the MFT lets an examiner tell the difference between "deleted but still there" and "deleted and already overwritten."
Trade-offs and pitfalls
An intact MFT record is not by itself proof of full recoverability: a resident file is safe as long as the record isn't reused, but a non-resident file's record can survive perfectly intact while every cluster its run list points to has already been reallocated, so always check $Bitmap allocation state before reporting confidence in a non-resident recovery.
Unlock Full Question Bank
Get access to all 49 Filesystem Forensics and Data Recovery interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.