The Most/Recent Articles

Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

How to install dfVFS on Windows without Compiling

How to install dfVFS on Windows without Compiling



Hello Reader,
After some testing James Alwood in our office was able to get dfVFS installed using just MSI packages from the log2timeline project. This is a big step for us as it severly lowers the bar of who can take advantage of all the advanced capabilities that dfVFS provides versus modules like pytsk on their own. In this first post in the dfVFS series James has written a walk through on how to do install it and make sure it works. 

Digital Forensics Virtual File System (dfVFS) is a flexible file system that allows its users to access many different kinds of image formats using Python.  Getting it up and running can be difficult and confusing.  This guide will help you install everything you need to get started using dfVFS on Windows.  I am assuming you already have 32 bit Python 2.7.9 or .10 installed.

Dependencies


dfVFS has a lot of dependencies, fortunately most of them packaged together and made available for log2timeline.


2) Click on the “Download ZIP” button on the right side of the screen.

3) Unzip the file.

4) Go to the win32 folder.

5) Install the msi’s for the following packages into your Python installation (name is before version number):
                six
                construct
protobuf
                pytsk3
                pybde
                pyewf
                pycrypto
                libqcow
                libsigscan
libsmdev
libsmraw
libvhdi
libvmdk
libvshadow
libfsntfs
libvslvm

6) Open a Python session in IDLE or from a command prompt.

7) Enter
      >>>import sqlite3
      >>>sqlite3.sqlite_version

8) If the output is below version 3.7.8 (fresh Python installs seem to have 3.6.21) go to:



9) Download sqlite-dll-win32-x86-3081002.zip and unzip the file.

10) In C:\Python27\DLLs back up the sqlite3.dll and then copy the new sqlite3.dll you just downloaded to this folder.

11) If you haven’t already, end your Python session then restart it.  Run the lines from Step 7 again.  You should now be on a more current version of sqlite3.

12) All of your dependencies should now be installed.

Installing dfVFS


With all the dependencies installed we can now get the dfVFS module installed.

1) Go back into the win32 folder in the log2timelines archive from step 4 in part 1.

2) Run the dfvfs msi located inside the win32 folder.

3) When it is complete dfVFS will be added to your Python installation and ready for use.

4) If you would like to test the installation to verify it was successful download the dfVFS zip available on Github: https://github.com/log2timeline/dfvfs

5) Unzip the archive.  DO NOT use the extract option included in Windows, it makes minor modifications to some of the test files while unpacking them and will cause tests to fail.

6) Open a command prompt and cd into the directory where you unpacked the dfVFS archive.

7) Run python run_tests.py from this directory to verify that dfVFS was properly installed

8) If you rename or delete the dfvfs folder in your unzipped dfVFS archive and rerun run_tests.py the tester will run dfVFS from the installed package in your Python directory.

Daily Blog #346: A quick note on Shellbag analysis in Windows 7/8

A quick note on Shellbag analysis in Windows 7/8

Hello Reader,
        If you are like me you love shellbags and use them on a regular basis to try to get some insight on what exists on external drives. One of the problems we run into though is that Shellbags stores full paths but not volume names or serial numbers so we cannot see from the entry what external device a recorded path was contained on from just that entry. We can do timeline analysis of devices plugged in, files accessed, drive letters assigned and the like to narrow down which device was plugged in but you are still sometimes left with multiple devices in play. I am going to go more in depth with this in a later series but I wanted to pass on a few tips.

NTFS v FAT entries

One of the easiest ways to tell the difference between drives requires that your sbag parser shows you the file record number and sequence number of the path it is pointing to. Sbag from TZWorks does this. If your tool is reporting this is becomes very easy to separate out the NTFS vs the FAT disks accessed as FAT does not record sequence numbers (its not part of its file system structure) so the sequence values will be null. 

NTFS v NTFS entries


A common thing we see is the same folder being copied to multiple drives, when this happens you can get seemingly duplicate entries in the shellbags. Look closer! The file record and sequence number will be unique between them allowing you to determine that they where contained on different drives.

Identifying the directory accessed

