How do forensics recover deleted files?

File recovery is the process of restoring files that have been deleted or otherwise lost from a computer system or storage device. In the field of digital forensics, file recovery techniques allow investigators to retrieve deleted files that may contain crucial evidence for legal cases or cybercrime investigations. When a file is deleted, it is not immediately removed from a system – remnants of the data often still reside on the hard drive or storage media. With the right forensic tools and techniques, it is often possible to recover deleted files in full or in part even if a user believed them to be permanently erased. The recovery of deleted files enables forensic examiners to reconstruct user activity and events leading up to a crime and serves as an important source of potential evidence. As such, understanding file recovery methods and being able to effectively recover deleted data is a vital skill for any digital forensics professional.

How Deleting Files Works

When a file is deleted on a computer, the reference to the file’s data on the hard drive is removed rather than the data itself. Specifically, deleting a file removes the file’s entry from the file system table that the operating system maintains. This file system table contains the mapping between file names and the associated physical location of the data on the drive. Once deleted, the data is still physically present on the hard drive, but the operating system no longer keeps track of where it is located (Source).

So in essence, deleting a file simply removes the pointer to the data. The actual 1’s and 0’s representing the file’s contents remain intact in the physical storage blocks on the hard disk until those blocks are overwritten with new data. This allows forensics experts to recover the original deleted data, as long as it hasn’t yet been overwritten.

File Storage on Hard Drives

Hard drives store data in small physical regions called sectors. Each sector typically stores 512 bytes of data. The smallest unit that an operating system allocates for file storage is called a cluster, which consists of one or more contiguous sectors. For example, a cluster size may be 4096 bytes, consisting of 8 sectors of 512 bytes each.

When a file is created and saved to the hard drive, it does not always fit perfectly into clusters. There may be empty space left in the final cluster the file occupies. This leftover space allows new data to be written more efficiently, since the OS does not have to search for or allocate a new cluster every time a file grows in size. However, it also means there is no direct mapping between file size and disk space used.

Some key points about file storage on hard drives:

  • Files are divided and stored non-contiguously in clusters.
  • There is unused space left in partially filled clusters, causing file size to differ from disk usage.
  • The OS manages file-to-cluster mapping transparently via the file system.
  • Defragmentation rearranges files to store them in contiguous clusters for faster access.

Understanding this cluster-based storage mechanism is crucial when attempting to recover deleted files, as we’ll explore next.

Finding Deleted Files

Forensic tools can scan the sectors of a hard drive to find deleted data that still exists in some form. When a file is deleted, the reference to the file’s data in the file system is removed, but the actual data itself remains on the disk until it is overwritten by new data. Forensic tools bypass the file system and scan the raw disk sectors looking for patterns and signatures associated with file formats and operating systems. For example, they may scan for the header and footer byte patterns of common file types like JPEGs or DOCX files. Even if the file name, metadata, and directory info is gone, the data could still reside in the sectors.

Tools like Autopsy provide functionality to thoroughly scan all sectors of a drive to carve out deleted files. File carving extracts and reconstructs files based on content, without relying on metadata. Advanced carving methods like smart carving utilize knowledge of filesystem structures and file headers/footers to improve recovery results. This allows investigators to effectively dig through raw forensic images forfiles that the user may have attempted to delete or destroy.

File Carving

File carving is a technique used in digital forensics to extract files from raw data or disk images based on file headers, footers, and internal file structures. The process scans the raw data looking for specific header patterns that indicate the start of a file, such as JPEG or PDF headers. When a header is detected, the carving tool copies data after the header until a footer pattern is identified, indicating the end of the file. The extracted data in between the header and footer is saved as a separate file (InfoSec Resources, n.d.).

File carving is necessary when the file system metadata is corrupted or missing. Traditional file recovery relies on the file system to locate files, but file carving can recover files even when the file allocation table and directory entries are unavailable. By leveraging knowledge of common file formats, investigators can extract intact files from raw data through header and footer identification alone (Belkasoft, n.d.).

There are challenges to file carving. If headers get corrupted or deleted, carving will fail to identify the start of a file. Carving may also recover incomplete files if footers are missing. Additionally, unallocated space may contain fragments of old, deleted files mixed together, making carving less effective. Overall, file carving provides an important capability to reconstruct files from disk images without file system data.

Recovering Deleted File Content

When a file is deleted on a computer, the file contents are not immediately erased from the hard drive. Instead, the operating system simply marks the space occupied by the file as available for new data. Until that space is overwritten with new files, the original deleted file contents remain intact on disk. Forensic tools can scan the hard drive and locate these deleted file contents based on their signatures and metadata. Two main techniques are used to extract the contents of deleted files:

