sleuthkit icon indicating copy to clipboard operation
sleuthkit copied to clipboard

Windows Volume Shadow Copy Files incorrectly decoded

Open lfcnassif opened this issue 11 years ago • 19 comments

Only zeroes are returned when reading those files. So it becomes impossible to index or to do file carving on those files, even the computed hash is wrong. It occurs with sleuthkit-4.1.3 and with autopsy-3.1.2 when processing many different ntfs images. Running istat on those files returns a lot of wrong 0 offset sectors being used by the file, for example:

MFT Entry Header Values: Entry: 227446 Sequence: 13 $LogFile Sequence Number: 6513279765 Allocated File Links: 2

$STANDARD_INFORMATION Attribute Values: Flags: Hidden, System, Archive Owner ID: 0 Security ID: 925 (S-1-5-32-544) Last User Journal Update Sequence Number: 1563189584 Created: 2014-02-28 15:43:39 (Hora oficial do Brasil) File Modified: 2014-03-05 17:40:08 (Hora oficial do Brasil) MFT Modified: 2014-03-05 17:40:08 (Hora oficial do Brasil) Accessed: 2014-02-28 15:43:39 (Hora oficial do Brasil)

$FILE_NAME Attribute Values: Flags: Hidden, System, Archive Name: {0e8797c4-9fd0-11e3-beb0-50b7c343bde4}{3808876b-c176-4e48-b7ae-04046e6cc752} Parent MFT Entry: 37 Sequence: 2 Allocated Size: 335544320 Actual Size: 0 Created: 2014-02-28 15:43:39 (Hora oficial do Brasil) File Modified: 2014-02-28 15:43:39 (Hora oficial do Brasil) MFT Modified: 2014-02-28 15:43:39 (Hora oficial do Brasil) Accessed: 2014-02-28 15:43:39 (Hora oficial do Brasil)

Attributes: Type: $STANDARD_INFORMATION (16-0) Name: N/A Resident size: 72 Type: $FILE_NAME (48-3) Name: N/A Resident size: 82 Type: $FILE_NAME (48-2) Name: N/A Resident size: 218 Type: $DATA (128-1) Name: N/A Non-Resident size: 228179968 init_size: 0 36009856 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

lfcnassif avatar Jun 10 '15 01:06 lfcnassif

This output can be easily verified now in istat tab viewer of autopsy 3.1.3

lfcnassif avatar Jul 18 '15 15:07 lfcnassif

Hi Nassif,

