SANS Digital Forensics and Incident Response Blog

SANS Digital Forensics and Incident Response Blog

Digital Forensics: How to configure Windows Investigative Workstations

I like Windows. There... I said it. I understand that this statement will probably come with the requisite beatings, but I honestly enjoy using Windows on a day to day basis more than other operating systems and am willing to take whatever flack comes my way over it (and yes, my team at work loves to give me grief for it). But, I do recognize that out of the box Windows systems are not the most forensically sound environment - they love to automount drives, index files, and basically try to make your life easy. Normally this is a good thing, however, many of the things that Windows does for yourconveniencecan at best be an annoyance to your forensics workflow and at worst actually alter your evidence calling into question its integrity. Write blockers will prevent the accidental alteration of data, but sometimes you won't have a write blocker handy or you won't have a specific write blocker for the type of media that you need to image, so it is best to keep your system in a state that is as forensically safe as possible. Here are few tips and tricks for making that happen:

Disable Autorun/Autoplay

Disabling Autorun/Autoplay will prevent your system from automatically starting applications on removable/attachable media (if defined in an autorun.inf file). Microsoft has defined a specific Registry key to control the behavior of Autorun/Autoplay, which is respected in all of the modern Windows versions (2000/XP/2003/Vista/7). Also, in Windows 7/Vista, you can change the Autoplay settings through the control panel (you can find the settings under Hardware and Sound->Play CDs or other media automatically); however, I prefer to make this change in the Registry so that the process is consistent across Windows versions. It is important to note that Microsoft requires the installation of an update in order to correctly disable the Autorun/Autoplay functionality, specifically update 950582, 953252, or 967715 - see MSKB967715 for more information. Once you have installed the appropriate update(s) you'll want to completely disable Autorun/Autoplay functionality on all drives by setting the following Registry keys to 0xFF to fully disable Autorun/Autoplay:

  1. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun
  2. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\policies\Explorer\NoDriveTypeAutoRun
Make USB devices read-only

Another Registry modification can be made to instruct Windows to treat newly attached USB devices as read-only devices, preventing accidental writes. I am not advocating that this should replace a physical write blocker - in fact, there are several reports of Windows not respecting this setting and allowing writes to some USB devices (albeit, I have not directly observed this behavior). However, this setting can be implemented as part of a reasonable layered approach to help you prove that you were taking all steps possible to prevent accidental writes to attached evidence, etc.

To implement this feature, you'll need to make a few changes to your Registry, as follows:

  1. Open the Registry and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  2. If it doesn't already exist, create a new key called "StorageDevicePolicies".
  3. If it doesn't already exist, create a new Dword called "WriteProtect" and set the value to 1 (where 1 means that the OS will treat newly attached USB devices as read-only devices and 0 means writes are allowed).
Disable automount

Windows will gladly mount any newly attached storage devices for you, which can be a bad thing. I prefer to explicitly define what storage devices are mounted to my forensics workstation. To turn off the Automount feature, from a command prompt (with elevated privileges, if using Windows 7/Vista) either:

  • run diskpart and once at the prompt type: automount disable
  • or, run the standalone command: mountvol /N
  • or, set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MountMgr\NoAutoMount to 1 in the Registry (you'll see this entry change appropriately if you use one of the previously mentioned commands).
Once you have successfully disabled automount, you'll need to manually mount any storage devices that you'd like to interact with (currently mounted devices are not affected). To manually mount a storage device, you can use diskpart from a command prompt (again with elevated privileges, if using Windows 7/Vista). How to do this is not immediately obvious, so let me walk you through the procedure:

First, I run diskpart from an administrative command prompt and thenI want to list the currently attached drives so that I can figure out which drive I want to work with:

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 1024 KB *
Disk 1 Online 465 GB 1024 KB *
Disk 2 No Media 0 B 0 B
Disk 3 No Media 0 B 0 B
Disk 4 No Media 0 B 0 B
Disk 5 No Media 0 B 0 B
Disk 6 No Media 0 B 0 B
Disk 7 No Media 0 B 0 B
Disk 8 No Media 0 B 0 B
Disk 9 No Media 0 B 0 B

I attach the drive I want to work with and then rerun list disk command:

DISKPART> list disk

Disk ###  Status         Size     Free     Dyn  Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 1024 KB *
Disk 1 Online 465 GB 1024 KB *
Disk 2 No Media 0 B 0 B
Disk 3 No Media 0 B 0 B
Disk 4 No Media 0 B 0 B
Disk 5 No Media 0 B 0 B
Disk 6 No Media 0 B 0 B
Disk 7 No Media 0 B 0 B
Disk 8 No Media 0 B 0 B
Disk 9 No Media 0 B 0 B
Disk 10 Online 465 GB 5120 KB

You'll notice that a new disk has appeared at the bottom of the list (Disk 10). At this point I now know what disk I want to work with, but let's just do a quick sanity check to make 100% sure by selecting the disk and then getting details:
DISKPART> select disk=10

Disk 10 is now the selected disk.

DISKPART> detail disk

WD My Passport 071A USB Device
Disk ID: 66666666
Type : USB
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : UNAVAILABLE
Current Read-only State : Yes
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No

Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
---------- --- ----------- ----- ---------- ------- --------- --------
* Volume 5 Partition 465 GB Healthy Offline

The only volume on the drive that I just added is currently offline - good, Windows respected my request to not automount :). Now, let's mount the drive. I don't personally care what drive letter it gets, so I'm just using a vanilla "assign" command:
DISKPART> assign

