Professional Documents
Culture Documents
Irrespective of any file system, regardless of their name, they must perform certain basic
functions for the system:
NTFS, compared to the FAT file system, is more robust, providing stronger security, greater
recoverability, and better performance with regard to read, write, and search capabilities.
In an NTFS partition, unlike FAT, all the important file system data is contained in actual files.
NTFS uses many system files, but at the very heart of the NTFS system are $MFT (master file
table) and $Bitmap. $MFT is similar to the directory entry in FAT, and the $Bitmap is similar
to the FAT1 and FAT2 in FAT.
$MFT is a database with an entry for every file and directory in the partition, including an
entry for itself.
Source: http://technet.microsoft.com/en-us/library/cc781134%28v=ws.10%29.aspx
COMPONENT DESCRIPTION
NTFS BOOT SECTOR CONTAINS THE BIOS PARAMETER BLOCK THAT STORES INFORMATION ABOUT THE LAYOUT OF
THE VOLUME AND THE FILE SYSTEM STRUCTURES, AS WELL AS THE BOOT CODE THAT LOADS
WINDOWS SERVER 2003.
MASTER FILE TABLE CONTAINS THE INFORMATION NECESSARY TO RETRIEVE FILES FROM THE NTFS PARTITION,
SUCH AS THE ATTRIBUTES OF A FILE.
FILE SYSTEM DATA STORES DATA THAT IS NOT CONTAINED WITHIN THE MASTER FILE TABLE.
MASTER FILE TABLE COPY INCLUDES COPIES OF THE RECORDS ESSENTIAL FOR THE RECOVERY OF THE FILE SYSTEM IF
THERE IS A PROBLEM WITH THE ORIGINAL COPY.
Media
Descriptor
5. Total
Sectors
6. Logical
Cluster
Number for
the File $MFT 7. Logical
Cluster
Number for the
8. Clusters per File $MFTMirr
MFT Record
9. Index
buffer size
indicator
10. Boot
signature
Conclusions:
3. Bytes per Sector: The number of bytes per sector is 0x 02 00. (Translate from little endian),
or 512.
6. Logical cluster number for $MFT: 0x00 00 0C 00 00 00 00 00.On converting to little endian
becomes 0x0C 00 00, which is 786432 in decimal.
The Master File Table (MFT) is the heart of NTFS because it contains the information
about all files and directories.
Every file and directory has at least one entry in the table, and the entries are 1 KB in
size, but only the first 42 bytes have a defined purpose. MFT is divided into records of
the fixed size (usually 1 KB), and each record corresponds to some file.
The remaining bytes store attributes, which are small data structures that have a very
specific purpose. For example, one attribute is used to store the file's name, and
another is used to store the file's content. Figure below shows the basic layout of an
MFT entry.
In NTFS, everything is a file. The MFT is also a file. The most interesting thing in NTFS is
that the MFT has an entry for itself in the MFT. The first entry in the table is named
$MFT and it describes the on-disk location of the MFT. One basic concept for all
versions of NTFS is the MFT Zone. Windows creates the MFT as small as possible and
expands only when more entries are needed. Therefore, there is a risk that it could
easily become fragmented if the space after the MFT is allocated to a file. To prevent
this, Microsoft reserves part of the file system for the MFT. The MFT Zone is a
collection of consecutive clusters that are not used to store file or directory content
unless the rest of the disk is full. By default, Microsoft allocates 12.5% of the file system
to the MFT. If the rest of the file system fills up, the MFT Zone will be used.
The starting location of the MFT is given in the boot sector, which is always located in the
first sector of the file system.
The name of each file system metadata file begins with a "$," and the first letter is capitalized.
The first field in each MFT entry is the signature, and a standard entry will have the ASCII string
"FILE." If an error is found in the entry, it may have the string "BAAD."
STORING & DELETING A FILE
To store a file on the system, the following processes are carried out, though not necessarily in
the order shown:
To delete a file on the system, the following processes are carried out, though not necessarily
in the order shown:
Elements such as the file's name, its security information, and even its data, are all file
attributes.
Each attribute is identified by an attribute type code and, optionally, an attribute name.
When a file's attributes can fit within the MFT file record, they are called resident attributes.
For example, information such as filename and time stamp are always included in the MFT file
record.
When all of the information for a file is too large to fit in the MFT file record, some of its
attributes are nonresident. The nonresident attributes are allocated one or more clusters of
disk space elsewhere in the volume.
If all attributes cannot fit into one MFT record NTFS creates additional MFT records and puts
the Attribute List attribute to the first file's MFT record to describe the location of all of the
attribute records.
Directories are dealt with in a similar manner. If the directory listing (which is similar to a text
file) can be accommodated within the MFT record then it becomes resident data.
It is possible that the MFT record retains some entries as resident and some entries as non-
resident. Non-resident data is stored out on the volume in “Index Buffer” files.
These do not appear as files to the operating system or, indeed, to forensic software.
These files start with the keyword “INDX” and are laid out internally in a similar manner to
MFT records using attributes.
To solve this problem, NTFS provides two locations where attribute content can be stored. A
resident attribute stores its content in the MFT entry with the attribute header. This works
for only small attributes. A non-resident attribute stores its content in an external cluster in
the file system. The header of the attribute identifies if the attribute is resident or non-
resident.
If an attribute is resident, the content will immediately follow the header. If the attribute is
non-resident, the header will give the cluster addresses.
Nearly every allocated MFT entry has a $FILE_NAME and a $STANDARD_INFORMATION type
attribute.
Every file has a $DATA attribute, which contains the file content. If the content is over roughly
700 bytes in size, it becomes non-resident and is saved in external clusters.
When a file has more than one $DATA attribute, the additional attributes are sometimes
referred to as alternate data streams (ADS). The $DATA attribute can store any content that
an application or user wants to store there.
Every directory has an $INDEX_ROOT attribute that contains information about the files and
subdirectories that are located in it.
PARTITION TABLE
VOLUME
BOOT SECTOR MORE FILES
MFT METAFILES
VOLUME BOOT
MORE FILES
SECTOR
$ MFT
$MFTMirr
$Logfile
$Volume
$Secure
$Upcase
$Extend
MFT ATTRIBUTES
VOLUME BOOT
MORE FILES
SECTOR
NTFS FILE SYSTEM For example, consider MFT entry 313 with a
sequence number of 1. The file that allocated
entry 313 is deleted, and the entry is reallocated
to a new file.
VOLUME MORE FILES When the entry is reallocated, it has a new
BOOT SECTOR sequence number of 2. The MFT entry and
sequence number are combined, with the
sequence number in the upper 16-bits, to form a
64-bit file reference address
FREE MORE
HIDDEN COPY
SPACE MFT FREE
METADATA
FREE OF VOLUME
SPACE SPACE BOOT SECTOR
Microsoft uses a method called a ‘Fixup‘ to verify that the sectors it is reading are free from corruption.
Here is how it works:
The offset to the Update Sequence Array in this particular case is 30h or 42 decimal. If you look 42
bytes from the beginning of the sector you will see a two byte number. This number is also written at
byte offset 1FEh or 510 decimal. If the sector is valid then these two numbers should match. If you take
a look at the second sector of the MFT record at offset 510 you should see that number again. So the
number at offset 42 was taken and written to offset 510 for the first and the second sector of the MFT
record.
2. OFFSET TO
10. ALLOCATED SIZE
UPDATE SEQUENCE
1. MFT RECORD OF MFT ENTRY
SIGNATURE
7. OFFSET TO
FIRST ATTRIBUTE
8. FLAGS
(IN-USE AND DIRECTORY)
-Record identifier 'FILE'. If the entry is unusable the record identifier would be
'BAAD'.
-30 00: This output is in little-endian ordering, so we need to reverse the order of
the numbers. So it becomes 00 30, which is 48 in decimal. This shows that the fixup array is
located 48 bytes (0x0030) into the MFT entry.
-03 00: This output is in little-endian ordering, so we need to reverse the order of
the numbers. So it becomes 00 03, which is 3 in decimal. This means that the array has three
values in it. The fixup array is used to validate sectors within the MFT record.
- Holds the sequence number of the logfile entry that tracks every change to the file. The
log records when metadata updates are made to the file system so that a corrupt file system
can be more quickly fixed.
-01 00: This output is in little-endian ordering, so we need to reverse the order of the
numbers. So it becomes 00 01, which is 1 in decimal. This means that this is the first time this
entry has been used.
6. BYTE RANGE-18-19: HARD LINK COUNT
-The link count shows how many directories have entries for this MFT entry. If hard links
were created for the file, this number is incremented by one for each link.
“NTFS-based links to a file on an NTFS volume. By creating hard links, you can have a single file
in multiple folders without duplicating the file. You can also create multiple hard links for a file
in a folder if you use different file names for the hard links. Because all of the hard links
reference the same file, applications can open any of the hard links and modify the file.”
-This is the first attribute for the file. All other attributes follow the first one, and we find
them by advancing ahead using the size field in the attribute header. The end of file marker
0xffffffff exists after the last attribute. If a file needs more than one MFT entry, the additional
ones will have the file reference of the base entry in their MFT entry.
-38 00: This output is in little-endian ordering, so we need to reverse the order of the
numbers. So it becomes 00 38, which is 56 in decimal. This indicates that the first Attribute
starts at byte offset 56.
- The two bytes, and in particular the byte at offset 22, refer to the current state of this
particular record. The possible values are: 00 00 = a deleted FILE record, 01 00 = a FILE record
in use, 02 00 = a deleted DIRECTORY record, and 03 00 = a DIRECTORY record in use.
- In this case we note that the value is 01 00 and that it is a FILE record in use.
9. BYTE RANGE-24-27: USED SIZE OF MFT ENTRY (i.e number of times this record has been
used)
-Indicates the “real” length of the file record. If this MFT record is the base entry for the
file then this field is zero: if the record is an extension then this field holds the base record
reference address. Here it is referred to here as the “logical size”. This “logical” size is the
actual number of bytes of data stored in the record.
- B0 01 00 00: which becomes 00 00 01 B0; which equates to 432 in decimal. Therefore it
can be concluded that the entry size is 432 bytes.
- indicate the allocated storage size of the file record. This is referred to as the “physical”
size and this size has already been preset to 1024 bytes by the BPB.
-00 04 00 00:In this case translation from the little endian format gives
00000400h,which does indeed equate to 1024 decimal.
9. BYTE RANGE- 32-39: FILE REFERENCE TO BASE FILE RECORD (BASE FILE REFERNCE)
- It is used when the record to be stored exceeds the allocated space of one or more
MFT records.
-
EXAMPLE
Figure given above shows two word file created on a NTFS pen drive with a cluster size of
1024 KB.
When en viewing an MFT record with a hexadecimal editor, such as WinHex, the data is
displayed in little endian format, meaning it’s read from right to left. For example, the
hexadecimal value 40 0 is displayed as 00 04 00 00, and the number 0x40000 is displayed as
0 0 00 0 4 00.
STEP 1
1. Open the NTFS formatted pen drive in Winhex using the Logical View.
2. The disk opens in logical view and following files as shown below are found to be on the
disk.
STEP 2.
In order to find out the file record in the $MFT for the file READ ME.docx, first select the file
READ ME.docx and then right click on it, then click on Navigation Go to File Record. This
opens up the File record for the file READ ME.docx as shown below.
NOTE: The header describes the properties of the record, and the attributes describe all aspects of
the file from its name to its data.
STEP 3
A
B C
D
From figure 1, it is clear that byte 20-21 points to the starting of the first attribute for the file.
Here the data is stored in little endian, so 38 00 h becomes 00 38 h which is 56 in decimal. This
indicates that the first Attribute starts at 0038 h which is byte offset 56.
$STANDARD_INFORMATION HEADER.
ATTRIBUTE ID
FIGURE 2 LENGTH OF ATTRIBUTE
Figure 2 shows us the length of attribute as 96 bytes. i.e. 96 bytes on from the beginning of
this Attribute (offset 56), at byte offsets 152 to 157, are the four values 30 00 00 00h. This is a
set of four bytes which should be another Attribute ID.
As shown in figure 3, at byte 64 is the resident/non-resident flag. This is signified by 00h for a
resident Attribute and 01h for a non-resident Attribute.
FIGURE 4
LENGTH OF NAME OF ATTRIBUTE.
In figure 4, offset 65 the length of the name of the Attribute. In this case the length is zero,
since this Attribute is not allocated a name.
FIGURE 5
OFFSET TO NAME OF ATTRIBUTE.
As shown in figure 5, offset 66-67 indicate the offset value to the start of the Attribute proper.
FIGURE 6
FLAGS
Shown above, bytes 68-69 are identified as a set of flags which signify the following states:
00 00h = normal,
01 00h = compressed, 40
00h = encrypted &
80 00h = sparse.
FIGURE 7
FIGURE 8 LENGTH OF
ATTRIBUTE PROPER
As shown in figure 8, bytes 56-59 indicates length of attribute proper in little endian.
FIGURE 9
OFFSET TO START OF
ATTRIBUTE PROPER
The next two bytes: 60 -61, as shown in figure 9, indicates the offset from the beginning of
this Attribute to the start of the Attribute proper. This is where the Standard Information
Attribute details start, after the header. The value is 0018h which equals 24 decimal.
FIGURE 10
ATTRIBUTE HEADER
Here the attribute is Standard Information.
The attribute header is 24 bytes and the attribute is 72 bytes long. ATTRIBUTE PROPER
$Standard Information attribute proper.
$Standard Information attribute is always resident and contains the basic metadata for a file
or directory. It exists in every file and directory and is typically the first attribute.
Figure 11 given below shows the Data structure for the $STANDARD_INFORMATION attribute
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 FILE CREATION DATE & TIME LAST FILE ALTERED/MODIFIED DATE & TIME
1 LAST MFT RECORD MODIFIED/ALTERED DATE & TIME LAST FILE ACCESSED DATE & TIME
FIGURE 11
FIGURE 12
FIGURE 13
The first 32 bytes of this Attribute proper from byte offset 72 to byte offset 103 as
shown in figure 13 refer to four dates and times.
All dates and times are stored in the Win32 Filetime format.
This is a 64 bit number (held here in little endian format) that represents the
number of 100 nanosecond intervals that have elapsed since 00:00:00 GMT on 1
January 1601
Figure 14 given below shows how to configure Winhex to view the file creation
time, file modification, MFT RECORD MODIFIED/ALTERED time & file access time.
In order to view the date & time, the DATA INTERPRETER view of Winhex has to be
selected as shown in figure 14 given below.
Figure 14 showing how
to select the data
interpreter view of
Winhex
FIGURE 14
Since all dates and times are stored in the Win32 Filetime format, the Data
Interpreter also has to be configured to show the time in Win32 Filetime format.
Following show the steps to configure the Data Interpreter.
FIGURE 15
As shown in figure 15, in the data interpreter options select the Win32 FILETIME
(64 bit) check box & the Big Endian check box. This will interpret the selected data
in Win32 FILETIME format.
FIGURE 16
DATE: 30TH SEPTEMBER, 2013
TIME: 17:43:24 UTC
As shown in figure 12, bytes 72-79 provides the file creation time.
From Figure 16, on selecting the bytes form 72-79, the data interpreter shows the
file creation time in UTC. It is evident that the file Creation date is 09/30/2013 &
time is 17:43:24.
Similarly bytes 80-87 provide the file altered/modified date & time.
FIGURE 17
FIGURE 19
FILE ACCESSED DATE: 30TH SEPTEMBER, 2013
FILE ACCESSED TIME: 17:46:24 UTC
BYTES 72-29 FILE CREATION DATE AND TIME 30/09/2013 17:43:24 GMT FILETIME (local):
9/30/2013 11:13:24 PM
BYTES 80-87 FILES LAST MODIFICATION DATE & TIME 30/09/2013 17:46:24 GMT FILETIME (local):
9/30/2013 11:16:24 PM
BYTES 88-95 LAST MFT RECORD DATE & TIME 30/09/2013 17:46:25 GMT FILETIME (local):
9/30/2013 11:16:25 PM
BYTES 96-103 LAST FILE ACCESS DATE & TIME 30/09/2013 17:46:24 GMT FILETIME (local):
9/30/2013 11:16:25 PM
Figure 19 given below shows the FILETIME values of the selected bytes 72-79 using
FTK imager.
FIGURE 19
FIGURE 20
Archive Attribute
The archive attribute is used for backup. When a file is created, the archive bit is turned on, and when a program copies
the file, the archive bit is turned off. For example, the /m parameter in the Xcopy command in Windows turns off the
archive attribute. When the file is edited and saved again, the attribute bit is turned on.
$FILE_NAME Attribute
For a standard file or directory, this will be the second attribute and is always
resident.
The start of the File Name Attribute is signaled by the identifier 30 00 00 00h at
byte offset 144.
It is placed in an MFT entry to store the file's name and parent directory
information, and it is used in a directory index. When it is used in an MFT entry, it
does not contain any essential information, but it does when it is used in a
directory index.
FIGURE 21
STANDARD INFORMATION
ATTRIBUTE HEADER
STANDARD INFORMATION
ATTRIBUTE PROPER
FILENAME ATTRIBUTE
HEADER
Table given below shows the data structure of FILENAME attribute header.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
RESIDENT/N
LENGTH OF
ON OFFSET TO START OF
0 ATRIBUTE 1D LENGTH OF ATTRIBUTE NAME OF FLAGS NOT YET KNOWN
RESIDENT ATTRIBUTE PROPER
ATTRIBUTE
FLAG
PADDING
OFFSET TO START OF INDEXED
1 LENGTH OF ATTRIBUTE PROPER TO 8 BYTE
ATTRIBTE PROPER FLAG
BOUNDARY
FIGURE 22
OFFSET TO START OF ATTRIBUTE PROPER
LENGTH OF ATTRIBUTE PROPER
Here the length of attribute points to the length of the header & attribute
proper.
I.e. the attribute spans from offset 144 to offset 263.
i.e the attribute proper spans from offset 174 to offset 263.
Bytes 164 to 165- Offset to the start of attribute proper-00 18H=24.
i.e. 144+24=168. Starting from byte offset 168 is the File Name Attribute Proper.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
LENGTH NAME
4 OF TYPE NAME(VALIABLE LENGTH)
NAME
FIGURE 23
The $Data attribute proper has no specific
layout following the attribute header.
Starting from byte offset 168 is the File Name Attribute Proper. The first 8 bytes of
the Attribute are a reference to the parent directory.
Therefore, the parent directory is MFT entry 5, and its sequence is 5, which is the
entry for the root directory.
For further illustration, let us consider a file named diskeditor which is inside a
folder named New folder.
During investigation if it is required to find the file record of the directory in which
the file (diskeditor) exists, the offsets 168-175 provides the reference to the file
record of parent directory.
Following steps can be taken to find the file record of parent directory of the file
“diskeditor.exe”
STEP 1
For this right click on the file then go to Navigation->Go to file record.
FIGURE 24
STEP 2
FIGURE 25
As shown in figure 25, offsets 168-175 provides FILE REFERENCE OF PARENT
DIRECTORY.
Therefore the 37th File record is the file record of the parent directory of the file
“diskeditor”.
So if we navigate to File record nos. 37, we can find the file record of the parent
directory of the file “diskeditor”.
For finding the file record nos 37, go to Navigation -> Go to File Record.
FIGURE 26
Navigation to file record nos. 37 yields the following.
FIGURE 26
Name of the parent directory of the file “disk editor”
FIGURE 27
FIGURE 28
Similarly other FILETIME time stamps can be easily found by using the data
interpreter of WinHex.
Figure given below shows the ALLOCATED FILE SIZE (Physical file size).
FIGURE 29
Allocated file size
Byte offsets 208 to 215 as shown in Figure 29 are an 8 byte number specifying the
“physical” size of the file. In this case the “physical” size is 00 00 00 00 00 00 34
00h which is equivalent to 13312 bytes.
Figure Given below shows the REAL SIZE/LOGICAL SIZE OF FILE (size on disk)
FIGURE 30
FIGURE 31
FLAGS
Byte offsets 224 to 227 are stated to be “Flags”.
In this case 20 00 00 00h represents a file with the Archive bit set.
FIGURE 32
Length of file name in characters.
Byte offset 232 as shown in figure 32 is a one-byte field containing the length of
the filename in characters. In this case it is seen to be 0Ch, which is 12 decimal.
Inspection of the filename READ ME.DOCX reveals that the calculation to be
correct
Figure given below shows the Type of file name.
FIGURE 33
Type of file name
Byte offset 233 (black background) at Table 6.52 is a one-byte field that records
the type of the file name. In this case it is seen to be 01h, which indicates that it is
Win32 compliant according to the following table.
Note:
1. It should be noted that Unicode characters occupy 2 bytes but count as one character.
2. An examination of the MFT shows that where a file name is outside the constraints of
the 8.3 DOS name, then two File Name Attributes are present in the record; one
containing the Win32 Long File Name and one containing the DOS-compliant 8.3 file
name.
Figure below shows the Filename.
FIGURE 34
File name
As can be seen from figure 34, byte offsets 234 to 257 contain the file name, the
character length of which (12).
As mentioned earlier that if in case an examination of the MFT shows that where a
file name is outside the constraints of the 8.3 DOS name, then two File Name
Attributes are present in the record; one containing the Win32 Long File Name and
one containing the DOS-compliant 8.3 file name.
Figure given below shows the MFT record with two file name Attribute.
$DATA ATTRIBUTE
The $Data attribute has no specific layout following the attribute header.
However if the attribute is resident it will contain the file's data in its entirety, if
that data is small enough to fit within the MFT record, or if non-resident it will hold
one or more cluster start and length fields.
FIGURE 35
$FILENAME ATTRIBUTE
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 ATTRIBUTE ID ATTRIBUTE LENGTH RESIDENT/ NAME NAME FLAGS ATTRIBUTE
NON LENGTH OFFSET ID
RESIDENT (offset to
FLAG name of
attribute)
FIGURE 36
Figure 37 given below shows the data structure of the $DATA attribute header.
FIGURE 37
ATTRIBUTE ID END VIRTUAL
CLUSTER
NUMBER
START VIRTUAL ATTRIBUTE RESIDENT/NON NAME NAME FLAGS ATTRIBUTE ID
CLUSTER LENGTH RESIDENT FLAG LENGTH OFFSET
NUMBER
The first component declares how many bytes in the attribute field are
needed to store the values for the second and third components.
The second component stores the number of clusters assigned to the data
run.
The third component contains the starting cluster address value (the LCN or
the VCN)
Non-resident attributes are stored in a series of data runs, with each data run
specifying:
31 0D 3B FE 09
31 0D 3B FE 09