I'm having problems too with Volume Shadow files at the TSK (icat, istat), including TSK 4.2 (same behaviour you pointed out). The problem with this type of file is caused by the attribute "initialized stream size" or "Valid Data Length size" (VDL size). Apparently, Microsoft has forced it's value to zero to make these files "invisible" to the normal Windows Backup process (https://secureartisan.wordpress.com/2011/01/29/dc3-2011-day-2-and-3/).

I don't have much familiarity with the TSK code, but I wrote one possible solution to this problem, altering the "tsk/fs/ntfs.c" file, at the "ntfs_proc_attrseq" funtion, adding a test to set "initsize" to "ssize" when "initsize" it's equal to zero. But I don't know if this solution will cause problems with other types of files (like sparse or virtual files) in NTFS. I didn't find a way to limit this test only to the Volume Shadow Files, but it worked properly in my few test images.

I'm sending the patch attached only to illustrate my message, because I think that other users or TSK developers could implement a better solution to this problem.

Other references related to this problem:

  1. https://github.com/sleuthkit/sleuthkit/issues/466 - [Windows Volume Shadow Copy Files incorrectly decoded]
  2. http://sourceforge.net/p/sleuthkit/mailman/message/22341633/ - ([sleuthkit-developers] [ sleuthkit-Bugs-2367426 ] Fix NTFS VDL Slack bug)
  3. https://secureartisan.wordpress.com/2011/01/29/dc3-2011-day-2-and-3/ - [VDL Slack in NTFS – David G Ferguson]
  4. https://github.com/sleuthkit/autopsy/issues/177 [ Autopsy issue - Volume Shadow Copies appear as 00s in hex #177 ]

Best regards,

Gabriel ntfs_patch_volume_shadow.txt

gabrieldmf avatar Jan 17 '16 11:01 gabrieldmf

Adding some notes here for myself here for future reference as well.

On my system, the Volume Store file ({GUID}{3808876b....}) has the following sizes: Allocated: 2974919584 Actual (ssize): 2974919584 Initialized: 0

istat is similar to what is reported above whereby there is a single block listed and the rest are sparse/0s.

Looking at the block manually (with blkcat) and comparing with Joachim's docs about the Store (https://github.com/libyal/libvshadow/blob/master/documentation/Volume%20Shadow%20Snapshot%20(VSS)%20format.asciidoc) show that the block is indeed a valid store header.

TSK's default approach is that anything beyond initsize (which is 0 in this case) was not set by this file and is therefore slack (VDL slack is the term that Dave Ferguson first used). Without TSK's default behavior on other files, old data would be shown as belonging to that file, which is inconsistent with what Windows will show you if you read that file. So, TSK's behavior is consistent with Windows.

So, the challenge here seems to be that Windows will set initisize to 0 to prevent backups from copying it.

There are two options to solving this problem:

  1. We take the general approach from the patch and have some special case code deep in TSK that detects that it is processing a VSS store and does not set initialized size to 0 and instead sets it to the actual size. My biggest concern with this is detecting its a VSS store file from that point in the code and (it would probably have to do it based on the GUID being in the path) and that it could cause some confusion because other tools may report its size having an initialized size that is 0.

  2. We treat the contents as being in slack, which they technically are. From the command line tools, you can give 'icat' the -s flag to show slack and I confirmed that it does have the proper store header on my system. So, that is a pure TSK solution to this that should work in today's code. This does not fix the issue of Autopsy not providing access to the data, which is a bigger issue that perhaps this will motivate to be bumped up in priority.

For ease of maintenance and simplicity, i prefer approach 2 and having it be part of slack. Does 'icat -s' work for everyone on their systems?

bcarrier avatar May 11 '16 14:05 bcarrier

Hi Brian,

Thank you for the great explanation! I think that if option 2 is taken, TSK Java bindings should expose some api to allow reading file slacks, and it is a general solution that will work for other files. But note that with option 2, TSK will show (and shows) different output when compared with some other tools (FTKImager, Encase), those tools show VSC content not as slack, and it could confuse users too. That content actually belongs to VSCs and was not left behind by deleted files, so I am not sure if it is true slack or not.

Maybe an option 3: create a flag into TSK data structures to point if a file is from VSC or not. So initialized size could return 0 and TSK could use that flag to decide if it will stop at initialized_size or not when reading file contents?

PS: I am on vacation for the next 2.5 weeks, so I will test icat -s as soon as I return to my work station.

lfcnassif avatar May 11 '16 15:05 lfcnassif

Does anyone know if FTKImager and EnCase are treating VSC different or do they always show "VDL slack"?

bcarrier avatar May 12 '16 00:05 bcarrier

Hi Brian,

Thank you for your explanation. In my tests, the command 'icat -s' returns the full content of the VSS file, including the "slack part", like you said. Using the FTK Imager (v3.4.2.2), normal files with a slack part, are shown as two items, one 'Regular File' and one 'File Slack'. But, for the VSS files, the FTK Imager only shows one 'Regular File' with all the data, without mentioning any related File Slack. FTK Imager doesn't report the value of Initialized Size attribute.

I've tested in Encase (v6.19.7.2) and it shows the attribute "Initialized Size" of the VSS files as zero, but its behaviour is similar to FTK Imager, without mentioning any related File Slack.

I exported some VSS Files using FTK Imager and Encase for some disk images and their contents are the same (same hash MD5) that are returned by 'icat -s' command. Both tools (FTK Imager and Encase) show the full content of the VSS Files in Hex Viewer, including its "slack part".

gabrieldmf avatar May 24 '16 15:05 gabrieldmf

FTK Imager showing a VSS File as 'Regular File' without any File Slack information: 2_ftkimager_filevss

Encase showing the same VSS File (Initialized Size=0 but with the same content of 'icat -s' output): 1_encase6_filevss

FTK Imager showing a common file with a slack part (NOT a VSS File): 3_ftkimager_tempfileslackinfo

gabrieldmf avatar May 24 '16 18:05 gabrieldmf

any sign of this please getting fixed ? :-)