DiskPart successfully assigned the drive letter or mount point.

Let's find out which drive letter was used:
DISKPART> detail disk
WD My Passport 071A USB Device
Disk ID: 66666666
Type : USB
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : UNAVAILABLE
Current Read-only State : Yes
Read-only : No
Boot Disk : No
Pagefile Disk : No
Hibernation File Disk : No
Crashdump Disk : No
Clustered Disk : No

Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
---------- --- ----------- ----- ---------- ------- --------- --------
* Volume 5 N New Volume NTFS Partition 465 GB Healthy

You'll find the drive letter listed in the Ltr column - looks like Windows decided to use N. And finally, to dismount the volume, we use the remove command:
DISKPART> REMOVE letter=N dismount

DiskPart successfully removed the drive letter or mount point.

DiskPart successfully dismounted and offlined the volume.

Disable search indexing

Hopefully you've disabled automounting, made USB devices read-only, and are using a hardware write-blocker. But, as part of a reasonable layered protection approach, you'll want to disable any automated indexing of any sort to prevent accidental alteration of MACB times.

To disable Search Indexing in Windows XP:

  1. Open the Services applet (services.msc).
  2. Locate and disable the Indexing Service (i.e. stop the service and set the startup type to be Disabled so that it won't run again).
To disable Search Indexing in Windows 7/Vista:
  1. Open the Services applet (services.msc).
  2. Locate and disable the Windows Search service (i.e. stop the service and set the startup type to be Disabled so that it won't run again).
Patching and verification

This may seem obvious, but a non-patched system is a vulnerable system and it is important that your system is kept up-to-date on the latest security patches. However, system patches can affect how the operating system functions, and thus it is important that after every patch cycle you verify that your configuration has been maintained and that your system still functions as expected. Develop a post-patching testing plan that you run each and every time you patch. Make sure to include steps that test any non-standard configurations, such as:

  1. Connect a storage device and make sure that it is not automatically mounted (verify from within diskpart).
  2. Connect a test USB storage device (that you know works appropriately with the settings applied in the previous step to make USB devices read-only) without a write blocker, mount it, and attempt to write a file to the drive. This should fail. Additionally, you can validate that system files on the drive (i.e. the FAT or MFT) are not modified.
  3. Insert media with a known Autorun/Autoplay functionality and make sure it does not automatically start when connected/inserted.
  4. Get a listing of running services (either through the GUI or on the command line with net start or sc query) and confirm that the search indexing service appropriate to your version of Windows is not running.
Implementing these changes to disable some of the default functionality within Windows is a nice way to increase the confidence you have in your Windows forensics environment. I've provided a few suggestions, but I'm sure there are more out there - are there any tips or tricks you'd like to share? Feel free to post a comment...

Derek Newton is a Senior Technical Security Engineer at Time Warner Cable on the Security Incident Response Team. He has over 10 years of IT Security experience and currently holds a number of certifications including the GCFA, GCIH, and CISSP. Derek regularly blogs on IT Security and Forensics topics, which can be found on his personal blog.

6 Comments

Posted December 17, 2010 at 2:35 PM | Permalink | Reply

Rob Dewhirst

I would also configure a non-admin user for your actual investigative work, using elevation only when necessary. Admittedly a pain in XP, not so much in 7.

There are also several other Windows services you could disable in addition to Indexing, depending on your environment. Disable them first and reenable them if they cause problems.

I also disable on-access scanning (if I have AV installed at all) on my windows forensic system.

Lastly, I always make an image of my workstation after I have configured it.

Posted December 20, 2010 at 12:42 PM | Permalink | Reply

Jean

Hello,

I have questions about your setup :
How do you protect yourself against 0days (for exemple, the LNK exploit) targetting Windows ?
How do you mount the disk with the noexec option ?
How do you read streams (hidden NTFS attributes) ?
Do you use dd.exe (using cygwin) to create 1:1 exact copies ? I assume you don't inspect real hard disks but instead, copies.
And the last question : how can you prove Windows hasn't changed values in the inspected data ? Do you use hash (md5, sha256) to verify the integrity of the files before and after the forensic ?

Have a nice day !

Posted December 20, 2010 at 2:25 PM | Permalink | Reply

Derek Newton

Rob --

Great points! You definitely want to run under a non-admin account and disable any/all unused services (albeit, you'll want to be a bit careful to not disable critical services and make your box non-functional). On the AV front, I generally have AV installed on my workstation but have certain drives/directories exempted from on-access scanning and then initiate a manual scan if I'm concerned about malware in a file that I'm working with. Since I deal with accessing files on systems that may be infected with malware, I generally don't run without AV (in some form)...

And yes, imaging your workstation is a great final step once you have a clean system configured and ready to go! Saves a large amount of time if something goes awry.

Thanks for the ideas and feedback!

Posted December 20, 2010 at 2:54 PM | Permalink | Reply

Derek Newton

Jean -

Answers to your questions:

1) How do you protect yourself against 0days (for exemple, the LNK exploit) targetting Windows ?

Firstly, you don't want to be using your primary investigative workstation for anything other than investigations (so don't browse the net, email, etc). You probably don't need regular network access on this workstation once setup and configured, so consider completely disconnecting it for the most part (other than for patching, AV updates, etc). Given you do those things, you'll prevent most of the infection vectors, but you still need to worry about accidentally infecting yourself by running something off of an image you're working on. So...don't :). Treat everything you want to run/test off of an image as hostile and if you need to run something off of an image for investigative purposes, use an isolated "malware" VM that you're monitoring the filesystem, network traffic, etc on and then snap the VM back to clean when you're done.

