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 your convenience can 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:
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 MS KB967715 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:
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:
- Open the Registry and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
- If it doesn’t already exist, create a new key called “StorageDevicePolicies”.
- 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).
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 then I 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 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:
- Open the Services applet (services.msc).
- 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:
- Open the Services applet (services.msc).
- 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:
- Connect a storage device and make sure that it is not automatically mounted (verify from within diskpart).
- 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.
- Insert media with a known Autorun/Autoplay functionality and make sure it does not automatically start when connected/inserted.
- 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.