File carving analyzes the raw data on a disk and searches for specific file headers and footers common to certain file types like JPEGs and PDFs. Any data found between these headers and footers is extracted as a separate file. This reconstructed file represents the deleted file’s contents. However, file carving may fail to recover metadata like filenames or timestamps. How to Recover Deleted Files in Computer Forensics

Looking up file records in the file system allows forensics tools to find references to deleted files that still exist in metadata like the file allocation table. This preserves the original filename, timestamps, and directory structure. However, overwritten parts of the file contents will be corrupted. Digital Forensics, Part 3: Recovering Deleted Files

By utilizing both approaches, investigators can maximize their chances of recovering all available information about deleted files from a disk image.

Recovering Destroyed Files

Recovering destroyed or more heavily damaged files generally requires more advanced techniques like data remapping. Data remapping involves bypassing the file system and directly reading raw data from the disk sectors. Tools like forensic disk editors allow analysts to view the raw hex data and attempt to reconstruct files and folders. This process manually maps the raw data to file types based on signatures and header patterns. For example, JPG files have a distinct header signature that can be identified even if the file system says the file is deleted. Data carving tools can partially automate this process by scanning disk sectors for known file signatures. However, remapping fragmented or partially overwritten files can be challenging and may require advanced expertise. Destroyed file recovery is not always possible but techniques like data remapping give analysts the best chance to salvage data from even significantly corrupted media.

Recovering from Different Devices

While the process of recovering deleted files from a hard drive or SSD is well established, forensics investigators must also recover files from other types of storage media like USB drives, SD cards, and optical discs. Each type of device presents unique challenges and limitations.

With SSDs, for example, the lack of magnetic platters and read/write heads limits some traditional recovery techniques. However SSDs also don’t fully overwrite deleted data blocks as quickly, improving the odds of recovery. Specialized tools like Disk Drill are needed to bypass SSD controllers and read raw flash memory. Optical media like CDs and DVDs cannot be overwritten, so all previously written data remains intact if accessed at the physical level. But optical discs degrade, can shatter, and have limited lifespan. SD cards and USB drives use flash memory so have similar constraints to SSDs. The small physical size also makes physical damage more likely. Overall, while recovering deleted files from alternative media involves adaptations, the same digital forensic principles apply.

Investigators must understand the technical nuances of each storage technology in order to select the optimal recovery strategy. But with the right skills and tools, retrieving deleted files from nearly any media device is achievable.

Challenges and Limitations

While forensic experts have developed sophisticated techniques for recovering deleted files, the process still faces notable challenges and limitations:

Encryption – If a hard drive or device is encrypted, it becomes exponentially more difficult to recover deleted files. Encryption essentially scrambles data so that only authorized parties can access it.

Limited time window – Deleted files can only be recovered if they have not been overwritten by new data. The longer a device has been in use since files were deleted, the less likely recovery becomes.

Trimming SSDs – Solid state drives can trim data, permanently deleting it to improve performance. This trimming happens automatically, eliminating files that could otherwise be recovered.

Destroyed media – If a hard drive or other media has been physically damaged, recovery becomes unlikely or impossible. This includes damage from fire, water, or physical impact.

Anti-forensic techniques – Criminals may use anti-forensic techniques like data wiping to deliberately sabotage recovery efforts. These are designed to completely overwrite deleted data.

Limited tools – Advanced recovery techniques like file carving may only be possible with expensive proprietary tools. Budget and resource constraints can limit access to ideal forensic software.

fragmentation, wiping free space, hidden partitions – All pose challenges to identifying and reconstructing deleted files and data.

Conclusion

In summary, recovering deleted files is a complex process that requires advanced forensic tools and techniques. When a file is deleted, the reference to it is removed but the data itself remains on the hard drive until it is overwritten. Forensic experts use file carving and data recovery software to scan hard drives and reconstruct files based on patterns. However, there are many challenges such as encryption, data destruction, and physical damage that can make recovery difficult or impossible.

Looking ahead, experts expect continued improvements in speed and sophistication of forensic software [1]. However, the amount of data is also increasing exponentially, presenting new obstacles. Some key issues investigators face are keeping up with new devices and encryption methods, dealing with anti-forensic techniques, and maintaining data integrity [2]. Overall, while technology will continue advancing, recovering deleted data from storage devices will remain an essential forensic capability.