One of the questions I often get asked by clients is, did the drive they return contain the data they copied on to these external drives. Using the same file record and sequence number (or lack there of) we talked about above we can now match those accesses to each drive. I would not expect two drives to have the same file record and sequence number as well as creation times so you can also use the the creation times of the directories as a second factor in verifying that this is in fact the drive they accessed.

Daily Blog #345: Extracting USN Journals in X-ways Forensics

Extracting USN Journals in X-ways Forensics

Hello Reader,
       Today we have a guest post from Blazer Catzen, of Catzen forensics,  who was nice enough to write up the procedure necessary to extract out USN Journals with X-ways forensics in a way that makes the file more accessible with other tools. Let me explain what I mean by more accessible, X-ways correctly places no timestamps on a file that has none when an alternate data stream is exported. ADS have no timestamp attribute so applying one is artificial and applying one is something they allow the user to do. This is handy as the win32 api really wants to have a timestamp when it is opening a file and many tools will fail if it does not have one. So here is Blazer's writeup on how to do it:

Extracting USN Journals in X-ways Forensics

Xways comes with license for WinHex

Process as follows
1 locate USN$J and note that it has children (the dots along the bottom)

Extracting USN Journals in X-ways Forensics

2 Go into the “child”, in this case the ADS

Extracting USN Journals in X-ways Forensics

And select recover copy

Extracting USN Journals in X-ways Forensics

NOTE Output ADS as files check box

Extracting USN Journals in X-ways Forensics


And as you so aptly noted … no dates… tunneling did give a created date but no modified and anjp (WinAPI wants both….. so picky)

Extracting USN Journals in X-ways Forensics


Close XWF – Open WInHex – Open $J and file- save as ….

Extracting USN Journals in X-ways Forensics


 And now your new file will have dates

Extracting USN Journals in X-ways Forensics

And will open up with other programs that rely on the win32 api to open file handles, such as Triforce.

Also Read: Daily Blog #344

Daily Blog #136: Using Win 2008 Server Task Scheduler Logs to Identify Interactive Logins

Using Win 2008 server task scheduler logs to identify interactive logins

Hello Reader,
            In a prior Sunday Fundays we've talked about tracking logins to a Windows Server 2008 system and in each case I saw the normal security event log entries referenced. Today I wanted to expand on that knowledge with something I found in a case a couple years ago and mentioned in a Sunday Funday answer post, tracking logins with Task Scheduler logs.

You can find the Task Scheduler log in the event viewer GUI under:
Application and Services Logs -> Microsoft -> Windows - > TaskScheduler -> Operational

and on the disk under:
%SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-TaskScheduler%4Operational.evtx

The log is separated from the other Windows event logs which is very helpful as it prolongs the lifespan of the logs compared to prior versions of Windows servers. Inside the event log you'll find a log for each execution of a scheduled task here which is useful in its own right if you are looking for bad actions from malware or a user. In addition you'll find EventID 119, 'Task triggered on logon'. The reason this event entry is so useful is that by default there are tasks that get executed on every interactive logon so these event entries should show up for every interactive session without any configuration or additional security needed.

The event entries look like this:

Using Win 2008 server task scheduler logs to identify interactive logins

While the timestamp of 2:27:58PM is not going to be the exact second the user authenticated it is triggered soon after.

I use these logs to get farther visibility into who has logged in than the security event logs normally host but they don't reveal the IP address of the user.

Daily Blog #135: Converting MHT to PDF

Converting MHT to PDF

Hello Reader,
             I've spent most of day today trying to get data into a format that someone else can review. I'm using a tool called X1 Social Discovery which allows you to download, index and manage social media information from a variety of sources (Twitter, Facebook, Linkedin, etc...) but its ability to export the data in a form my client actually wants to review but still contain all the data he needs to review appear to be two different things. 

In the end the best view of the data I could find would create separate MHT files for each of the social media updates I captured. Herein lied today's frustration.

After exporting many a MHT file I hoped that I would be able to convert these with Adobe Acrobat, but it defaulted to opening the documents in Microsoft Word which did not render the MHT correctly. I attempted to combine the documents but MHT is not a supported file type for combining within Acrobat. I tried some programs that claimed to convert MHT to PDF's only to find they didn't embed the images within the MHT pages, just the HTML. I attempted to change the print to association of the file type to find that Opera (the browser that rendered them the best) does not have a print command line option.