dnides avatar Nov 19 '16 16:11 dnides

Gabriel has written a patch to apply the change only to vss files. If he could not post it here, I will when I come back to my city and work computer.

lfcnassif avatar Nov 20 '16 14:11 lfcnassif

I read right now recent commits and it seems Slack support was added so it should be fixed in the next release.

lfcnassif avatar Nov 20 '16 14:11 lfcnassif

Thanks for the quick response! Are you referring to this one - https://github.com/sleuthkit/sleuthkit/commit/c2b93677c4bd56812e40030fefba69a0bc9c735d

If so awesome, will pull down and check out!!

Thanks again.

Sent from my iPhone

On Nov 20, 2016, at 8:33 AM, lfcnassif [email protected] wrote:

I read right now recentes commits and it seems Slack support was added so it should be fixed in the text release.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

dnides avatar Nov 20 '16 14:11 dnides

Hİ, I want to work on this issue. Could you assign me this issue please?

asdemirci avatar Nov 20 '16 21:11 asdemirci

@lfcnassif said it was fixed (but i haven't tested yet) so not sure there is anything to work on?

dnides avatar Nov 20 '16 21:11 dnides

Thank you for your answers. I got it. It there is any problem, could you you say me?

Good works, See you later

2016-11-21 0:44 GMT+03:00 david nides [email protected]:

@lfcnassif https://github.com/lfcnassif said it was fixed (but i haven't tested yet) so not sure there is anything to work on?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sleuthkit/sleuthkit/issues/466#issuecomment-261808196, or mute the thread https://github.com/notifications/unsubscribe-auth/ATykwnFsd4aWlbuBgtFgOLKaNR4Im0BJks5rAL9bgaJpZM4E93K9 .

Ayşe SELÇUK DEMİRCİ

asdemirci avatar Nov 20 '16 21:11 asdemirci

This patch only applies to the Java binding, correct? If so, does anyone know a way to have the Python binding read slack from a file?

sg avatar Nov 22 '16 20:11 sg

sg, when you say Python binding, are you asking how an Autopsy module written in Python can access file slack space? If so, a file ingest module written in Python can just look at the "virtual slack space files" that come down the ingest pipeline, i.e., AbstractFiles passed to the module process method where file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.

A more general approach, suitable for data source level ingest modules, etc., would be to query the SleuthkitCase object that can be obtained from the current Case object (Case.getCurrentCase) using the findAllFilesWhere method. The relevant part of the WHERE clause would be "type = 7".

rcordovano avatar Nov 28 '16 19:11 rcordovano

I've just read the slack support code and it seems entries for slack files are created only when allocated size is greater than logical size? So I think this issue with VSS files are not fixed. Creating slack files when the initialized size is smaller than allocated size should workaround this issue, it is exactly Brian's second suggested approach (although I think it is not real slack).

lfcnassif avatar Nov 28 '16 21:11 lfcnassif

rcordovano, no, I wasn't referring to an Autopsy module. I was talking about the pytsk3 bindings that give access to the TSK API via Python (the question has been posed on that project as well).

sg avatar Nov 30 '16 16:11 sg

I think this can be closed after fix for #756 . Thanks Brian!

lfcnassif avatar Feb 01 '17 17:02 lfcnassif