CSI Linux - Levels of Data Recovery and Imaging
CSI Linux - Levels of Data Recovery and Imaging
This lab will teach you about write blocking and forensic imaging.
Chain of Custody
Now you understand that data can be recovered, even from a formatted drive, what
next? Before you touch anything, you need to start a Chain of Custody. Even though you
may not be dealing with forensic investigations, getting in the habit of documenting
everything. This helps with logistics to make sure you know what you received and what
needs to go back. If you do find illegal content and it goes to court, if you treat it like a
“forensic” recovery, you will not have tampered with or destroyed the evidence.
A Chain of Custody is a comprehensive record that outlines each step in the transfer of
evidence, from the moment it is collected to the moment it is presented in court. The
chain of custody must include the names of the individuals who collected and handled
the evidence, as well as the date and time of each transfer. This documentation is
essential in establishing the authenticity and reliability of the evidence and is used to
prove that the evidence has not been tampered with or altered in any way.
For example, if the evidence is collected at a crime scene but is not properly documented,
it could be considered inadmissible in court. If the evidence is not properly packaged and
stored, it could also be considered inadmissible. Additionally, if the evidence is
transferred to someone who is not authorized to handle it, it could raise questions about
the authenticity of the evidence and lead to the evidence being excluded from the court
case.
Event Number:
Reason:
Submitting Individual: (Name/ID#)
Client:
Date/Time Seized:
Location of Acquisition:
Description of
Evidence
Item # Quantity Description of
Item (Model,
Serial #,
Condition,
Marks,
Scratches)
Chain of Custody
Item # Date/Time Released by Received by
(Signature & (Signature &
ID#) ID#)
Witness to Destruction of
Evidence
Signature: Date:
Technical Working Group on Biological Evidence Preservation. The Biological Evidence Preservation
Handbook: Best Practices for Evidence Handlers. U.S. Department of Commerce, National Institute of
Standards and Technology.
Within CSI Linux, there are several different templates to choose from and all of them
can be modified to fit your needs. Foe example, you can change the logo from the CSI
Linux logo to your agency or organization’s logo. You can modify the verbiage or change
the legalese.
Just be careful when modifying the document because there are preset variables on the
page. If you change or delete those, the data will no longer propagate in those fields.
To use the chain of custody template that is built into CSI Linux’s case management, you
need to Start a Case.
1. Open the case that you are currently working on or start a new case.
2. Left click on “Document Templates for the Case”.
3. Left click on Chain of Custody.
4. Fill in the with who is acquiring the evidence.
5. Left click OK.
You now have a Chain of Custody document that is filled in with the
agency/organization information, Investigator information, and the person that
acquired the evidence. After you are done filling in any other data, you can save it as a
PDF and print it for the case.
Before you do anything, you need to determine the intent and scope of the investigation or
recovery. You need to know what to find BEFORE you can find it. This only helps you. If they
want to recover family pictures, this will be your first target to recover. If the client wants
everything, you can hand the drive back and request payment for services rendered. If you
are recovering data for a forensic investigation, if there is no scope, there is no case. In the
United States, the 4th Amendment is clear “The right of the people to be secure in their
persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause, supported by Oath or
affirmation, and particularly describing the place to be searched, and the persons or things
to be seized”. It is always better to err on the side of caution.
Why are we talking about wiping or overwriting data before we even get to the imaging
portion? Logistically, you should always wipe your destination drive, especially if you
are copying from a disk to another disk. The reasoning behind this is to eliminate the
possibility of residual evidence or contamination residing on the destination drive that
could get misidentified in your current investigation. MAKE SURE YOU WIPE THE
RIGHT DRIVE!!! The wrong one could be your Operating System! Always verify!
Write blockers
Imaging a drive connected to a write blocker pr a “forensic bridge” using an imaging tool
is a process that allows a forensic analyst to create an exact bit stream copy, or forensic
image, of the drive for the purpose of forensic analysis. This process is crucial in order to
preserve the original evidence in its original state and prevent any changes from being
made to the drive.
I was told many years ago by a network engineer that you should never trust software to
do a hardware job. This was in reference to firewalls dealing with high throughput data,
but it applies to write blockers as well.
Think of it this way. A hardware write blocker was designed to copy data in one direction
and many times they are faster. Software write blockers have a tendency to break, have
vulnerabilities, misconfigured, and at the mercy of the Operating System (rootkits, API,
and system resource conflicts).
There are even forensic imagers that are minicomputers with write blockers built in with
the sole job of imaging. These are a Lot faster than imaging with a computer because
they have fewer bottlenecks with the flow of data.
First, print off a copy of the Chain of Custody included in this lab manual. Fill in everything
related to the “case”. Now you have your Scope and Chain of Custody, you can start to acquire
the physical evidence.
• Find a small USB drive. The smaller the better. The bigger the drive, the linger it will take to
image and the more space it will take on your destination media.
• Now, wipe that USB drive. Make sure to wipe the entire drive and not just the partition.
• Download a group of files to create a known baseline. When you know what files, you have
copied, you know what content should be recoverable. For example:
You can test the differences between the different tools and see the levels of recoverability
with each tool and method. If you don’t have an imager or will never image a drive, it is still
good to go through the basics, so you know how things need to work. You can also use an
image that was already taken from a drive. If you already have an image, skip to “File
Recovery Labs”.
Now, imagine you have a suspect drive and a hardware write blocker (aka: forensic bridge).
Make sure you read the different ports that the drive connects into, versus the output that
plugs into the computer.
Imagine that you need to write block and do NOT have a hardware write blocker. Your
workstation is a Linux system, and you still want to make sure you connect the evidence
drive in a forensically sound manner. The first thing you are going to have to do is log in
and make sure you have root privileges in Linux. You will also need access to a terminal
or a Command Line Interface “CLI” prompt.
• Insert the USB (below are multiple options in Linux to identify the right drive).
o Verify your USB device by typing “lsblk” and look for the sd(?) drive
o Verify your USB device by typing “df” and look for the sd(?) drive
o Verify your USB device by typing “dmesg | grep sd” and look for the sd(?) drive
o Verify your USB device by typing “ls /dev/sd*” and look for the sd(?) drive
This will mount the drive or make the drive usable as read-only to the folder:
“/media/usbdrive”. If the drive is already mounted, type:
Forensic imaging is the process of creating an exact copy of a computer's hard drive or
another digital storage device for the purpose of examination and analysis. This process
is used in criminal investigations, civil cases, and other legal proceedings where
electronic evidence may be relevant.
There are several steps involved in forensic imaging. First, the computer or storage
device to be imaged is connected to a forensic workstation, which is a specialized
computer used for this purpose. The workstation is configured to create an exact copy of
the hard drive or other storage devices, including all data, file structures, and metadata
(information about the data, such as creation and modification dates).
A forensic logical copy is a copy of data that is made using software that captures the
logical structure of the data. A forensic physical copy is a copy of data that is made using
hardware that captures the physical structure of the data.
Here are some examples of the differences between a forensic logical copy and a forensic
physical copy:
• A forensic logical copy of a hard drive might include the files and folders on the drive, as well
as metadata such as file names, dates, and permissions. A forensic physical copy of the same
hard drive might include the raw data on the drive, including deleted files and data that has
been overwritten.
• A forensic logical copy of a smartphone might include the apps, documents, and other data that
is stored on the device. A forensic physical copy of the same smartphone might include the raw
data on the device, including deleted data and data that has been overwritten.
• A forensic logical copy of a social media account might include the posts, interactions, and
other data that is visible to the user. A forensic physical copy of the same social media account
might include hidden data, such as deleted posts or data that is only visible to certain users.
Next, the forensic workstation creates a hash value for the original hard drive, which is
a unique numerical value that represents the data on the drive. The hash value is used to
verify the integrity of the forensic image, ensuring that it is an exact copy of the original
drive.
• A criminal investigation into a cybercrime, such as identity theft or fraud. The forensic image of
the suspect's computer can be analyzed to identify evidence of their involvement in the crime.
• A civil case involving the discovery of electronic evidence, such as emails or documents. The
forensic image of the relevant computer can be analyzed to identify relevant evidence.
• A child custody case in which electronic evidence, such as social media messages or text messages,
may be relevant. The forensic image of the relevant devices can be analyzed to identify this
evidence.
Imaging Process
Linux tools, such as dd, dcfldd, dc3dd, and Guymager are commonly used for forensic
imaging due to their flexibility and ability to create bit-level copies of storage devices.
These tools are free and open source, making them accessible to forensic analysts.
To image a drive connected to a write blocker using dd, the analyst would follow the
following steps:
• Connect the write blocker: The write blocker should be connected between the drive and the
forensic analysis computer. This will prevent any changes from being made to the drive during
the imaging process.
• Open a terminal: The analyst should open a terminal window on the forensic analysis
computer.
• Identify the drive: The analyst can use the "lsblk" command to identify the device name of the
drive. For example, the drive may be identified as "/dev/sdc".
• Create the forensic image: The analyst should enter the following command to create the
forensic image:
This command will create a forensic image of the drive and save it as a file called
"image.dd". It will also create hashes of the image using the MD5 and SHA-256
algorithms and save the hashes to a file called "hashes.txt".
Dcfldd is based off the dd command that can be used for forensic imaging. It has
additional features such as the ability to hash the image as it is being created, which can
be useful for verifying the integrity of the image. To create a forensic image using dcfldd,
the analyst would enter the following command:
Guymager is a free and open-source forensic imaging tool that is commonly used to
create forensic images of storage devices. In order to image a drive that is connected to a
write blocker using Guymager, the following steps can be followed:
Connect the write blocker to the forensic analysis computer and the storage device to the
write blocker.
It is important to note that the write blocker must be properly configured in order to
ensure that no changes are made to the storage device during the imaging process. This
is necessary in order to preserve the original evidence and maintain the integrity of the
investigation. Overall, using Guymager in conjunction with a write blocker is a reliable
and efficient way to create forensic images of storage devices for forensic analysis.
One way to perform forensic imaging of a Mac in target mode using Linux is to use the
dd tool. Dd is a command-line utility that allows the forensic analyst to create a bit-level
copy of a storage device. To create a forensic image of a Mac in target mode using dd, the
analyst would follow these steps:
• Connect the Mac to the forensic computer using a firewire or thunderbolt cable.
• Boot the Mac into target mode by holding down the "T" key during startup.
• On the forensic computer, open a terminal and enter the following command (assuming the
new drive is sdc):
This command will create a forensic image of the Mac's hard drive and save it as a file
called image.dd. The "bs" parameter specifies the block size, which determines the speed
of the imaging process.
Another tool that can be used for forensic imaging of a Mac in target mode is dcfldd.
Dcfldd is similar to dd but has additional features such as the ability to hash the image as
it is being created, which can be useful for verifying the integrity of the image. To create
a forensic image using dcfldd, the analyst would enter the following command:
This command will create a forensic image of the Mac's hard drive and save it as a file
called image.dd. It will also create hashes of the image using the MD5 and SHA-256
algorithms and save the hashes to a file called hashes.txt.
Once the forensic image has been created, it can be analyzed using a variety of forensic
tools. These tools can be used to search for evidence such as deleted files, internet history,
and system logs.
Encrypted dd or dcfldd
dd if=/dev/source
of=ssh://[user@]hostname[:port]/path/to/destination/image.dd
This command will copy the contents of the source hard drive to the destination.
Additionally, it can be used to compress the data being copied, such as by adding "bzip2 -
z" after the of= parameter.
You have already filled out the Chain of Custody and connected the drive in a forensically
sound manner. Now what? Well, Copy the data... Never analyze the original disk. Always
make at least two copies of the original evidence before you start to work with it.
Working on the original runs the risk of damaging the evidence and making it
inadmissible in court. The second copy is what you work with. The first copy, you put in
storage, so you do not have to touch the original again unless there is an emergency. It is
also suggested to make an MD5 hash along with a SHA hash of the original evidence and
each copy. A hash is a digital fingerprint that ads a level of trust that the data has not
changed during the usage.
There are two types of copies. There is a “Physical copy” (aka: bit stream, clone, image,
etc...) that duplicates allocated and un-allocated space. This means all data. You can
recover deleted content and even partially over written data. The other copy is called a
“Logical copy” (aka: backup, archive, file copy, dos copy, copy & paste, etc...). The most
forensically sound copy is of course a physical copy.
Most physical forensic imagers have write blockers built into them and it takes some of
the risk out of the equation. Just make sure to put the evidence drive as the source and if
you are imaging to another disk, that will be your destination. Too many people destroy
the evidence by attaching the wrong drive to the destination…
If you want to do your Imaging from a Windows computer, use FTK Imager. FTK Imager
has software write blocking built in, so you will not destroy the evidence, but your next
issue is the Operating System. Microsoft has had a history of trying to “help” the user
when a new drive is added by adding data to the drive. If this happens, the evidence is
destroyed due to contamination. To prevent this, use a physical write blocker. With that
said, FTK Imager can be downloaded from accessdata.com. You may have to register to
download the tool here: accessdata.com/product-download.
Example:
If you have the hardware, use it. Doing this will minimize the risk of destroying
evidence... Make sure you connect it to the right port. You do not want to wipe or
overwrite the evidence drive. Then follow the instructions provided by the forensic
imager vendor.
If you image the logical drive/volume/partition, you can mount the volume directly.
mkdir /mnt/evidence
sudo mount usb(?).dd /mnt/evidence
cd /mnt/evidence
ls
If you image the physical drive, all partitions, you can use losetup (losetup is used to
associate loop devices with regular files or block devices).