Difference between pages "Evolution Header Format" and "USB History Viewing"

From Forensics Wiki
(Difference between pages)
Jump to: navigation, search
 
(Updated formatting)
 
Line 1: Line 1:
<pre>
+
Microsoft [[Windows]] operating systems records artifacts when USB removable storage devices (thumb drives, iPods, digital cameras, external HDD, etc.) are connected to the system.
Subject: header test
+
From: Username <username@sendinghost.com>
+
To: Username <username@receivinghost.com>
+
Content-Type: text/plain
+
Date: Sat, 28 Jul 2007 11:52:35 +0200
+
Message-Id: <1185616355.19231.0.camel@localhost>
+
Mime-Version: 1.0
+
X-Mailer: Evolution 2.10.1
+
Content-Transfer-Encoding: 7bit
+
</pre>
+
  
Code responsible for generating Message-ID:
+
== Plug and Play Manager ==
<pre>
+
camel_header_msgid_generate (void)
+
{
+
        static pthread_mutex_t count_lock = PTHREAD_MUTEX_INITIALIZER;
+
#define COUNT_LOCK() pthread_mutex_lock (&count_lock)
+
#define COUNT_UNLOCK() pthread_mutex_unlock (&count_lock)
+
        char host[MAXHOSTNAMELEN];
+
        char *name;
+
        static int count = 0;
+
        char *msgid;
+
        int retval;
+
        struct addrinfo *ai = NULL, hints = { 0 };
+
  
        retval = gethostname (host, sizeof (host));
+
When a USB removable storage device is connected to a Windows system for the first time, the Plug and Play (PnP) Manager receives the event notification, queries the device descriptor for the appropriate information to develop a device class identifier (device class ID) and attempts to locate the appropriate driver for that device.
        if (retval == 0 && *host) {
+
                hints.ai_flags = AI_CANONNAME;
+
                ai = camel_getaddrinfo(host, NULL, &hints, NULL);
+
                if (ai && ai->ai_canonname)
+
                        name = ai->ai_canonname;
+
                else
+
                        name = host;
+
        } else
+
                name = "localhost.localdomain";
+
  
        COUNT_LOCK ();
+
Looking for and installing the correct driver for the device is recorded in the [http://www.microsoft.com/whdc/driver/install/setupapilog.mspx setupapi.log] file.  For example:
        msgid = g_strdup_printf ("%d.%d.%d.camel@%s", (int) time (NULL), getpid (), count++, name);
+
        COUNT_UNLOCK ();
+
  
        if (ai)
+
    [2007/06/10 21:25:41 1140.8 Driver Install]
                camel_freeaddrinfo(ai);
+
    #-019 Searching for hardware ID(s): usbstor\disksandisk_u3_cruzer_micro_3.27,...
  
        return msgid;
+
This provides the date and time that the removable storage device was first connected to the system.  The Windows system will also create an entry in the Registry beneath the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR\ key using the device class ID:
}
+
 
</pre>
+
    Disk&Ven_SanDisk&Prod_U3_Cruzer_Micro&Rev_3.27
 +
 
 +
This identifies the class of the device.  Beneath this Registry key, a unique instance ID key will be created, using either the serial number retrieved from the device's device descriptor (you can use [http://www.microsoft.com/whdc/device/stream/vidcap/UVCView.mspx UVCView] to view the contents of the device descriptor), or, if the device does not have a serial number, using an identifier generated by the system itself (based on additional information retrieved from the device descriptor, the USB port the device was plugged into, etc...the vendor has not publicized the algorithm used to generate this identifier).  For example:
 +
 
 +
    0000161511737EFB&0
 +
 
 +
Note: If the second character of the unique instance ID is a '&', then the ID was generated by the system, as the device did not have a serial number.
 +
 
 +
== Device Information ==
 +
 
 +
Beneath this key are several Registry values that provide information about the device itself.  Of particular note is the ParentIdPrefix value; this value can be used to map to the MountedDevices Registry key in order to identify the drive letter to which the device was mounted.  Beneath the MountedDevices Registry key are several values, all of which are REG_BINARY data types.  With RegEdit open, select one of the values that begins with "\DosDevices\" and includes a drive letter.  The value selected should be one whose data begins with "5C 00 3F 00 3F 00".  Right-click the value name and choose "Modify".  When the "Edit Binary Value" dialog appears, you will see the binary data displayed as if it were viewed in a hex viewer.  On the right-most column, you should see what appears as:
 +
 
 +
    \??\STORAGE#RemovableMedia#'''7&2c9a320d&0'''&RM#{53f5630d...
 +
 
 +
The portion in bold is the ParentIdPrefix for the device.
 +
 
 +
In order to determine the last time the device was connected to the system, we have to navigate to the following Registry key:
 +
 
 +
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses
 +
 
 +
Beneath this key are two other keys of interest:
 +
 
 +
    {53f56307-b6bf-11d0-94f2-00a0c91efb8b}
 +
 
 +
and
 +
 
 +
    {53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
 +
 
 +
These are Device Class GUID keys for Disks and Volumes, respectively.  Beneath the Disk GUID key are several subkeys that appear as follows (the key name is wrapped):
 +
 
 +
    ##?#USBSTOR#Disk&Ven_SanDisk&Prod_U3_Cruzer_Micro&Rev_3.27#'''0000161511737EFB&0'''
 +
    #{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
 +
 
 +
The bold portion of the key name is the devices unique instance ID, which in this case, is also the device's serial number.  Similarly, the Volume GUID key contains subkeys for each volume that was mounted on the system, and those subkey names appear as follows:
 +
 
 +
    ##?#STORAGE#RemovableMedia#'''7&2c9a320d&0'''&RM#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}
 +
 
 +
The bold portion of the key name is the ParentIdPrefix value for the device.
 +
 
 +
To determine when the device was last connected to the system, obtain the LastWrite time value from the respective Disk and Volume GUID Registry keys for the device.
 +
 
 +
 
 +
== External Links ==
 +
 
 +
[http://www.nirsoft.net/utils/usb_devices_view.html USBDeview] is a tool that automates the viewing of USB device history for Windows 2000/XP/2003/Vista systems. It can recover the device name, description, last plug/unplug date & time, and serial number.
 +
 
 +
[[Category:Howtos]]

Revision as of 08:09, 21 August 2007

Microsoft Windows operating systems records artifacts when USB removable storage devices (thumb drives, iPods, digital cameras, external HDD, etc.) are connected to the system.

Plug and Play Manager

When a USB removable storage device is connected to a Windows system for the first time, the Plug and Play (PnP) Manager receives the event notification, queries the device descriptor for the appropriate information to develop a device class identifier (device class ID) and attempts to locate the appropriate driver for that device.

Looking for and installing the correct driver for the device is recorded in the setupapi.log file. For example:

   [2007/06/10 21:25:41 1140.8 Driver Install]
   #-019 Searching for hardware ID(s): usbstor\disksandisk_u3_cruzer_micro_3.27,...

This provides the date and time that the removable storage device was first connected to the system. The Windows system will also create an entry in the Registry beneath the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR\ key using the device class ID:

   Disk&Ven_SanDisk&Prod_U3_Cruzer_Micro&Rev_3.27

This identifies the class of the device. Beneath this Registry key, a unique instance ID key will be created, using either the serial number retrieved from the device's device descriptor (you can use UVCView to view the contents of the device descriptor), or, if the device does not have a serial number, using an identifier generated by the system itself (based on additional information retrieved from the device descriptor, the USB port the device was plugged into, etc...the vendor has not publicized the algorithm used to generate this identifier). For example:

   0000161511737EFB&0

Note: If the second character of the unique instance ID is a '&', then the ID was generated by the system, as the device did not have a serial number.

Device Information

Beneath this key are several Registry values that provide information about the device itself. Of particular note is the ParentIdPrefix value; this value can be used to map to the MountedDevices Registry key in order to identify the drive letter to which the device was mounted. Beneath the MountedDevices Registry key are several values, all of which are REG_BINARY data types. With RegEdit open, select one of the values that begins with "\DosDevices\" and includes a drive letter. The value selected should be one whose data begins with "5C 00 3F 00 3F 00". Right-click the value name and choose "Modify". When the "Edit Binary Value" dialog appears, you will see the binary data displayed as if it were viewed in a hex viewer. On the right-most column, you should see what appears as:

   \??\STORAGE#RemovableMedia#7&2c9a320d&0&RM#{53f5630d...

The portion in bold is the ParentIdPrefix for the device.

In order to determine the last time the device was connected to the system, we have to navigate to the following Registry key:

   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses

Beneath this key are two other keys of interest:

   {53f56307-b6bf-11d0-94f2-00a0c91efb8b}

and

   {53f5630d-b6bf-11d0-94f2-00a0c91efb8b}

These are Device Class GUID keys for Disks and Volumes, respectively. Beneath the Disk GUID key are several subkeys that appear as follows (the key name is wrapped):

   ##?#USBSTOR#Disk&Ven_SanDisk&Prod_U3_Cruzer_Micro&Rev_3.27#0000161511737EFB&0
   #{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

The bold portion of the key name is the devices unique instance ID, which in this case, is also the device's serial number. Similarly, the Volume GUID key contains subkeys for each volume that was mounted on the system, and those subkey names appear as follows:

   ##?#STORAGE#RemovableMedia#7&2c9a320d&0&RM#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}

The bold portion of the key name is the ParentIdPrefix value for the device.

To determine when the device was last connected to the system, obtain the LastWrite time value from the respective Disk and Volume GUID Registry keys for the device.


External Links

USBDeview is a tool that automates the viewing of USB device history for Windows 2000/XP/2003/Vista systems. It can recover the device name, description, last plug/unplug date & time, and serial number.