Part 9 in a series of posts on recovering deleted JPEG files from a FAT file system.
A month ago (!), in part 8, we looked at the JPEG file format specification to determine if there was sufficient determinism in the on-disk layout to allow the recovery of deleted files through analyzing the residual data in the file system. The answer was mixed:
- GOOD: Uniquely valued markers, discoverable through data inspection, identify the beginning and type of the segments that constitute a JPEG file.
- GOOD: the metadata segments have a pre-defined size
-
BAD: the length of the entropy encoded image data is, to the best
of my knowledge, unspecified in the
START-OF-SCANsegment header. Instead, anEND-OF-IMAGEmarker is used to identify the end of the entropy encoded data. The theory is that this is done to allow JPEG files to be written as the image is processed.
Essentially, this means that there is no way to determine through data
inspection the length or location of the clusters containing the encoded
image data. The only clue available is the END-OF-IMAGE marker at
the end of the entropy encoded data.
One option is to discover and analyze latent directory entries in the data area - doing so could provide valuable clues to the start and length of erased JPEG files. The downsides to this approach are added complexity (recovering deleted directory entries) and incompleteness (directory entries for deleted JPEG files may not exist due to reuse).
A simpler approach is to inspect each cluster in the data area to see
if it begins with a START-OF-IMAGE marker or contains an
END-OF-IMAGE marker. Any extent of clusters bounded by
START-OF-IMAGE and END-OF-IMAGE markers stands a good chance of
being the data for a contiguous JPEG file - the very kind of file
we've been trying to recover in this series. In this post, I'll
implement this simple method and test the results. Follow the "Read
more" think for the rest of the post.