File System Forensics FAT and NTFS. Copyright Priscilla Oppenheimer 1



Similar documents
New Technologies File System (NTFS) Priscilla Oppenheimer. Copyright 2008 Priscilla Oppenheimer

Windows NT File System. Outline. Hardware Basics. Ausgewählte Betriebssysteme Institut Betriebssysteme Fakultät Informatik

Outline. Windows NT File System. Hardware Basics. Win2K File System Formats. NTFS Cluster Sizes NTFS

The Windows File Articles -> Software Oct , 00:45 (UTC+0)

A Forensic Comparison of NTFS and FAT32 File Systems

Windows OS File Systems

3. USB FLASH DRIVE PREPARATION. Almost all current PC firmware permits booting from a USB drive, allowing the launch

Operating Systems CS-384. File Systems. NTFS and FAT32. Submitted To: Dr. Chris Taylor. Submitted By: Aditya Sitani

FAT32 vs. NTFS Jason Capriotti CS384, Section 1 Winter Dr. Barnicki January 28, 2000

A+ Guide to Software: Managing, Maintaining, and Troubleshooting, 5e. Chapter 3 Installing Windows

Alternate Data Streams in Forensic Investigations of File Systems Backups

Copyright

NTFS Documentation. Richard Russon Yuval Fledel

Incident Response and Computer Forensics

Review NTFS Basics. Behzad Mahjour Shafiei, Farshid Iranmanesh, Fariborz Iranmanesh. Bardsir Branch, Islamic Azad University, Bardsir, Iran

MSc Computer Security and Forensics. Examinations for / Semester 1

CHAPTER 17: File Management

Installing a Second Operating System

REPORT DOCUMENTATION PAGE

File Systems for Flash Memories. Marcela Zuluaga Sebastian Isaza Dante Rodriguez

Chapter Contents. Operating System Activities. Operating System Basics. Operating System Activities. Operating System Activities 25/03/2014

UNDELETE Users Guide

UNDELETE Users Guide

FORENSIC ANALYSIS OF USB MEDIA EVIDENCE. Jesús Alexander García. Luis Alejandro Franco. Juan David Urrea. Carlos Alfonso Torres

Introduction to BitLocker FVE

Defining Digital Forensic Examination and Analysis Tools Using Abstraction Layers

RECOVERING FROM SHAMOON

Just EnCase. Presented By Larry Russell CalCPA State Technology Committee May 18, 2012

Chapter 12 File Management

Computer Forensics and Investigations Duration: 5 Days Courseware: CT

David Cowen Matthew Seyer G-C Partners, LLC

Digital forensic techniques for static analysis of NTFS images

Chapter 12 File Management

Chapter 12 File Management. Roadmap

File Systems Management and Examples

Windows 7: Current Events in the World of Windows Forensics

Digital Forensics Lecture 3. Hard Disk Drive (HDD) Media Forensics

EFFECTIVE DIGITAL FORENSIC ANALYSIS OF THE NTFS DISK IMAGE

EnCase 7 - Basic + Intermediate Topics

Dr Michael Cohen. This talk does not represent my Employer. April 2005

Chapter 4. Operating Systems and File Management

File System Management

Encrypting the Private Files on Your Computer Presentation by Eric Moore, CUGG June 12, 2010

MANAGING DISK STORAGE

Recover data from a defective Fujitsu desktop drive

An overview of FAT12

HW 07: Ch 12 Investigating Windows

Password Changer for DOS User Guide

Date: March Reference No. RTS-CB 018

Data Hiding Techniques


NovaBACKUP. User Manual. NovaStor / November 2011

COS 318: Operating Systems

COMPUTER FORENSICS. DAVORY: : DATA RECOVERY

Prof. Dr. Ing. Axel Hunger Dipl.-Ing. Bogdan Marin. Operation Systems and Computer Networks Betriebssysteme und Computer Netzwerke