2) How do you mount the disk with the noexec option ?

In Windows, there is not a way to directly mount a disk using a noexec option like you can do in *nix systems. MS assumes that when a file has Read permission, you can also execute (by default). However, you could use of Software Restriction Policies (AppLocker in Win7) to explicitly define where you will allow software to be executed from, thus basically accomplishing noexec (albeit, definitely more work).

3) How do you read streams (hidden NTFS attributes) ?

I'm assuming you're talking about Alternate Data Streams? You can list these by using the DIR command in Windows Vista/7 with the /R flag. Or you could use a number of tools such as LADS or Streams (Sysinternals/Microsoft).

4) Do you use dd.exe (using cygwin) to create 1:1 exact copies ? I assume you don't inspect real hard disks but instead, copies.

My imaging tool of choice in Windows is AccessData's FTK Imager (Free). I don't generally use dd under cygwin - but before I started regularly using FTK Imager, I used dcfldd which has a Windows binary available (I wouldn't be surprised if it was using cygwin though in some form to make it work).

5) And the last question : how can you prove Windows hasn't changed values in the inspected data ? Do you use hash (md5, sha256) to verify the integrity of the files before and after the forensic ?

Yes - hashing data is a very important part of a sound forensics process (goes to non-repudiation). Both FTK Imager and dcfldd have built in hashing functions.

Thanks for the questions hope my answers help!

Posted December 21, 2010 at 8:58 AM | Permalink | Reply

Jean

Derek -

Thank you for all the details !

Posted January 16, 2014 at 7:54 AM | Permalink | Reply

digital forensic services

Thank you for sharing superb information...............

Post a Comment






Captcha

* Indicates a required field.