After many hours of Google searching and the lament of similar people trying to accomplish the same task I found a blog that talked about a tool called VeryPDF HTML Converter. I grabbed a copy and sure enough, it worked! So now I will be able to deliver consolidated PDFs over numerous MHT files for review and go home.

I wanted to post this blog article, even though its outside the range of what I normally blog about, in the hopes that if you someday get stuck in this situation will find it and be able to solve your problem like I did. VeryPDF HTML Converter has a trial that allows 300 conversions and a license of the GUI only costs $59.

I hope this saves someones day.

Daily Blog #130: Detecting Fraud Sunday Funday 10/27/13 Part 3 - SetMace

Detecting Fraud SetMace by David Cowen - HECF Blog

Hello Reader,
            Yesterday we reviewed the timestomp tool and showed how simple MFT analysis can defeat it. Today we are going to go into the newest version of setmace v1006 which not only can modify the STDINFO timestamps but the FILENAME timestamps as well. 

I'm not sure how widely known setmace is but I will tell you that its very good at what it does as we'll see in the screenshots below. Prior versions of setmace did some tricks with file moving to reset the FILENAME timestamps but in version v1006 it actually modifies the physical disk itself leaving very few traces of its actions. Setmace will work on NTFS and FAT file systems.

Things to understand

What it does


Setmace will access the underlying physical disk and modify the $MFT directly changing the timestamps you specify (STDINFO or FILENAME or both) or cloning them from another file. Since this is direct physical disk access there are no $logfile or USN entries that show these changes.

What it does not do


It does not change the MFT record number, sequence number or find other artifacts pointing to it. That does not mean that future versions couldn't be modified to further obfuscate the original timestamps.

Capabilities by OS


Windows XP


On a Windows XP system setmace can reset timestamps on a file on any volume as XP's security model did not restrict access to the physical disk. Further since Windows XP does not have a USN Journal by default the only way to prove the original timestamps of a file will either be through the $Logfile or shell items pointing to the file.

Windows Vista/7/8


On a Windows Vista/7/8 system setmace cannot access the physical disk of any system volume, but it can access the physical disk of non system volumes. In my virtual environment I created two additional partitions one which i ran setmace from and the other where i stored the files whose timestamps i reset.

What does it look like?

After setmace runs this is what the STDINFO timestamps look like:

Detecting Fraud SetMace by David Cowen - HECF Blog

This is what the FILENAME timestamps look like for both the 8.3 and Unicode filenames:

Detecting Fraud SetMace by David Cowen - HECF Blog

I've used 1-1-1970 here to make it easy to spot that this is a fake timestamp but notice something here, the milliseconds here are set. This is another standard forensic analysis technique to detect timestamp modification, finding files where the milliseconds are set to 0. In this instance our suspect could set the full timestamp value to any date/time desired or clone a valid file. Scary stuff

The USN Journal contains no entries as the timestamp alteration occured outside the filesystem driver, we do have an entry from the usage of the file prior to its timestamp alteration that we can gather a last true usage time from:

Detecting Fraud SetMace by David Cowen - HECF Blog

The $Logfile contains the original timestamps of these files from its creation:

Detecting Fraud SetMace by David Cowen - HECF Blog

However there is no entry in any of the filesystem journal logs we normally rely on that would detail the fact that a timestamp change occured, it would be up to the analyst to look for indicators.

What indicators are left?

Don't lose hope, this isn't a blank check just yet for undetectable timestamp alteration. We still have several analysis points left that can reveal past true timestamps of this file:

  • Shell Items contain timestamps, compare them to the MFT to determine if MFT creation date is different. Examples of Shell item containers include
    • LNK Files
    • Shell bags
    • Jumplists
    • Other registry keys being identified but that I don't have in front of me :) Sounds like a good post for next week.
  • MFT entry and sequence numbers, is the file outside the range that it should be in to be created at that time? 
  • Registry MRUs
  • System restore points
    • Vista/7/8 - Shadow copies - Compare MFTs
    • XP - Restore Points  - Parse LNK files for shell items
  • Any activity taken place through the filesystem driver prior to the timestamps change will still be in the $logfile and USN
  • Prefetch of the setmace execution