Digital Forensics. Tom Pigg Executive Director Tennessee CSEC

HP ProtectTools Embedded Security Guide

ENTERPRISE COMPUTER INCIDENT RESPONSE AND FORENSICS TRAINING

Operating Systems Forensics

NTFS Undelete User Manual

LESSON 4 - FILE MANAGEMENT

winhex Disk Editor, RAM Editor PRESENTED BY: OMAR ZYADAT and LOAI HATTAR

Presentation on Black Hat Europe 2003 Conference. Security Analysis of Microsoft Encrypting File System (EFS)

Lecture 18: Reliable Storage

Determining VHD s in Windows 7 Dustin Hurlbut

EaseUS. EaseUS Data Recovery Wizard User guide

Microsoft Exchange 2003 Disaster Recovery Operations Guide

DOCUMENTATION SHADOWPROTECT - MICROSOFT WINDOWS SYSTEM BACKUP AND RESTORE OPERATIONS

NSS Volume Data Recovery

UNDELETE 7.0 USER GUIDE

Understanding Backup and Recovery Methods

2.8.1 Creating an Acronis account Subscription to Acronis Cloud Creating bootable rescue media... 16

CHAPTER 9 System Backup and Restoration, Disk Cloning

Acronis Disk Director 11 Home. User's Guide

McAfee EETech for Mac 6.2 User Guide

Forensically Determining the Presence and Use of Virtual Machines in Windows 7

Data Recovery Wizard

TELE 301 Lecture 7: Linux/Unix file

Using Microsoft Windows Encrypted File System (EFS)

Symantec Backup Exec 2014 Icon List

Chapter 13 File and Database Systems

Chapter 13 File and Database Systems

STUDY GUIDE CHAPTER 4

How to recover partitions and files. (Freeware Guide) Step by step with examples

Overview. Windows Alternate Data Streams How code and data can be hidden within files and directories

NAND Flash Memories. Using Linux MTD compatible mode. on ELNEC Universal Device Programmers. (Quick Guide)

Using the HFSD journal for deleted file recovery

Chapter 5: Fundamental Operating Systems

Zmanda Cloud Backup Frequently Asked Questions

M100 System File Manager Help

Excerpts from EnCase Introduction to Computer Forensics

ZENworks 11 Support Pack 4 Full Disk Encryption Agent Reference. May 2016

Transcription:

File System Forensics FAT and NTFS 1

FAT File Systems 2

File Allocation Table (FAT) File Systems Simple and common Primary file system for DOS and Windows 9x Can be used with Windows NT, 2000, and XP New Technologies File System (NTFS) is default for NT, 2000, and XP Supported by all Windows and UNIX varieties Used in flash cards and USB thumb drives 3

The FAT Family FAT12, FAT16, FAT32 The number refers to the quantity of bits used in the FAT to refer to clusters 4

Disk Storage Review Data is stored on disks one entire sector at a time A sector is usually 512 bytes If you use only one byte, the system still provides the other 511 bytes for you A sector is the minimum size read from, or written to, a disk A sector is the minimum I/O unit 5

Disk Storage Review (cont.) Space is allocated to a file one cluster at a time A cluster is a fixed number of sectors Must be a power of 2 (1,2, 64) Unused sectors retain the data that was on them prior to allocation A cluster is the minimum file allocation unit 6

Clusters Cluster 1 Cluster 2 Sector 1 Sector 2 Sector 1 Sector 2 Sector 3 Sector 3 Sector 4 Sector 4 7

File Data (Example 1) Cluster 1 Cluster 2 Sector 1 Sector 2 Sector 1 Sector 2 Sector 3 Sector 3 Sector 4 Sector 4 8

File Data (Example 2) Cluster 1 Cluster 2 Cluster 3 Sector 1 Sector 1 Sector 1 Sector 2 Sector 2 Sector 2 Sector 3 Sector 3 Sector 3 Sector 4 Sector 4 Sector 4 9

Slack Slack is the space allocated to a file, but unused Space at the end of a sector that remains unused by the file Sectors allocated to the file that the file hasn t yet used Slack space often contains useful evidence Unused bytes in an allocated sector are less useful Unused sectors in an allocated cluster retain their original contents and are very useful 10

Unallocated Clusters Many clusters on a modern hard drive are unallocated Unallocated clusters may have been allocated earlier though These clusters retain their data until they are reallocated to a new file Deleted files are still recoverable! 11

Cluster Allocation Algorithms First available Always start at the beginning of the file system Fragmented files common Recovery of deleted content better at end of file system 12

Cluster Allocation Algorithms Best fit Search for consecutive clusters that fit the size of file Only works for files that don t grow Next available Start search with the cluster that was most recently allocated More balanced for data recovery Used by Windows 98 and XP 13

Partitions Review The user creates partitions (logical drives or volumes) Creates Master Boot Record with partition table Each partition uses a file system FAT12, FAT16, FAT32, NTFS on Windows systems EXT2, EXT3, UFS1, UFS2 on Linux and UNIX systems Recovery tools can often find data even if the disk was repartioned Look for tell-tale symptoms of a file system FAT file systems have 0x55AA in bytes 510 and 511 of the partition, for example 14

Partitions Review MBR in first 512-byte sector on disk Boot code (Bytes 0-445) Partition table (bytes 446-509) Signature (bytes 510-511, value = 0x55AA) Partition table has four entries Disk has four primary partitions A primary partition may hold extended partitions 15

Disk Partition 1 Partition 2 Master Boot Record Including Partition Table & Signature 16

File Systems High-level formatting creates file system data structures Root directory Data that tracks which clusters are unused, allowing the OS to find available clusters quickly File Allocation Table (FAT) on older Windows systems $Bitmap in the Master File Table (MFT) on newer Windows Exact details depend on operating system 17

Partition Holds a File System from the FAT Family Partition 1 Partition 2 FAT File System 18

FAT Family File System Partition 1 Partition 2 FAT File System Reserved Area FAT Area Data Area 19

FAT File System Layout Partition 1 Partition 2 FAT File System Reserved Area FAT Area Data Area FAT Boot Sector Primary and Backup FATs Clusters Store Directory and File Content 20

FAT File System Boot Sector Partition 1 Partition 2 FAT File System Reserved Area FAT Area Data Area FAT Boot Sector Primary and Backup FATs Clusters Jump to boot code OEM Name Bytes per Sector Sectors Per Cluster Size of Reserved Area Number of Fats Boot Code Signature (0x55AA) 21

FAT32 Boot Sector Partition 1 Partition 2 FAT File System Reserved Area FAT Area Data Area FAT Boot Sector Primary and Backup FATs Clusters Jump to boot code OEM Name Bytes per Sector Sectors Per Cluster Size of Reserved Area Number of Fats Sector for FSINFO Sector for backup Boot Sector Boot Code Signature (0x55AA) 22

FAT32 FSINFO Hints about where the OS can find free clusters Byte Range 0-3 4-483 484-487 488-491 492-495 496-507 508-511 Description Signature (0x41615252) Not Used Signature (0x61417272) Number of free clusters Next free cluster Not Used Signature (0x55AA0000) 23

12, 16, or 32 bits FAT Entries First addressable cluster is cluster 2 In FAT16, non-addressable cluster 0 stores the media type 0xF0 means removable 0xF8 means non-removable Duplicates byte 21 of volume boot record In FAT16, non-addressable cluster 1 stores the dirty status of the file system 24

File Allocation Table Concepts Partition 1 Partition 2 FAT File System Reserved Area FAT Area Data Area FAT Boot Sector Primary and Backup FATs Clusters FAT Cluster Entry 000 001 002 000 003 004 not allocated next cluster 004 072 next cluster 072 FFF end of file 25

End of File and Bad Cluster End-of-file marker Greater than 0xFF8 for FAT12 Greater than 0xFFF8 for FAT16 Greater than 0xFFFF FFF8 for FAT32 Bad cluster 0xFF7 for FAT12 0xFFF7 for FAT16 0x FFFF FFF7 for FAT32 26

Data Area Concepts Partition 1 Partition 2 FAT File System Reserved Area FAT Area Data Area FAT Boot Sector Primary and Backup FATs Clusters Root Directory Other Directories and Files 27

Root Directory Fixed length in FAT12/16 32 sectors Each entry is 32 bytes 512 entries total Starts before cluster 2 Not fixed length in FAT32 Starts at cluster 2 Each entry is still 32 bytes 28

FAT Directories Reserved Area Partition 1 Partition 2 FAT File System FAT Area Data Area Directory Entry Long File Name 8.3 Filename FAT Boot Sector Primary and Backup FATs Clusters File attributes (read only, hidden, system, long file name, directory, archive, etc.) Directory Files Created time/day Accessed day Modified time/day First cluster address Size of file (0 for directory) 29

Deleting a FAT File Deleting dir1\file1.txt 1. Read Fat Boot Sector (sector 0 of the volume) to understand structure and location of Reserved, FAT, and Data areas 2. Locate dir1 in Root Directory; determine its starting cluster 3. Go to dir1 cluster; determine starting cluster for file1.txt 4. Set FAT entries for file1.txt to 0 5. Change filename to σile1.txt in dir1 directory First character becomes 0xE5 30

Directory and FAT Directory First cluster used by file 000 001 002 FAT file1.txt file2 file3 file4 O2C 02C 02D 02E 0 2 D 0 2 E F F F 31

Directory Directory and FAT Deleted file 000 First cluster used by file 001 002 FAT σile1.txt file2 file3 file4 O2C 02C 02D 02E 0 0 0 0 0 0 0 0 0 32

