Stop, Drop and File Carve

Published: 2013-08-26
Last Updated: 2013-08-26 17:27:59 UTC
by Alex Stanford (Version: 1)
3 comment(s)

 

This is a "guest diary" submitted by Tom Webb. We will gladly forward any responses or please use our comment/forum section to comment publically. Tom is currently enrolled in the SANS Masters Program.

Recently, a friend of mine had a USB drive "die on him" and he wanted me to look at it. He needed to recover PDF, DOC and PPT files on the drive.  Fortunately, this drive did not appear to be damaged and I was able to access the physical disk but not the partition.  

For a Linux forensics distro to complete the project below, the SANS SIFT works great http://computer-forensics.sans.org/community/downloads

1. Image the drive

When doing forensic drive analysis you should always make a copy of the drive before you start analysis on the disk image and not the original. Using dcfldd for Linux or FTK Imager Lite for Windows will do the trick.  Check the output of dmesg to determine the device ID when plugging in the USB to your Linux VM.

#dmesg 
sd 32:33:0:0: [sdb] 4324088 512-byte hardware sectors (4043 MB)

Now that we have determined the physical device ID, lets output the file to /tmp/Broken-usb.001

#dcfldd bs=512 if=/dev/sdb of=/tmp/Broken-USB.001 conv=noerror,sync hash=md5 md5log=md5.txt

2. Troubleshoot the issue

Using the file command should show the partition information, but it does not.

# file Broken-USB.001
Broken-USB.001: data

MMLS results should also show us partition information, but again it doesn’t.

# mmls Broken-USB.001
Cannot determine partition type

Lets dump the start of the drive in hex and see if the drive is completely blank.

# xxd -l 1000 Broken-USB.001
0000000: 0600 0077 6562 6220 2020 2020 2020 2020  ..webb         
0000010: 2020 2020 2020 2020 2020 2020 2020 2020                  
0000020: 2020 2020 2020 2020 2020 2020 2020 2020                  
0000030: 2020 2020 2020 2006 0000 0000 0077 0065         ......w.e
0000040: 0062 0062 0020 0020 0020 0020 0020 0020  .b.b. . . . . . 

 

The drive does appear to have at least some data, but not a valid partition. It should be possible to pull files from the disk image. 

3. Determine what you want to recover

Many file types have specific headers and footers when the file is created. We can use this to our advantage and search for these specific hex values on disk.  Foremost is a tool that will use this technique for detecting file types. 

The command below takes the input file (USB.001) and outputs to (/tmp/dump). If you want to specify just a few file types use the –t option, if not default is all.

foremost -v -i Broken-USB.001 -o /tmp/dump

4. Review Files

Foremost will create a bunch of folders and each should contain files. Some file should be complete, but other will likely be partial or corrupted. 

 
3 comment(s)

Comments

How do I find mmls? It would be nice to list the package names of these tools you're using. dcfldd, mmls, xxd, and foremost don't come installed with every linux installation, y'know.
MMLS is available from the SleuthKit package. For Ubuntu use #apt-get install sleuthkit xxd foremost dcfldd. This will install all the needed packages.

For other distros, including CentOS, use http://www.sleuthkit.org/sleuthkit/download.php or use the SIFT referenced above.
[quote=comment#27119]How do I find mmls? It would be nice to list the package names of these tools you're using. dcfldd, mmls, xxd, and foremost don't come installed with every linux installation, y'know.[/quote]
If you want to find the location of various tools - especially the documentation, source code etc. there is an excellent website called http://www.google.com which is great for this.

Hope this helps,
Dom

Diary Archives