Computer Forensics COEN 252.  File systems can be extent-based ◦ E.g. NTFS ◦ Storage space is allocated in extents, large sets of contiguous blocks ◦

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

File Management.
More on File Management
Concepts about the file system 2. The disk structure 3. Files in disk – The ext2 FS 4. The Virtual File System (c) 2013, Prof. Jordi Garcia.
Chapter 4 : File Systems What is a file system?
File Management.
File Systems.
File Systems Examples.
Ext2/Ext3 Linux File System Reporter: Po-Liang, Wu.
File System Analysis.
File System Basics Brandon Checketts. Some terminology Superblocks Inodes Journaling Hard links Symbolic links Directory entries.
Operating Systems File Systems CNS 3060.
File System Implementation
Operating Systems File Systems (in a Day) Ch
Lecture 10: The FAT, VFAT, and NTFS Filesystems 6/17/2003 CSCE 590 Summer 2003.
File Systems Implementation
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Operating Systems File systems
Ceng Operating Systems
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
1 File Management in Representative Operating Systems.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
Wince File systems. File system on embedded File system choice on embedded is important –File system size can be an issue –Different media are used –
Silberschatz, Galvin and Gagne  Operating System Concepts File-System Structure File structure user view  Logical storage unit  Collection.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Ext* Content Areas Inodes, Directories & Files. Review Recall …the file system metadata The superblock describes the file system The group descriptor.
Objectives Learn what a file system does
Chapter 8 File Management
BACS 371 Computer Forensics
Chapter 5 Part 2 Secondary Storage Mgt. File Mgt. in Popular OSs
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
1Fall 2008, Chapter 11 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
CS 346 – Chapter 12 File systems –Structure –Information to maintain –How to access a file –Directory implementation –Disk allocation methods  efficient.
Files CS Spring Overview Example: FAT File System File Organization File System Organization –File Directories and File Sharing –Record Blocking.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
File System Management File system management encompasses the provision of a way to store your data in a computer, as well as a way for you to find and.
Operating System Concepts and Techniques Lecture 17
1 Interface Two most common types of interfaces –SCSI: Small Computer Systems Interface (servers and high-performance desktops) –IDE/ATA: Integrated Drive.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
Chapter 5 File Management File System Implementation.
File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are.
File System Implementation
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation.
Module 4.0: File Systems File is a contiguous logical address space.
File Systems Security File Systems Implementation.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
CS333 Intro to Operating Systems Jonathan Walpole.
UNIX File System (UFS) Chapter Five.
Lecture 10 Page 1 CS 111 Summer 2013 File Systems Control Structures A file is a named collection of information Primary roles of file system: – To store.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems File systems.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems File systems.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
Lecture 19 Linux/Unix – File System
File system and file structures
Review CS File Systems - Partitions What is a hard disk partition?
W4118 Operating Systems Instructor: Junfeng Yang.
Day 28 File System.
EXT in Detail High-Performance Database Research Center
Jonathan Walpole Computer Science Portland State University
Chapter 11: File System Implementation
Day 27 File System.
File System Structure How do I organize a disk into a file system?
Filesystems.
COEN 252: Computer Forensics
File Structure 2018, Spring Pusan National University Joon-Seok Kim
An overview of the kernel structure
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
FAT File System.
Chapter 5 File Systems -Compiled for MCA, PU
Presentation transcript:

Computer Forensics COEN 252

 File systems can be extent-based ◦ E.g. NTFS ◦ Storage space is allocated in extents, large sets of contiguous blocks ◦ Metadata often located in a single, central database such as the MFT in NTFS  Or, file systems can be inode-based ◦ UNIX and derivatives ◦ More flexible, but more overhead  Unix file systems usually come in two layers:  Disk layout  Veneer layer ◦ Allows splitting kernel into file-system dependent and non-file system dependent part

 Allocation of disk space to files is done with blocks.  Choice of block size is fundamental ◦ Block size small: Needs to store much location information ◦ Block size large: Disk capacity wasted in partially used blocks (at the end of file)  Typical Unix block sizes are 4KB and 8KB

 Inodes are fixed sized metadata describing the layout of a file  Inode structure: ◦ i_mode (directory IFDIR, block special file (IFBLK), character special file (IFCHR), or regular file (IFREG) ◦ i_nlink ◦ i_uid (user id) ◦ i_gid (group id) ◦ i_size (file size in bytes) ◦ i_addr (an array that holds addresses of blocks) ◦ i_mtime (modification time & date) ◦ i_atime (access time & date)

 Metadata in Inode is space-limited ◦ Number of block addresses in a single inode only suffices for small files ◦ Use (single and double) indirect inodes to find space for all blocks in a file

 Unix File Systems use inode numbers to refer internally to files. ◦ Classical Unix used a file table to mediate between users and their open files. ◦ File table have references to the inodes of open files.  General design ◦ Need to find free blocks: e.g. block bitmap ◦ Need to find free inodes: e.g. inode bitmap ◦ Inodes are located often in a designated area of the disk partition. (Inode Table) ◦ Data blocks often located in a designated area of the disk partition. ◦ Since this can create long actuator movements between metadata lookup and data block lookup, use Block Groups in EXT2  Divide partition in groups, where each group has this structure

 On-Disk Layout.  Superblock contains data on the file system.

 Disk Layout not uniform.  Ext2 (Linux) file system layout.

 Overview

 Ext superblock: ◦ Located 1024 B from start of the file system. ◦ Backups of superblock are usually stored in the first block of each block group. ◦ Contains basic information:  Block size  Total number of blocks  Number of reserved blocks

ByteDescription 0-3BNumber of inodes in file system 4-7BNumber of blocks in file system 8-11BNumber of blocks reserved to prevent file system from filling up 12-15BNumber of unallocated blocks BNumber of unallocated inodes BBlock where block group 0 starts 24-27BBlock size. (Saved as the number of places to shift 1,024 to the left) BFragment size. (Saved as the number of places to shift 1,024 to the left) BNumber of blocks in each group BNumber of fragments in each block group 40-43BNumber of inodes in each block group BLast mount time BLast written time BCurrent mount time BMaximum mount count

ByteDescription 56-57BSignature 0xef BFile system state 60-61BError handling method 62-63BMinor Version 64-67BLast consistency check time BInterval between forced consistency checks 72-75BCreator OS 76-79BMajor version 80-81BUID that can use reserved blocks BGID that can use reserved blocks BFirst non-reserved inode in file system 88-89BSize of each inode structure 90-91BBlock group that this superblock is part of (if this is the backup copy) 92-95BCompatibility feature flags 96-99BIncompatibile feature flags

ByteDescription Read only feature flags File system ID Volume name Path were last mounted on Algorithm usage bitmap 204Number of blocks to preallocate for files. 205Number of blocks to preallocate for directories Journal ID Journal Inode Journal device Head of orphan inode list Unused

 Group Descriptor Table ◦ In the block following superblock ◦ Describes all block groups in the system

 Group Descriptor Table Entries ◦ 0-3 starting block address of block bitmap ◦ 4-7 starting block address of inode bitmap ◦ 8-11 starting block address of inode table ◦ number of unallocated blocks in group ◦ number of unallocated inodes in group ◦ number of directories in group

 Total number of blocks includes Reserved area and all groups.  Blocks per group determines size of group.

 Block Group Descriptor Table ◦ Located in block following the superblock ◦ Basic layout of a block group: ◦ Block bitmap takes exactly one block. ◦ Inode bitmap manages allocation status of inodes.

 Number of blocks = bits in bitmap = bits in a block (namely the bitmap block). ◦ Size of block determines number of blocks in a block group!  Inode bitmap starting address contained in block descriptor table.  Size of Inode bitmap given by #inodes per group divided by 8.  Block group descriptor table gives starting block for inode table.  Size of inode table = 128B * number of inodes.

 Boot Code ◦ If exists, will be in the 1024B before the superblock.  Many Linux systems have a boot loader in the MBR. ◦ In this case, there will be no additional boot code.

 Data stored in blocks. ◦ Typical block sizes are 1,024B; 2048B; or 4096B  Allocation status of a block determined by the group’s block bitmap

 Analyzing content: ◦ Locate any block ◦ Read its contents ◦ Determine its allocation status  First block starts in the first sector of the file system. Block size is given by superblock.

 Determining allocation status: ◦ Determine the block group to which the block belongs. ◦ Locate the groups entry in the group descriptor table to find out where the block bitmap is stored. ◦ Process the block bitmap to find out whether this block is allocated or not.

 To find all unallocated blocks: ◦ Systematically go through the block bitmap and look for 0 bit entries. ◦ Status of reserved sectors at the beginning is less clear since there are no bitmap entries for them.

 Metadata is stored in the inode data structure.  All inodes have the same size specified in the superblock.  Inodes have addresses starting with 1.  Inodes in each group are in a table with address given by the group descriptor. group = (inode – 1) / INODES_PER_GROUP

 Inodes 1 – 10 are typically reserved.  Superblock has the value of the first non- reserved inode. ◦ Inode 1 keeps track of bad blocks. ◦ Inode 2 contains the root directory ◦ Journal uses Inode 8 ◦ First user file in Inode 11, typically for lost+found

 Inode can store the address of the first 12 data blocks of a file.  For larger files, we use double indirect and triple indirect block pointers

 Allocation Algorithms ◦ Block group:  Non-directories are allocated in the same block group as parent directory, if possible.  Directory entries are put into underutilized groups. ◦ Contents of allocated inode are cleared and MAC times set to the current system time. ◦ Deleted files have their inode link value decremented.  If the link value is zero, then it is unallocated.  If a process still has the file open, it becomes an orphan file and is linked to the superblock.

 Inode Structure ◦ 0-1 File Mode (type and permissions) ◦ 2-3 Lower 16 bits of user ID ◦ 4-7 Lower 32 bits of size in bytes ◦ 8-11 Access Time ◦ Change Time ◦ Modification Time ◦ Deletion Time

 Inode Structure ◦ Lower 16 bits of group ID ◦ Link count ◦ Sector count ◦ Flags ◦ Unused ◦ 40 – direct block pointers ◦ single indirect block pointer ◦ double indirect block pointer

 Inode Structure ◦ indirect block pointer ◦ 100 – 103 Generation number (NFS) ◦ 104 – 107 Extended attribute block ◦ 108 – 111 Upper 32 bits of size / Directory ACL ◦ 112 – 115 Block address of fragment ◦ 116 Fragment index in block

 Inode Structure ◦ 117 Fragment Size ◦ 118 – 119 Unused ◦ 120 – 121 Upper 16 bits of user ID ◦ 122 – 123 Upper 16 bits of group ID ◦ 124 – 127 Ununsed

 Inode Structure ◦ Permission flags of the file mode field  0x001 Other – execute permission  0x002 Other – write permission  0x004 Other – read permission  0x008 Group – execute permission  0x010 Group – write permission  0x020 Group – read permission  0x040 User – execute permission  0x080 User – write permission  0x100 User – read permission

 Inode Structure ◦ Flags for bits 9 – 11 of the file mode field  0x200 Sticky bit (save text image)  0x400 Set Group ID  0x800 Set User ID

 Inode Structure ◦ File mode field  These are values not flags  0x1000 FIFO  0x2000 Character device  0x4000 Directory  0x6000 Block device  0x8000 Regular file  0xA000 Symbolic link  0xC000 Unix socket

 Time Values ◦ Are stored as seconds since January 1, 1970, Universal Standard Time ◦ Get ready for the Year 2038 problem.

 Linux updates (in general) ◦ A-time, when the content of file / directory is read.  For a file:  If a process reads the file.  When the file is copied.  When the file is moved to a new volume.  But not if the file is moved within a volume.  For a directory  When a directory listing is done.  When a file or subdirectory is opened.

 Linux updates (in general) ◦ M-time, when the content of file / directory is modified.  For a file:  If file contents change.  For a directory  When a file is created or deleted inside the directory.  When a file is copied, the M-time is not changed.  However, when a file is copied to a network drive, the network server might consider it a new file and reset the M- time to the current time.

 Linux updates (in general) ◦ C-time corresponds to the last inode change.  When file / directory is created.  When permissions change.  When contents change. ◦ D-time is set only if a file is deleted.  When a file is created, then D-time is set to 0.

 Unallocated inodes contain temporary data. ◦ M-, C-, D-time values might show when the file was deleted.  Users can change A- and M-time with the touch command.

 Linux fills slack space (unused bytes of block) with zeroes.  Data from deleted files will only exist in unallocated blocks.  File size and allocated blocks will probably be wiped from unallocated inode entries.

 Linux file hiding technique: ◦ Have a process open a file for reading or writing. ◦ Delete the file name. ◦ Link count for the inode is zero, but inode is not unallocated. ◦ The file system should add the orphan inode to a list in the superblock.

 Directory Structure ◦ A directory entry consists of  A variable length name.  The inode number with the metadata of the entry. ◦ The original byte allocation is as follows:  0-3 Inode value  4-5 Length of entry  6-7 Length of name  8- Name in ASCII

 Directory Structure ◦ The improved byte allocation is as follows:  0-3 Inode value  4-5 Length of entry  6 Length of name (up to 255 now)  7 File type  0 unknown  1 regular file  2 directory  3 character device  4 block device  5 FIFO  6 Unix Socket  7 Symbolic link  8- Name in ASCII

 The record entry length allows the file system to find the next entry in a directory.  If a directory entry is deleted, then the previous entries length is increased.

 When FS is created, a Linux user can decide to use hash trees instead. ◦ Directory entries are no longer in an unsorted list. ◦ A directory using a hash tree contains multiple blocks, the nodes in the tree.  First block contains the “.” and “..” directory entries.

 Links ◦ Hard link: an additional file/directory name.  Implemented by another directory entry pointing to the same inode.  Link count in inode is incremented.  Directory link count is  2 + number of subdirectories  File system cannot distinguish between the first and the second name of file.

 Links ◦ Soft link: an additional file/directory name.  Implemented by a directory entry pointing to another inode.  Inode points to a file, that contains the path to the original file.

 Mount Point Example ◦ FS1 has directory /dir1. ◦ If FS2 is mounted on /dir1 and a user changed into /dir1, then only FS2 is shown.

 EXT hiding technique uses a directory (containing the files to be hidden) as a mount point.  Forensics tools tend to not give mount points. ◦ Consequentially, this hiding technique falls flat for forensics tools.

 EXT3 journal located at inode 8 (typically)  Journal records transactions ◦ Block updates about to occur. ◦ Log of update after the fact.  Two modes: ◦ Only metadata blocks are journaled. ◦ Metadata and data blocks are journaled.

 Ext3 Journal gives additional information about recent events.

 stems/ext2fs/ stems/ext2fs/ 

 Maintaining consistency in file systems after a crash is difficult ◦ 1970s: Possible to read complete file system metadata and piece it together  Log Structured File System (Osterhoot, Mendelbaum, 1990) ◦ Maintain all data, including metadata in a single log ◦ Only write to the end of the log ◦ Currently not used, but idea appears always attractive  Journaling File System ◦ Maintain a log of all metadata changes. ◦ After a crash, find point in journal where the file system was consistent, then roll forward from there  Forensic potential of journaling file systems has not yet been realized

 The Coroner’s Toolkit (TCT) ◦  grave-robber  pcat, ils, icat, file  unrm and lazarus  Mactime  TCTUtils (Brian Carrier) ◦  Sleuth Kit (Brian Carrier) ◦  Autopsy Forensics Browser ◦ GUI for TCT and TCTUtils ◦  Commercial tools (Encase, FTK, … )