Recovering Files Easy if file isn't fragmented and clusters haven't been reallocated! Go to directory entry Change the first character of the file name from 0xE5 to original (or guess if original can't be derived) Go to FAT for first cluster Get that cluster and the next consecutive clusters (depending on size of file) 33

Potential problems Fragmented files It's Not Perfect Clusters that have been overridden Missing directories or directory entries Although the dot and dot dot entries may help Best bet will be when fragmentation is minimal and the deletion was recent Usually errors in recovery are obvious Partial recovery is better than nothing! 34

New Technologies File System (NTFS) 35

NTFS Default file system for Windows NT, 2000, XP, and Windows Server 2003 No published spec from Microsoft that describes the on-disk layout Windows 2000 and XP use a newer form of NTFS called NTFS5. Good sources for NTFS information Linux NTFS Project www.ntfs.com 36

Microsoft NTFS Goals Provide a reliable, secure, scalable, and efficient file system Get a foothold in the lucrative business and corporate markets Some concepts borrowed from OS/2 High Performance File System (HPFS) 37

NTFS Features Logging Transaction-based File and folder permissions Disk quotas Reparse points (used to link files) Sparse file support Compression Encryption Alternate data streams 38

Sparse Files Clusters that contain all zeros aren t written to disk Analysis considerations A deleted sparse file is hard to recover If file system metadata is deleted or corrupted, a sparse file might not be recoverable 39

File Compression Data is broken into equal-sized compression units (e.g. 16 clusters) An attempt is made to compress each unit Parts of a file may be compressed while other parts aren t 40

File Compression Analysis Considerations A single file can use different compression methods (e.g. none, sparse, or variant of LZ77) Recovery tools need to support decompression A deleted compressed file is hard to recover If file system metadata is deleted or corrupted, a compressed file might not be recoverable 41

Encrypting File System (EFS) Uses both symmetric key encryption (DESX) and asymmetric key encryption (RSA) Generates a single file encryption key (FEK) and encrypts file with FEK using DESX Encrypts FEK with RSA Stores FEK with file 42

File Encryption Key Encryption FEK is encrypted with user s public key FEK is decrypted with user s private key If policy allows it, FEK is also encrypted with public key of recovery agent (and decrypted with private key of recovery agent) 43

File Encryption Source: NTFS.com 44

EFS Analysis Considerations By default a user s private key is stored in the Windows registry, encrypted with login password as key Login password is susceptible to brute force attack and private key might be compromised EFS creates a temporary file (EFS0.TMP) with plaintext data Marks it as deleted when finished but doesn t actually erase contents 45

Alternate Data Streams Data added to a file Introduced to support Macintosh files that have a data and resource fork Almost impossible to detect with normal file browsing techniques A favorite of hackers and criminals 46

Creating an ADS To create an ADS named foo to go with the file.txt file, use the following DOS command echo "Hello There" > file.txt:foo 47

Another ADS Example Source: WindowSecurity.com 48

Start the Program 49

What Program Is Running? 50

NTFS Basic Concepts Everything is a file Files have attributes $SOME_UPPER_CASE_THING $FILE_NAME $STANDARD_INFORMATION Creation, altered, accessed times; flags (read only, hidden, system, archive, etc.) $DATA (the actual content) 51

File System Metadata Files Files that store file system administrative data Note that they are files (unlike FAT which was a separate data structure) Name begins with $ and first letter is capitalized $MFT $LogFile 52

Master File Table Contains information about all files and directories Every file and directory has at least one entry in the table Each entry is simple 1 KB in size Entry header is first 42 bytes Remaining bytes store attributes 53

File System Metadata Files First 16 MFT Entries Are Reserved Entry File Name Description 0 $MFT Entry for MFT itself 1 $MFTMirr Backup of MFT 2 $LogFile Journal 3 $Volume Volume label, etc. 4 $AttrDef IDs for attributes 5 / Root directory 6 $Bitmap Allocation status of clusters 7 $Boot Boot sector 8 $BadClus Clusters with bad sectors 54

Resident and Non-Resident Attributes A resident attribute stores its content in the MFT entry A non-resident attribute stores its content in external clusters Non resident attributes are stored in cluster runs The attribute header gives the starting cluster address and its run length 55

Non-Resident Attributes $DATA attribute for files > 1 KB $DATA attribute for $Boot $DATA attribute for $MFTMirr $DATA attribute for $LogFile 56

Hard Disk Drives Review Factory low-level formatting defines tracks and sectors on a blank disk A track contains many sectors A sector is typically 512 bytes A sector is the minimum I/O unit 57

Clusters A cluster is a group of consecutive sectors A cluster is the minimum file allocation unit The number of sectors per cluster is a power of 2 The number is stored in the volume boot sector Typical values are 2 1 =2, 2 2 =4, 2 3 =8, 2 4 =16 58

Partitions The user creates partitions (logical drives or volumes) Each partition holds a file system FAT12, FAT16, FAT32, NTFS on Windows systems EXT2, EXT3, UFS1, UFS2 on Linux and UNIX systems 59

File Systems High-level formatting creates file system data structures Root directory Data that tracks which clusters are unused, allowing the OS to find available clusters quickly File Allocation Table (FAT) on older Windows systems $Bitmap file in the Master File Table (MFT) on newer Windows systems 60

DOS Disk Review Partition 1 Partition 2 Master Boot Record Including Partition Table & Signature 61

Partition Holds an NTFS File System Partition 1 Partition 2 NTFS File System 62

NTFS: Everything Is a File Partition 1 Partition 2 NTFS File System Volume Boot Sector More Files 63

NTFS Volume Boot Sector Partition 1 Partition 2 NTFS File System Volume Boot Sector More Files Jump to boot code OEM ID: NTFS Bytes per Sector Sectors Per Cluster Location of MFT Location of MFT Mirror Boot Code Signature (0xAA55) 64

A Freshly Formatted NTFS Volume Partition 1 Partition 2 NTFS File System Volume Boot Sector More Files Free Space MFT Free Space More Metadata Free Space Hidden Copy of Volume Boot Sector 65

Metadata in Center of Volume Partition 1 Partition 2 NTFS File System Volume Boot Sector More Files Free Space MFT Free Space More Metadata Free Space Hidden Copy of Volume Boot Sector $MFTMirr $DATA $LogFile $DATA 66

MFT Partition 1 Partition 2 NTFS File System Volume Boot Sector More Files Free Space MFT Free Space More Metadata Free Space Hidden Copy of Volume Boot Sector $MFT $MFTMirr $LogFile $Bitmap $Boot $BadClus 67

Partition 1 Partition 2 NTFS File System MFT Attributes Volume Boot Sector More Files Free Space MFT Free Space More Metadata Free Space Hidden Copy of Volume Boot Sector MFT Entries Header Header Header Attribute Header Attribute Header Attribute Header Attribute Attribute Attribute Attribute Header Attribute Header Attribute Header Attribute Attribute Attribute Header Attribute Header Attribute Attribute Header Attribute Header Header Attribute Header Attribute Header Attribute Attribute Attribute Header Attribute Header Attribute Attribute 68

MFT Entry Header Partition 1 Partition 2 NTFS File System Volume Boot Sector More Files MFT Free Space More Metadata Files Free Space Hidden Copy of Volume Boot Sector MFT Entry Header Attribute Header Attribute Attribute Header Attribute Signature ( FILE ) Offset to Fixup Array # of Entries in Fixup Array In-Use Sequence Number and Directory Other Stuff Fixup Values Flags 69

Creating an NTFS File Creating dir1\file1.txt 1. Read volume boot sector to locate MFT. 2. Read first entry in MFT to determine layout of MFT. 3. Allocate an MFT entry for the new file. 4. Initialize MFT entry with $STANDARD_INFORMATION, In-Use Flag, etc. 5. Check MFT $Bitmap to find free clusters, using best-fit algorithm. 6. Set corresponding $Bitmap bits to 1. 7. Write file content to clusters and update $DATA attribute with starting address of cluster run and run length. 8. Read root directory (MFT entry 5), traverse index, and find dir1. 9. Read $INDEX_ROOT attribute for dir1 and determine where file1.txt should go. 10. Create new index entry; resort index tree. 11. Enter steps in $LogFile (as each step is taken). 70

An NTFS File 0 1 $MFT MFT Entry Bitmap 1 $LogFile 2 $LogFile 5 \ Cluster Bitmap \ Index dir 1 200 6 $Bitmap 11 200 dir1 \ dir1 file1.txt 304 304 file1.txt file1.txt $DATA attribute Cluster 692 Cluster 693 71

NTFS File Deleted Data in blue boxes is unallocated 0 1 $MFT MFT Entry Bitmap 0 $LogFile 2 $LogFile 5 6 \ $Bitmap Cluster Bitmap 00 \ Index dir 1 200 200 dir1 \ dir1 file1.txt $DATA attribute 304 file1.txt Cluster 692 Cluster 693 72

Deleting an NTFS File Deleting dir1\file1.txt 1. Read volume boot sector to locate MFT. 2. Read first entry in MFT to determine layout of MFT. 3. Read root directory (MFT entry 5), traverse index, and find dir1. 4. Read $INDEX_ROOT for dir1 entry and find file1.txt entry. 5. Remove filename entry from index; move other entries over. 6. Unallocate MFT entry and clean In-Use Flag. 7. Set MFT $Bitmap entries to 0. 8. Enter steps in $LogFile (as each step is taken). 73

Summary NTFS is more complicated than FAT but also has more scalability, reliability, and security features Forensics analysis and recovery of files is possible especially if $MFT or $MFTMirr are in good shape Recovery challenges include compression and encryption 74