Undeleting Files in Windows


FAT

  • cluster/file information is stored in a File Allocation Table (FAT)
    • is a list of entries that map to each cluster on the disk partition
    • each entry records one of five things:
      1. cluster number of the next cluster for this file
      2. if cluster is the end of a chain, then it has a special end of cluster chain (EOC) entry
      3. bad clusters have a special entry
      4. reserved clusters have a special entry
      5. open or available clusters are also marked
  • when a file is deleted, data is not removed from the drive
    • FAT is updated to reflect that those clusters are no longer in use
    • new info can overwrite the old info
    • so, the more recently a file was deleted, the more likely it is recoverable

NTFS

  • two fundamental files for forensics:
    • Master File Table (MFT)
      • describes all files on the volume
        • includes file names, time stamps, security identifiers, and file attributes
      • contains one base file record for each file and directory on an NTFS volume
      • serves same purpose as the FAT
    • cluster bitmap
      • is a map of all the clusters on the hard drive
      • is an array of bit entries where each bit indicates whether its corresponding cluster is:
        • allocated/used
        • or free/unused
  • when a file is deleted
    • cluster is first marked as deleted, before it is marked as available
      • effectively moves it to the recycle bin
    • only when recycle bin is emptied is the cluster marked as available
  • in Windows 7-10, Recycle Bin is located in a hidden directory named \$Recycle.Bin\%SID%
    • %SID% is the SID of the user who performed the deletion
    • when files are moved into the Recycle Bin,
      • original file is renamed to $R followed by a set of random characters
      • maintains file extension
      • a new file beginning with $I followed by same set of random characters is given to the $R file with same extension
        • contains
          • original filename/path
          • original file size
          • date and time the file was moved to Recycle Bin
        • all $I files are exactly 544 bytes long
          • bytes 0-7:
            • $I file header, always set to 01 followed by seven sets of 00
          • bytes 8-15:
            • original file size: stored in hex, in little endian format
          • bytes 16-23: deleted date/time stamp
          • bytes 24-543: original file path/name
  • file systems view clusters as entirely utilized even if one bit is used

Windows Tools

  • DiskDigger
  • WinUndelete
  • FreeUndelete
  • OSForensics
  • Autopsy