Now having said this, not every analyst will think of these things. This will require an additional  steps in your process to look for these kinds of indicators and likely won't be the first thing you check for. Setmace will modify timestamps but it doesn't eliminate any of the IOCs/Artifacts you are already looking for.

I am going to be looking deeper into setmace to see what other artifacts of execution exist, I'll follow up on this on a later blogpost. Until then get some rest, these anti-forensic tools will only get better and you will have to do get better as well to keep up.

This is a 3-part series and here are all links to the entire series:

Daily Blog #129: Detecting Fraud Sunday Funday 10/27/13 Part 2 - Timestamp changes

Detecting Fraud Part 2 - Timestamp Changes

Hello Reader,
              Yesterday we went through detecting system clock changes on Windows 7, today we are going to talk about timestamp changing using two different utilities, timestomp and setmace.  

Why two timestamp changing tools? They have two different approaches, timestomp and its variants use a Win32 API call to change timestamps that allow them to adjust STDINFO attribute timestamps but not FILENAME attribute timestamps within the MFT. setmace on the other hand can change both and its use is currently not detectable by comparing the STDINFO and FILENAME timestamps. Let's get into it. None of the information in this post is new but I hope to frame it in such a way that it is easy to understand and approach if you don't have a low level understanding of MFT operations.

Initially I was going to cover both tools in this post, but there are enough details and new gotchas between the two to justify taking the time to split this between two posts. Today we will cover timestomp running through meterpeter on a compromised xp host.

Timestomp

Timestomp and other timestamp modification programs that work like it make use of the win32 api to reset timestamps located in the STDINFO MFT attribute for a file. STDINFO contains the timestamps shown to you within explorer and most non forensic file utilities. This method of timestamp modification has a simple detection mechanism that has been a staple for IR and forensic investigators to detect.

Step 1. Grab the MFT from the file system
Step 2. Parse the MFT (I used our ANJP tool)
Step 3. Compare the STDINFO creation/modification and access times to the FILENAME creation/modification and access times.

If the times in step 3 do not equal you have a file with a possibly altered timestamp.

Step 4. Validate your assumptions and make sure the file wasn't distributed by a vendor with a bad timestamp.

Here is an example, we created a file called 'test.txt'. We then used timestomp to reset the timestamp of that file to 0 which in timestomp terms is 1601-01-01 and the STDINFO creation dates look as follows:

Detecting Fraud Part 2 - Timestamp Changes


When you look at the FILENAME attribute of the same file you will find the original timestamps:

Detecting Fraud Part 2 - Timestamp Changes

So the comparison here is pretty obvious, not only because without the possibility of time travel there is no computer file being created in 1601 (Oh man, Time travel forensics!) but also because this file named:

Detecting Fraud Part 2 - Timestamp Changes

is user created and not part of a system package or other vendor delivered weirdness that you can find. In my testing I found a lot of 0 date FILENAME attribute files within the system32 directory which surprised me.

Let's not stop here though, let's talk about why these things exist. When a file is created in NTFS the first thing that is created is a File record. This file record maintains the basic header needed for NTFS to be able to reference and find the file. The second thing created is the STDINFO or standard information attribute which contains metadata about the file, MAC timestamps, etc..., but not the name of the file itself. Instead the name of the file and an additional set of timestamps is kept in a separate attribute called FILENAME.

The first FILENAME attribute will contain the 8.3 version of the files name (so called because it allows 8 characters in the name and 3 in the extension). If the file name is longer than 8 characters in the name or 3 in the extension then a second FILENAME attribute will be created that will store it and another set of timestamps. There can be even more FILENAME attributes but I haven't found any documentation yet that states all the possible mechanisms that generate additional ones. If you have please leave a comment and let me know.

Tomorrow we will show how setmace works and how using journal forensics we can overcome what is a very effective methods with some limitations on newer platforms.

This is a 3-part series and here are all links to the entire series: