Recovering and Analyzing Deleted Registry Files



Similar documents
Advanced Registry Forensics with Registry Decoder. Dr. Vico Marziale Sleuth Kit and Open Source Digital Forensics Conference /03/2012

Automated Windows Event Log Forensics

FORENSIC ANALYSIS OF USB MEDIA EVIDENCE. Jesús Alexander García. Luis Alejandro Franco. Juan David Urrea. Carlos Alfonso Torres

Lab III: Unix File Recovery Data Unit Level

RECOVERING FROM SHAMOON

Using SNMP to Obtain Port Counter Statistics During Live Migration of a Virtual Machine. Ronny L. Bull Project Writeup For: CS644 Clarkson University

There are numerous ways to access monitors:

Lab V: File Recovery: Data Layer Revisited

EVENT LOG MANAGEMENT...

NovaBACKUP. User Manual. NovaStor / November 2011

Tutorial How to upgrade firmware on Phison S8 controller MyDigitalSSD using a Windows PE environment

Tutorial. Reference for more thorough Mininet walkthrough if desired

Computer Forensics using Open Source Tools

Extending Remote Desktop for Large Installations. Distributed Package Installs

PTK Forensics. Dario Forte, Founder and Ceo DFLabs. The Sleuth Kit and Open Source Digital Forensics Conference

Using Microsoft SyncToy to Automate Backups

Integrating with BarTender Integration Builder

SmartLock Pro Plus Audit View OPERATOR GUIDE

Retrospect 7.7 User s Guide Addendum

User Guide. Version 3.2. Copyright Snow Software AB. All rights reserved.

Introduction to Operating Systems

JAMS 6.X Client Features 3. Working with Jobs 4-5. Submitting Jobs Manually 6-7. Working with Setups 8-9. Working with Views 10-14

Exchange Brick-level Backup and Restore

Autograph 3.3 Network Installation

Intelligent disaster recovery. Dell DL backup to Disk Appliance powered by Symantec

Automating the Computer Forensic Triage Process With MantaRay

BCKPLBO Logivision

VERITAS Backup Exec TM 10.0 for Windows Servers

Novell ZENworks 10 Configuration Management SP3

Installing AWStats on IIS 6.0 (Including IIS 5.1) - Revision 3.0

Lab 5: HTTP Web Proxy Server

Add page numbers and headers and footers by using the gallery, or create a custom page number, header, or footer.

TZWorks Windows Event Log Viewer (evtx_view) Users Guide

How to Prepare for the Upgrade to Microsoft Dynamics CRM 2013 (On-premises)

Ans.: You can find your activation key for a Recover My Files by logging on to your account.

JAVS Scheduled Publishing. Installation/Configuration... 4 Manual Operation... 6 Automating Scheduled Publishing... 7 Windows XP... 7 Windows 7...

An Introduction To The Web File Manager

GO!NotifyLink. Database Maintenance. GO!NotifyLink Database Maintenance 1

Recover Data Like a Forensics Expert Using an Ubuntu Live CD

GUARD1 PLUS SE Administrator's Manual

Installation and Deployment

NTFS Undelete User Manual

Importing Xerox LAN Fax Phonebook Data from Microsoft Outlook

MTA Course: Windows Operating System Fundamentals Topic: Understand backup and recovery methods File name: 10753_WindowsOS_SA_6.

TRIFORCE ANJP. THE POWER TO PROVE sm USER S GUIDE USER S GUIDE TRIFORCE ANJP VERSION 3.10

Expresso Quick Install

Cloud Attached Storage

Call Recorder Oygo Manual. Version

Web Browser Session Restore Forensics A valuable record of a user s internet activity for computer forensic examinations

Yubico YubiHSM Monitor

VX Search File Search Solution. VX Search FILE SEARCH SOLUTION. User Manual. Version 8.2. Jan Flexense Ltd.

DiskPulse DISK CHANGE MONITOR

Jetico Central Manager. Administrator Guide

NetIQ. How to guides: AppManager v7.04 Initial Setup for a trial. Haf Saba Attachmate NetIQ. Prepared by. Haf Saba. Senior Technical Consultant

Vector HelpDesk - Administrator s Guide

Backing up the Embedded Oracle database of a Red Hat Network Satellite

PCmover Enterprise User Guide

inforouter V8.0 Server Migration Guide.

v4: How to create a BartPE Rescue CD for Macrium Reflect

Guide to deploy MyUSBOnly via Windows Logon Script Revision 1.1. Menu

User Guide to the Content Analysis Tool

MapGuide Open Source Repository Management Back up, restore, and recover your resource repository.

Test Center Enterprise. ios Device Onboarding Guide

Group Mail Lists. Group Mailing Lists. Populating a Global Mail Lists 4. The Problem 6. The Solution 8. Scheduling Regular Updates 17

Recommended Solutions for Installing Symantec Endpoint Protection 12.1.x in Shared and PvD Virtual Machines

FileBench's Multi-Client feature

IMDG Code for Intranet

Resolving USB Driver Problems

Microsoft Visual Studio Integration Guide

Network Administrator s Guide and Getting Started with Autodesk Ecotect Analysis

Microsoft Dynamics GP

Google Docs A Tutorial

HIC.SOAP Network User Instructions last updated June 22, :39 AM

Tivoli Storage Manager Lunch and Learn Bare Metal Restore Dave Daun, IBM Advanced Technical Support

Excerpts from EnCase Introduction to Computer Forensics

for Networks Installation Guide for the application on the server July 2014 (GUIDE 2) Lucid Rapid Version 6.05-N and later

The Forensic Analysis of the Microsoft Windows Vista Recycle Bin. By Mitchell Machor

Ansur Test Executive. Users Manual

GlobalSCAPE DMZ Gateway, v1. User Guide

ZENworks 11 Support Pack 4 Full Disk Encryption Agent Reference. May 2016

Work with the MiniBase App

File System Forensics FAT and NTFS. Copyright Priscilla Oppenheimer 1

Code Estimation Tools Directions for a Services Engagement

NovaBACKUP Central Management Console

CHAD TILBURY.

Driver Installation and Hyperterminal Operation of iload Digital USB Sensors

DISK DEFRAG Professional

FileMaker 12. ODBC and JDBC Guide

InventoryControl for use with QuoteWerks Quick Start Guide

How To Back Up Your Pplsk Data On A Pc Or Mac Or Mac With A Backup Utility (For A Premium) On A Computer Or Mac (For Free) On Your Pc Or Ipad Or Mac On A Mac Or Pc Or

Working with your NTU off campus

Copyright. Disclaimer. Introduction 1. System Requirements Installing the software 4

Q. If I purchase a product activation key on-line, how long will it take to be sent to me?

Mobile Labs Plugin for IBM Urban Code Deploy

Exchange Mailbox Protection Whitepaper

Logitech for Business Webcam Software

Portable Media. BackupAssist Quick-Start Guide for. BackupAssist installation, configuration and setup. Contents.

Transcription:

Recovering and Analyzing Deleted Registry Files Andrew Case Digital Forensics Solutions andrew@digdeeply.com / @attrc I had a case recently where I was asked to investigate any signs of data exfiltration by a client's former employee. What I did not realize until I started investigating the case is that the computers in question were reformatted/reinstalled in-between the employee leaving and my investigation [1]. After realizing this, I then needed a plan to recover relevant data knowing that multiple operating systems worth of files would be spread throughout the drive, and that none of the files I was interested in would be present in the filesystem. My first goal of the investigation was to recover USB device activity, and my initial plan for this was to simply file carve for deleted registry files and then manually figure out the ones that belonged to the previous instance of the OS. I could not simply use blkls from the Sleuthkit, as I normally would target unallocated files, because I did not know the layout of the previous install of the operating system. This meant the previous registry files could literally be anywhere on the disk. I knew from past cases that carving for registry files is usually painful because there is a header but no footer, so I needed some extra power besides just header/footer carving. With all this in mind, I came up with and executed the plan I will now explain in order. Step 1: Use Scalpel to Find All Instances of Possible Registry Files My first step was to find where all possible registry files could be. Registry files start with the string "regf", and so I created a simple Scalpel config file (see Appendix A Scalpel configuration file for carving registry contents) that would find all instances of "regf" on the disk image (using Scalpel as an indexer this way was previously explained here). I then ran Scalpel with this invocation: scalpel -c scalpel.conf -p -o regresults disk.dd Note that the '-p' (preview) tells Scalpel to only write its audit file and not to actually carve any files out of the disk. This audit file contains all the offsets into the disk where the header ("regf") was found. Scalpel in this instance found a little over 7000 instances of "regf" on disk. Step 2: Filter Scalpel hits into possible SYSTEM files. After Step 1, I had an audit file with all the offsets on disk where "regf" appeared. I then wanted to filter those only to possible SYSTEM registry hives as this is where USB information is stored. For this I wrote a script, recover.py (see Appendix B recover.py), that: 1) Gathered all the offsets from Scalpel's audit file 2) Read 2048 bytes starting at that offset into a separate buffer 3) Checked the separate buffer for system / SYSTEM in Unicode 1

4) Print out indexes that pass the check from 3) I ran recover.py with this invocation: python recover.py regresults/audit.txt disk.dd > systemidxs-unicode This then placed all the indexes of possible SYSTEM hives into the systemidxs-unicode file, and narrowed down the original Scalpel indexes list from over 7000 to 171. Step 3: Gathering the Possible Registry Files The next step was to take the 171 indexes of possible SYSTEM files found in Step 2, and to determine which were actual registry hives. To accomplish this, I wrote grab.py (see Appendix C grab.py), which simply takes a list of disk offsets and a disk image, and pulls X number of bytes starting at each index and writes the contents out to a file. To ensure that I recovered all data from the gathered SYSTEM files, I set this script to pull 25MB out for each file. I ran the invocation of grab.py with systemidxs-unicode from the previous step as: python grab.py systemidxs-unicode disk.dd grabout/ This placed the possible hives into the grabout directory. Step 4: Filtering Real Hives versus Fragments I now had 171 possible SYSTEM files written out to the directory grabout. At this point I needed to determine which hives were valid. To accomplish this, I used reglookup and had it attempt to parse every gathered registry hive. I saved the output of each attempt for the next step. Since reglookup only accepts one file at a time, I chose to write a bash one-liner that would automate the process over all of the gathered hives. That invocation looked like this: for file in $(ls grabout); do reglookup grabout/$file > reglookup-output/$file-output; done > /dev/null For those not familiar with bash, what this one-liner does is: 1) Gets a list of all the files in the grabout directory, this is the ls grabout invocation. 2) It then iterates over every file in the directory and runs reglookup on it 3) The output of each reglookup invocation is saved in the reglookup-output directory as <filename>-output. The result of this process is that each registry file will be processed in one command. If a file is not a valid registry hive then its output file will be of size 0, or, if it is valid, then all of its registry paths, names, and values will be written to the output file. 2

Step 5: Determining and Acquiring Hives of Interest After Step 4 completed, I had output files that: 1) Determined if a file was a valid hive or not 2) Could be searched for relevant keys/names/values. Since my first goal of this investigation was to determine USB activity from recovered hives, I then wrote another bash one-liner to find all the hives that had a USBSTOR key (which signifies that a USB device had been plugged in at some point while the hive was active). The bash invocation looked like this: for name in $(grep -li USBSTOR *-output cut -d '-' -f 1); do cp grabout/$name /media/kingston/regfiles/; done This invocation actually accomplishes two goals. The first is that it filters based on USBSTOR being present in a hive, and the second is that it copied each wanted hive to my USB thumb drive. It accomplishes this goal by: 1) Using grep to find all of the reglookup output files that have USBSTOR in them. Note that the l flag to grep means to only print a matching filename once even if the search term appears multiple times. 2) For each matching output file, copy the actual registry hive, stored in grabout, to the USB drive folder /media/kingston/regfiles/ Step 6: Analyzing the Recovered Hives After Step 5 completed, I then had 49 intact SYSTEM files that were recoverable from the disk image and that passed the previously discussed validation steps. Remembering that these files were spread out across (at least) two installs of Windows as well as possibly numerous System Restore Points across the installs, I needed a way to filter to just the files from the previous install. To accomplish this, I copied my files to a Windows analysis machine and turned to Registry Decoder. First, I created a new Registry Decoder (RD) case and then loaded all 49 recovered hives into it. Once it was done processing, I then utilized Registry Decoder s search ability to quickly find USB devices of interest. Registry Decoder s search functions allow an investigator to filter by a number of selections, including: 1) A single search term or a newline separated set of search terms in a file 2) The last write time of keys 3) Exact or wildcard search 4) Limiting searching to any combination of keys, names, and data 3

As part of our pre-investigation phase, the client had given us a date range to be investigated. I was able to filter my search results to these dates by using the Filter By Last Write Time fields of RD s search form. To recover USB activity, I targeted the DeviceClasses information for USB drives that were used on the machine. To filter to only USB devices, I entered a search term of \\?\USBSTOR#Disk and told RD to only search the data field of the analyzed registry hives. Appendix D Search Form Screenshot has a screenshot of what this setup looks like on a sample case. This approach effectively narrows down the search results to only USB drives found under the DeviceInstances path as well as within the appropriate date range. I then ran this search across all the files loaded into the case, and a number of search result tabs were generated. By looking through the results I could tell that I had recovered a large number of files from the previous Windows install, and that many USB devices had been used on it during the timeframe of interest. I then ran Registry Decoder s USBSTOR plugin, modified to include the last write time of the keys, across all the registry files within my time range. I then crosscompared the timestamps in the USBSTOR keys to those in the associated DeviceClasses keys to ensure they matched. This is necessary as USBSTOR keys timestamps are not always reliable. Finishing this part of the investigation was as simple as using Registry Decoder s automated report feature to write all the USB devices found, including their serial number and last insertion time, into a formatted HTML file. Final Thoughts Hopefully this write up was interesting as it documents a process that I do not know of any other references for (at least with only using open source tools). The end result was that I started off with a disk that no longer had my targeted OS installed, and was able to recover a large number of registry files as well as to quickly analyze and report their contents with Registry Decoder. Note that while I targeted SYSTEM files in this example, recover.py could be modified to target any other type of hive and the process would be the same. I performed this process on the same case with NTUSER files and recovered over 180 valid hives. I then took filenames of interest from our client and used those as my grep parameter (in place of USBSTOR) to narrow down to the hives I wanted to analyze. I then loaded the files into Registry Decoder and performed searches specifically for the filenames our client provided. I would like to thank Wyatt Roersma (@WyattRoersma), Ken Pryor (@kdpryor), and Frank McClain (@littlemac042) for reviewing an initial version of the paper and providing feedback. Notes [1] That the OS was reinstalled was determined by noticing strange dates in the "Documents and Settings" folder (XP machine) related to user accounts and then was verified by checking the install date in the Registry. The install date is stored in "\Microsoft\Windows NT\CurrentVersion" -> "InstallDate" of the SOFTWARE hive, and can be recovered automatically using the "Windows Install Information" plugin of Reigstry Decoder or the "winver" plugin of RegRipper. 4

Appendix A Scalpel configuration file for carving registry contents reg y 20 regf 5

Appendix B recover.py import os,sys,re # a search term found and its disk location class scalpel_hit: def init (self, term, offset, length): self.term = term self.offset = offset self.length = length self.filename = "" # parses the matched headers and offsets from scalpel's audit.txt # returns a list of 'scalpel_hit' objects (one for each match) def parse_audit_log(auditfile): hits = [] hitre = re.compile('^\d+\.(\s+)\s+(\d+)\s+\s+\s+(\d+)') for line in auditfile.readlines(): match = re.search(hitre, line) if match: g = match.groups() hits.append(scalpel_hit(g[0], int(g[1]), int(g[2]))) return hits def main(): audit = open(sys.argv[1], "r") img = sys.argv[2] hits = parse_audit_log(audit) fd = open(img, "rb") find = "s\x00y\x00s\x00t\x00e\x00m" for offset in [hit.offset for hit in hits]: fd.seek(offset, 0) buf = fd.read(2048) if buf.lower().find(find)!= -1: print "%d" % offset if name == " main ": main() 6

Appendix C grab.py import sys, os idxs = [int(x) for x in open(sys.argv[1], "r").readlines()] fd = open(sys.argv[2], "rb") outdir = sys.argv[3] ctr = 0 for idx in idxs: fd.seek(idx, 0) buf = fd.read(25000000) outfd = open(os.path.join(outdir, ctr), "wb") outfd.write(buf) outfd.close() ctr = ctr + 1 7

Appendix D Search Form Screenshot 8