Week 4
Week 4
>> In last unit, we reviewed Linux/Unix file systems and used Sleuthkit as an
example to find
out how a forensic analysis tool retrieves data in Linux/Unix file systems.
This week we will study where data commonly hides in Linux/Unix file systems
and how to utilize forensic analysis technologies to find evidence for
investigation.
We will focus on Linux/Unix files such as password file, log files, history files,
hidden files, set UID/set GID files, recently modified binaries,
recently created and deleted files, among others.
I will also introduce analysis utilities, including keyword search,
hash analysis, and the data carving.
Remember, we will always work on image copies of the original drive.
We start an analysis by examining the partition table on a suspect drive
to learn how many partitions exist on the drive, whether each partition is mounted,
and if there are any data hidden in between the partitions.
We then examine all pertinent information, including files, deleted files, emails,
pictures, visited websites, etc. We will put the MACTIMEs in a timeline sequence
to tie events together, to get a better understanding of what has happened.
Whenever we have a keyword, for example, names of the suspects who are involved in
the case
or IP addresses that the suspect machine connected and communicated with,
we conduct a keyword search using these terms to search for clues.
There are many sophisticated forensic analysis tools to facilitate analysis.
Forensic investigation demands not only knowledge but also experience,
reasoning, and communication skills.
Before we directly dive into GUI-based advanced forensic analysis tools,
let's go through some basic tools and the steps to understand what is going
on behind this well-known GUI-based forensic tools.
When we seize a suspect machine or laptop, how do we know the drive has not been
swapped?
CyanLine LLC discovered that most of hard drives have a built-in self-monitoring
analysis
reporting tool, short for SMART.
They can reveal the exact number of times that the examined hard drive has been
turned on
and the exact number of hours that the suspect hard drive has been used inside
computer.
SMART was developed by hard drive manufacturers to help drive owners
to assess their drive's physical usage; however, it can provide computer forensic
examiners
with crucial information in some scenarios.
For example, assume you seize a two-year-old laptop and you found
that the hard drive disc does not contain a reasonable amount
of data for a two-year-old drive.
Although the suspect explained, "I reinstalled my computer," it becomes pretty
clear
that the owner had swapped out the hard drive if you use SMART tool.
We start our forensic analysis by identifying partitions from a drive image.
We could use the Linux/Unix tool FDISK to show the partition information; however,
FDISK displays the start and endpoint of a partition in the unit of cylinders.
In our example /dev/hda1 starts at the first cylinder and ends at 990 cylinder.
If we use dd to carve out this partition, you have to convert values
from cylinders to 512-byte sectors.
Media management LS or MMLS from Sleuthkit is designed
to display partition information in the unit of 512-bytes sector.
Given a disc image, MMLS will interpret MBR to display all the partition entries
information
that can be easily used by dd to carve out partitions.
It also works for the GUID partition table GPT.
Next we will mount partitions to start analysis.
Everyone should be familiar with the Linux/Unix command mount.
Here I will emphasize a couple of key options for forensic analysis purpose.
Assume my hda1.dd is a dd raw image file representing a partition.
The command shown here will mount my hda1.dd to a mount point /mnt/hacked.
The option read-only, ro, has to be used to prevent mount from modifying anything.
Since my hda1.dd is a file, not a device, we need to use the root back device
option.
Note that with most sophisticated forensic analysis tools,
mounting will be done automatically.
>> We have learned in this unit that MAC times are the timestamps
of the latest modification, access, and INODE changing time.
In first part of this demo, let's look at what actions will make MAC times change.
And then in the second part of this demo-- and I will use Sleuth Kit MAC time
command
to create the timeline of a file.
So, first, let's look into the MAC time.
Now, I'm inside of a temp directory, currently has nothing in the temp directory
and let me create a file and I can use touch to create a file.
Now, touch is an interesting command.
OK? If my file is a new file, if you touch it, it will create it
and with all the timestamps be the-- what the time--
the time when we-- I run this touch command.
If I touch an existing file and I will not change any of the existing file's
content,
but that file's modification and access time change to the current time.
Since my file is new, so we should now see it.
It's created.
Size is zero because touch does not really modify-- not touch upon the content.
So, for this one, the timestamp for LS list one of the timestamp by default.
By default is MAC time and then you can use LS--
you can use LS which was the other option to list the access time and changing
time.
But here I use stat.
OK. Use stat to show you all of the timestamps.
And normally I say there's three timestamps, sometimes they also add the fourth
one, born.
When was the file created?
OK. In Windows case, we will often see there's four timestamps.
I will talk about that later.
So, here both access time, modification time, change time, they are all same as
this.
The current time.
OK. Now, I-- if I say more, my file, and we wait for a couple seconds because I
want
to see what-- second-- after a couple seconds and which timestamps change.
OK. That should be enough.
If I do more, so to read this file content, all right, to read this file content,
see whether I can change anything,
but now currently I don't have anything to read, but anyway I do more.
My file. Certainly, the content has nothing, but now if we do stat again,
let's compare the stat with the previous case.
All right.
So, the access time changed now.
The access time now is 43:21 and all the other ones, the modification time
and then the changing time remained the same.
Remained the same.
OK? So, those did not change.
So, if you read a file without modify anything and only the access time changed.
Only the access time changed.
Now let's do modified content.
OK. I'm going to do it in a lazy way and I say echo hello and append-- oops, not
too many.
Append that to my file.
So, I modified the content.
Now, original does nothing that current now.
If you look into that, I cannot do more because it will change timestamp.
So, now I did-- only did one action.
I said modify the content.
Let's do a stat again.
Now, in this case, the access time remained the same.
Remained the same as previous one when we did more.
OK? And then this-- the changing time
and the modification time changed after I do changing the content.
OK? So, that's how-- you can try all that at home to find
out which action really changed which timestamp.
All right?
And then how about I use touch?
If I use touch to the existing file, it will change two timestamps.
One is the modification and one is the access.
All right?
Those timestamps can be changed.
If you don't specify any data format, then it will change to current time,
but then attacker said I want to change to whatever the date time I want because
they want
to change-- go back to the date time to hide information.
To pretend this file has never been changed.
So, we know if you touch a file, existing file,
you will change the timestamp to be the current time.
For example, if I touch my file again and I do stat my file,
then all the timestamps will change to the current time.
Now, if attacker want to modify intentionally for a given timestamp, whether they
can do that.
Now, the best way is you use the main page.
Main. Touch to learn what is-- if commands the function.
Each function actually-- they do provide main instructions.
So, it tells you what is the touch and what are the options.
If you look into that, you can change the access time, use dash A. So,
if I only want to change the access time, then you change dash A
and then you can also change the-- dash M is the modification time.
OK? Dash M change only the modification time.
Touch does not allow you to change the changing time by providing a certain time,
so you can only intentionally change access time and the modification time.
You can even give out certain data format for the date and time you want to change.
All right.
Let's quit and come back to the touch command.
Now, if we do touch, we only want to change access time.
OK. And we want the time-- the date time looks like going back.
That's today, 17.
January 31st.
At certain time.
Whatever I make up.
OK? Certain time.
And to make this change for my file.
Now, if you do the stat again, you will see the access time intentionally changed.
Changed to the time I specified in the command.
And you can do that for dash M, modification time, as well.
But you cannot intentionally change the changing time.
OK. So, that's the first part.
And then next part-- let's get back to MAC time.
So, in the previous video demo, I create-- use FLS and ILS created two bodies
and when we run FLS and ILS and I intentionally use the dash M option,
which it says to create a body file for MAC time.
So, MAC time has to rely on a body file and it only sorts the body file to--
based on the times-- based on the time, that's why it's called the time-- back
times.
So, if you look at my desktop here, I have two files.
This file I created use FLS and ILS.
If you forgot how do I did-- how did I get those files,
you can go back to the Sleuth Kit command line demo to find out how did I get those
two files.
I will not repeat the process here.
So, now with those two files here, it is very easy for me to use the MAC time.
To use MAC time to sort this file.
OK. So, the command I run is MAC time and, once again,
if you don't know how this MAC time work, do a main MAC time.
OK? To understand how does-- how to run this MAC time.
The option is very simple because it requires have a body file.
So, dash B means body.
Then I grab in one here.
So, this is the body file I want to create.
Now, if I push enter, that will-- the output will be on the screen, but I want to
redirect.
And then one more option I would like to add is dash D, which says--
puts a deliminator [phonetic] as a comma separate.
It's for easy for me to read later on then I create a file called MAC time FLS.
I want to give myself meaningful information.
And I give it to be CSV and to be easy to open it up.
OK. So, let's create that.
OK. So, this file created, now let's open it.
So, if-- now if you look into it, it give you very clear information about this is
the time.
So, here this happened at the same time what happened.
OK? So, this is the-- at this particular time, those files changed.
This file changed MAC time.
Now, I have already talked about that, the MAC here,
and then now in this case it uses four timestamps, MAC and the birth.
OK? If there's a dot, means M. M does not change here.
M is changing later.
You will find the same file name and then modified later, but in this case, only
access.
Last access is here.
So, this file actually never be accessed again in the later
because that's the latest access time.
Late access time.
And then for this file, for example, last modified
and the last changed time is at this particular second.
That means it will never be modify and then change again later, but it is accessed
later.
It is accessed later.
So, that's why the A is missing.
OK. So, in this way, it's very easy to sort it on the-- based on the sec time--
date time and then back to seconds-- sort all of the information.
If you see the same seconds happen-- have a long, long chunk happened in the same
second,
that means some nonhuman action happened, like compile and all those actually
happened
and you should pay attention to it.
And, definitely, we also create last time--
we also created the ILS body and you can use MAC time the same way
to create CSV file and to look at the ILS body.
So, then for that file, the difference between FLS is this file does not--
the ILS body does not contain file name information.
That's the only difference.
All right.
So, I will stop here.
Hope for-- hopefully you enjoy it.