Thursday, February 24, 2011

Eric Huber (A Fistful of Dongles) Interviews Hal Pomeranz

Eric Huber recently posted an interview with Hal Pomeranz on his blog, here. I'm not typically a person who reads interviews, but I had Hal as one of my SANS instructors. I think Hal's one of the many sharp forensic folks out there, and I've certainly learned a lot from him. So anyway, I was quite a bit more interested in “hearing” what he had to say. And because of this posting of Eric's, I've actually started reading more interviews. So hey, a positive impact!

I thought the interview was very good (thanks, Eric!) and there were a lot of good take-aways in there for me, and the company where I work (a boutique firm where we work primarily for lawfirms on behalf of corporations). If it was that good for me, then surely it's good for others, too. So I thought I'd share my – well, for lack of a better word – thoughts on what was said. I've been working on this post ever since the interview first came out (I know, it's taken a while – I'd like to blame my work schedule, if I may). I first wrote a version of this for my company (in a spreadsheet), as I thought we could (and should) take some of these things to heart. Obviously, I've made some changes to post to my own (infrequently updated) blog.

Eric's questions weren't numbered, but I've taken the liberty of referring to them as if they were, for ease of making sure I've covered my points, and so that it's easier to track back to the original.

1. Not much here. Eric asked about Hal's journey into forensics, and Hal mentioned being approached by Rob Lee to be part of Mandiant's Surge Staff. I just think it would be cool – an honor to work with Mandiant. Perhaps some day; a guy's gotta have dreams, after all … ;)

2. This question was about Hal's involvement with SANS' Forensics program, and Hal talked about how challenging it is to prepare to teach the material. I've seen the same thing in the military and business - when you have to prepare to teach a subject, you learn more about it than you probably ever would by simply taking the class yourself, or doing the work. Teaching is hard work, but obviously the rewards are extremely beneficial in this respect. In addition, getting outside of your environment and teaching (not just outside your comfort zone) helps establish your presence in the community at large (both personally and professionally).

Teaching others isn't just about personal (or even professional) accolades. It is an opportunity to learn even more about the craft/science we use, and giving back to the community. Forensics has developed as a community-driven discipline, because there aren't rulebooks, documentation, etc - we are the ones paving the way. As we benefit from the community, we really have a responsibility to give back, or "pay it forward" as Hal mentions. It's also a way we make connections in the industry which could lead to business associations as well. Later on, Hal emphasizes the importance of giving back to the community - doing blogs, whitepapers, articles, etc. I think that plays a part here as well. You don't have to be a Harlan Carvey, Didier Stevens, or Hal Pomeranz to contribute. Simple blog posts about the things you find can be useful, as you may have come across something somebody else hasn't seen before, and you may be the only person (or one of a very few) reporting on it. There's at least one blog I know of where the guy is new to forensics, but he's doing a lot in Linux and posting findings on his blog.

3. Eric asked about skills Hal has developed over the years that help with forensics, and Hal talked about tricks and other things he learned from his years as a Unix Sys Admin, scripting, and problem solving. This whole section speaks to what I think is really part of what goes into our team (where I work). We have varied backgrounds, different business paths, and so on - these all help shape our skills, troubleshooting/problem-solving abilities, and so on. We don't just think from one perspective; even if a single individual did (and I don't think we do, given what I've seen), the "group mind" takes it much further as we collaborate and share based on our personal experiences. Together, we are greater than the sum of our parts, and I think this is one of the things that really sets our team apart and allows us to accomplish more than a lot of others in the field.

4. There are several things in this question about what it takes to be a good forensic examiner. Hal mentions root cause analysis, writing skills, and passion for the gig. Rob Lee has a great article out there discussing what it takes to get started in digital forensics (http://computer-forensics.sans.org/blog/2010/08/20/getting-started-digital-forensics-what-takes). IMHO, it's a very good writeup. One of the things I took away from it is that he looks for a drive (no, not a hard drive) in the person to accomplish new things. He gives the example of a person who decides to learn to play golf one summer and devotes time & effort to doing just that. He said he asks candidates what they've done along those lines and uses that as a barometer to gauge their forensic potential. (Section: "Do You Have A Desire To Be An Expert?") I don't think it's so much about "what you know" as what you want to know and are driven to learn. You can have a good IT person who knows a lot about computers but would not make a good forensicator, as they might not really want to learn more, or get "outside the box" for their current set of knowledge.

The whole writing thing, well this is a bit of a personal pet peeve. Well, part of it anyway - the coherent documentation bit. A lot of the forensic reports (and white papers) that I've reviewed are, in my opinion (humble or otherwise), drivel. I think people are in way too much of a hurry, don't take time to do error-checking, editing, grammar/syntax correction, formatting, or making sure they are communicating their point for the intended audience. There also seems to be a general lack of understanding regarding some basic grammar rules (run-on sentences, for instance, is a big offender). Then beyond that you also have to take the target audience into account, as Hal mentions. Unfortunately, I'm not sure that quality report writing is something that can be taught; it's like the "silver tongue" - either you have it or you don't. Anyone can improve their skill, but to what level? And some, I think, will not ever have it (something that needs to be watched for in the hiring process).

5. The question about how to get into digital forensics. Yeah. There's been a pretty good discussion on one of the LinkedIn groups about this, but Hal hits some different points, focusing primarily on networking. Not sure what a switch and a CAT6 cable will get me but... This section is where Hal mentions doing your own blog posts, articles, etc. He's approaching it from the standpoint of getting your name out there, looking for jobs, and so on. However, this works not only for the individual, but to help promote the company too. I know Digital Detective and Guardian Forensics, for example, both host their own blogs. I understand, though, that if you don't keep it active, you just look foolish as a company (does that count for individuals, too? Thinking about my own here...). He also emphasizes the importance of continuously learning. Again, there aren't any all-in-one rulebooks or documentation for our corner of the InfoSec industry. Operating systems change rapidly; these change available artifacts in ways that are not typically documented. With each change, we have to figure out what to do next. In addition to these "obvious" changes to the landscape, cell phones are now really miniature computers that also make phone calls - not to mention tablets brought back by the iPad. Their operating systems are completely new things, with new data structures, artifacts, and so on. Not only do we have to figure them out, we also have to figure out how to access the data (think Android, iOS, etc) such that we can forensically acquire it in a useful manner. If we don't keep up, we lose...

6. I don't have a lot of input here either, for the question about seeking advanced education or degrees in digital forensics. I'm not convinced that the current programs are actually preparing graduates for the real world, but then that's probably true for any degree plan, and I also have not by any means seen everything that's out there.

7. Question 7 focuses on the “state of the union” so to speak, regarding forensics. The first three things Hal brings up are our general youth, developing solutions to problems, and sharing information. This ties in with my point about us paving the way, and the need to continue learning. Microsoft and Apple, for example, are certainly not in the business of providing information to the forensics community about how their various operating systems work, what changes are being made that would impact our professional lives, and so on. For example, as browsers are designed more and more to "protect" users' privacy, the storing of browser artifacts is something that has changed fairly dramatically in recent months. When it comes to things like the iPhone, as people figure out how to hack it for various purposes, Apple tries to block it in a new release of the iOS. Can't fault Apple, as they're trying to protect their users and interests; however, as we are often looking to utilize the same exploit, this negatively impacts our ability - and then Jonathan Zdiarski has to come up with a new script or process... ;)

From there Hal goes into cross-platform tools. He and I had an email conversation about this very thing a little while back. He'd posted some questions about Mac forensics/tools on the GCFA list, and did not get a lot of responses. I let him know about the tools that we've used, and we had a little back-and-forth off-list. One of the things we touched on then was how it seems the majority of tools for Mac forensics only run natively in Mac OS. While this may be a natural starting point, it can be difficult for folks who don't have immediate access to these platforms, but have reason to need to do analysis.

The final area in this question relates to, as Hal puts it, “bridge-building.” I just think this is a very good point - educate the legal community on what we do, and how we can help them. If we also become more educated on what they need, we will in turn be better prepared to help them in a meaningful way. As Hal mentions later on, he sometimes finds stuff he thinks is cool or interesting, but it may have absolutely no value for the client. I think it's important for us to step out of our comfort zone (or simply take our blinders off) to get a better grasp of what our client really needs (as opposed to what we want to give them).

8. The question here is about difference between IT- and LE-based forensics, and I think Hal has some excellent points (but of course, right?). We tend to get wrapped up in our own "little" world and don't realize that our clients are juggling a lot of projects as well. They may not remember exactly what we told them before, and may have some difficulty grasping the points we're trying to make. A little consideration will probably go a long way to help create a stronger, more mutually beneficial relationship. We should have a "take-away" focus to help us learn how to better do our jobs (not just the way we've always done them).

The second half of this brings up rabbit trails, and maybe a little scope creep. This is one of the biggest issues I think we face, when it comes to actual investigations (by “we” I mean our company in specific, although I realize this may have broader applicability). We are bad about going off on our own tangents, "just because we want to know." Maybe this is useful from the standpoint of educating ourselves, and if we aren't billing the client, what's the harm, right? But if it detracts from us meeting goals/deadlines that the client has, then we're doing everyone a disservice. We have to stay on task, focused, and try to make sure that we are meeting the client's needs. Sometimes I think where this starts is we see something the client hasn't mentioned, or says they don't think they're interested in. We *know* that it is valuable, and that they *need* the info - so we go digging to get it, to have it ready once they "come to their senses." This is probably not the best approach, and we need to do a better job understanding the client's scenario, what their end-goal is, and so on, so we can make valid recommendations to help reach that goal. We also need to do a better job helping the client understand the value of what we are offering - our expertise and potential testimony on the stand. After all, we're a consulting firm; we should *consult*.

9. Aah, scoping, planning, and then communications with the client. Okay, here goes... This ties in with the comments above. Our approach to a situation, the deliverable we're providing, and so on, should really be tailored to the individual needs of the matter. If we have a "fit in the box" approach, we do everyone involved a disservice. From this standpoint, there are probably times (however much we might not want to do so for whatever reasons) that we need to customize (or completely change) our User File approach (we have a proprietary process that starts with deNISTing and goes much much further; this is used in pre-culling for eDiscovery projects). One potential example that comes to mind is if a matter only stipulates that email, or MS Office documents, or PDF files are required, it might be reasonable to only produce those data types and save the client time and cost. Obviously, as Hal points out, communication with the client is key.

This is also true for investigations – while it's good to have an idea of a “standard” approach to a different type of investigation (misuse of resources, theft of IP, spoliation, etc), we need to make sure we understand what the client needs to accomplish, so we can tailor our approach to their needs. This way they get the benefit of the best possible results, and we don't waste time doing things that aren't going to help reach the goal.

So then we come to the communications part of Hal's response. Let's rub some more salt on that wound, why don't we (again, where I work we seem to struggle with this; some analysts don't seem to want to have a lot of interaction with the client)? We as analysts need to be better about direct communication with the client. There's a time to involve the account/project manager, but no one is better prepared to communicate technical details of our investigation than we are. And it's not just the aspect of making sure the client knows how we're progressing - it's the personal touch that makes a difference. The analyst, having ownership of the investigation, is able to make a personal connection with the client, and the client is going to remember them down the road (as Hal notes). Case in point, I have one attorney that sends me Christmas cards every year - and calls our company for more work - because of the relationship that developed while working on a case with him. And yes, I'm proud of that.
10. Wow, there's a lot here in this last section, and it is stuff that can probably get a lot of folks all fired up. I remember a while back we were asked to work defense on a criminal case. Regardless whether we wanted to turn it down or not, we were "required" to do so as a condition of our director's membership in the HTCIA - no criminal defense is allowed. I think Hal has a valid point in that everyone in this country is entitled to a defense, and it doesn't really seem "fair" that they be prevented from doing so by not being able to access the same resources (ie, forensicators) that are being brought against them. Obviously that gets into the political realm, but aside from that I think the most salient point he has is about scientific fact-finding being the foremost goal, not personal or professional agenda. We've certainly been involved in cases where the other side brought in their own experts, and a most contentious fight ensued as they weren't willing to admit that we were doing what needed to be done. These aren't criminal matters (since we don't typically work in that space), but the point is still the same - shouldn't we be working toward a common goal of fact-finding, rather than fighting about semantics (or other irrelevant issues)?

I guess on the other side of the issue, we try our best to do a top-shelf job, being professional and just looking for - and presenting - the facts. However, I've seen a number of firms that appear to be hired guns without ethics or morals, who are willing to say whatever their clients request, for the sake of a buck. To me, that's just sad.

Eric and Hal, thanks for a great interview and blog post. I enjoyed it. I hope others have as well. Just to give you a quick plug, yours is one of the (many) blogs I follow (and Command Line Kung Fu, of course). (Google Reader on my phone is a tremendous help during dead time while imaging at a client site!) I look forward to seeing new posts.

LM

Thursday, July 29, 2010

Forensic implications of MS Word ASD files

Microsoft Word .ASD (auto-save/auto-recovery) files.

Reference, MS KB Article ID: 107686, previously Q107686: http://support.microsoft.com/kb/107686

I had a case a while back in which Auto-Save/Auto-Recovery (ASD) files from MS Word were brought up. The other side made some allegations as to the purpose and function of ASD files that I did not believe to be true. In order to confirm this I read through the MS documentation, and did some testing, as follows...

Per the KB Article, the default is to create an .asd file every 10 minutes, in the default path: Documents & Settings\\Application Data\Microsoft\Word (note: this path can be changed manually)

The stated purpose, per the KB, is for recovery after a crash (system or application) where the document is not able to be saved properly the user; it is not a substitute for saving files, nor is it the same as the auto-save feature.

A quote from the KB: "AutoRecover files are not designed to be saved when a logoff is scheduled or an orderly shutdown occurs."

Per the KB, when Word starts, it looks in the default path for the presence of any .asd files; if found, it will display to the user, and prompts the user to "recover." Apparently when it opens the .asd file, it changes the extension to .wbk (depending on version of Word - Word 7.x uses .bak instead of .wbk, for instance). If the file is saved, or closed w/o saving, Word deletes the AutoRecovery version.

Through testing, my results (all work done in EnCase):
**Note: In between each "Open" or "Load" Word and/or EnCase are closed and reopened fresh.

Open existing DOC.doc, wait 10 minutes (minimum) and close w/o making changes or saving the document.
Load local HD, search for ASD, WBK - no results.

Open existing DOC, alter text with '.'
Wait 10 minutes minimum, then load local HD, search for ASD - it is present, with the file still open.
Save and close file.
Reload local HD, search ASD - no results.

Reopen existing DOC, make no changes.
Wait 10 minutes minimum, then load local HD, search for ASD - not present, w/o changes.
Remove previously added '.'
Wait 10 minutes minimum, then load local HD, search ASD - it is present, w/change, prior to saving.
Close DOC w/o saving change.
Load local HD, search ASD - it is present, as a deleted file.
Size is the same as the live file, and content (in hex or raw text view) shows the same as the real file.

Reload local HD (10 minutes later, minimum), search ASD - still present, as deleted file.
Reopen existing DOC, remove the previously added '.' Note: Word did not prompt for Recovery of a file.
Save corrected DOC.

Load local HD, search ASD - no results; it is now gone, since the file was saved (even though file wasn't opened from the auto-recovery feature).

Conclusions:

ASD file is ONLY created once the open file is modified (content changed), 10 minutes later.
It does take 10 minutes, even w/changes, for the ASD to come into existence.
If the file is closed w/o saving changes, the ASD goes into a deleted state, but still exists.
The ASD file matches the "real" file for size and content. Not sure about embedded metadata (I didn't test that)
If there is an ASD (even deleted), once the "real" file is opened and saved, the ASD automatically goes away.
Presuming that the MS KB is accurate, if a true, live ASD exists, it will go away (to a truly deleted state) once the file is recovered and closed/saved;
it may even go away if the file is not allowed to recover (haven't tested these, but it seems to be what the KB is saying).

Ultimately I was correct and was able to support this by my research and testing.

I guess I would say that the forensic implications are that Microsoft's documentation is not 100% complete/accurate, and one should not make assumptions about the state of ASD files simply based on "common knowledge." You may find such files on a system, and they don't *have* to be in the default directory.

Wednesday, July 28, 2010

Using Log2Timeline

Log2Timeline and forensic timeline creation


Creating timeline w/mmls, fls, log2timeline
This is really written with an image of a Windows system in mind. This was written as a guide for our lab (and me, to help remember), so keep in mind it's not necessarily intended to be a polished presentation. Some things were added/changed as my use of l2t progressed. The big difference between this and what has been published on the SANS blog and on Kristinn Gudjonsson's site is the use of 'find' and 'while' loops to recurse through directory structure instead of (for instance) going into each user profile for the ntuser.dat file.

These l2t cli bits of this are largely irrelevant now, with the introduction of the timescanner front-end (which does a great job of automating everything for you). However, there may (hopefully) be some other things of interest/use in different scenarios.

You do not have to extract the partition, but it's helpful to have a single image file for mounting purposes (I'm not sure about mounting a split image; at the least it will be easier to have a single/concatenated file)...

NOTE: Where something is enclosed such as [imagename] this includes full path to that file where needed; the "name" is a variable assigned by the analyst.

You need to gather partition info, which can be done with mmls or fdisk:

mmls [imagename] - this will show partition info (even from split image files), and you can identify whichever partition(s) you need (specifically you need the start point).
or
fdisk -ul [imagename]

To create the baseline bodyfile, use the following:
fls -m [original mountpoint, ie C:, /boot, etc] -r -f [file system type, type 'fls -f list' to find the values] -i raw -o [offset/start sector info from mmls] [path to imagefile] > [path to new bodyfile]
NOTE: The offset here is the straight info provided by mmls; it is not multiplied by 512 (sector info)

Variables here are:
C: - this is however you want it to show in the bodyfile for drive letter; keep in mind if you are working multiple partitions... (-m is what allows you to set this parameter)
ntfs - this will depend on the file system in question (-f denotes you will provide filesystem)
raw - this will depend on the image type (-i denotes you will provide image type)
offset info - as stated, this comes from mmls or fdisk (-o denotes you will provide offset)
recursive - this is denoted by (-r) which says you are recursing into all subdirectories

Bodyfiles are converted to timeline format w/mactime command (you don't do this now; it will happen at the end):
mactime -b [bodyfile] -d -m -y -z [timezone] 2000-01-31..2000-02-01 > [timelinefile]
Variables here are:
-m and -y: go together to establish date format - yyyy mm dd and day of week
-z: sets the timezone of the original system/image
-b: you will define the bodyfile to be used
-d: provides output in CSV format (this will add the timestamp to every line, even if it's the same second - you need this!)
dates: date range provided in yyyy-mm-dd..yyyy-mm-dd format - must use both, even for single day (in which case, the 2nd date MUST be one full day after) such as:2009-11-10..2009-11-11
NOTE: For original/main bodyfile, you won't use the date parameters; you want the entire system bodyfile intact (you will split out later if needed)
NOTE: There are some cases where you are having to process multiple bodyfiles into a single timelinefile, and want to use >> to append instead of overwrite. Be careful!

Creating log2timeline bodyfiles:
You can use the following to get lists of l2t variables/parameters:
log2timeline -f list

First you must mount the imageset loopback to be able to browse the filesystem for use w/l2t:
Multiply the Offset info (from mmls or fdisk) by the number of bytes per sector (also from mmls or fdisk), typically 512 (such as 63*512=32256)
mount -o ro,loop,offset=32256 -t auto [imagename] [mount point]
Variables here are:
offset: this will depend on the result of your partition math, as noted above

NOTE: I use mkdir to create my mountpoint, using things like "src" for source and "dst" for destination instead of relying on drive lettering (such as sdc1)

Now you can browse the mounted filesystem for your imageset, in order to create bodyfiles for l2t...

cd to any relevant profile, for ntuser.dat files
log2timeline -f userassist NTUser.dat > [UAbodyfile]
or from within Documents & Settings, do:
find . -iname ntuser.dat | while read d; do log2timeline -f userassist "$d" >> [UAbodyfile]; done ****This works better - more automated****

while within profile, run LNK files (if there are multiple users, do so within Documents & Settings):
find . -iname *.lnk | while read d; do log2timeline -f win_link "$d" >> [LNKbodyfile]; done

while within profile, run IE history (if there are multiple users, do so within Documents & Settings):
find . -iname index.dat | while read d; do log2timeline -f iehistory "$d" >> [IEbodyfile]; done

while within profile, run Firefox 3 history drill down into Application Data/Mozilla/Firefox/Profiles/xxxxxxxx.default and do:
log2timeline -f firefox3 places.sqlite > [FFbodyfile]
or from within Documents & Settings, do:
find . -iname places.sqlite | while read d; do log2timeline -f firefox3 "$d" >> [FFbodyfile]; done ****This works better - more automated****

cd to Recycler directory, and down into each S-1-5...
log2timeline -f recycler INFO2 > [RBbodyfile]
or from within RECYCLER directory, do:
find . -iname INFO2 | while read d; do log2timeline -f recycler "$d" >> [RBbodyfile]; done ****This works better - more automated****

cd to System Volume Information/_Restore/RP... for restore point info (you do not have to go into each subfolder)
log2timeline -f restore . >> [RPbodyfile]

cd to Windows/Prefetch directory for prefetch info
log2timeline -f prefetch . >> [PFbodyfile]

With all of your individual pieces, create a copy of your original system bodyfile, and add the l2t bodyfiles into it:
cp [bodyfile] [bodyfile2]
cat [XXbodyfile] >> [bodyfile2]

Repeat for each l2t bodyfile (denoted by the "XXbodyfile")

You now have a single bodyfile which contains all the l2t variables/optional bodyfile info. This is the point you will start splitting out timeline sections with date ranges:
mactime -b [bodyfile] -d -m -y -z [timezone] 2000-01-31..2000-02-01 > [timelinefile]

___________________

PS: I am very disappointed that Kristinn did not get the recognition he deserves through this year's Forensic4Cast awards. Log2Timeline is by far and away (in my book) the absolute best software contribution to digital forensics, and should have won that category hands down!

Monday, July 26, 2010

Computer Forensic Blog Intro

Computer forensics blog, 'forensicaliente' ~

So, the name is completely geeky, but hey, that should be worn like a badge of honor. Or perhaps a SANS Lethal Forensicator ROM (Round Metal Object, aka, 'coin')... :) No, I'm not sayin' for me, I'm just sayin'.

In looking for something in IT jobs that really truly interested me, I came across computer forensics (digital forensics, whatever you want to call it), and managed by the grace of God to get into the field. I have been working here for several years now and absolutely love it. I think it's the coolest thing since sliced bread, pockets on shirts, and so on. Or with slang/euphemisms being what they are, sometimes 'cool' = 'hot' and thus 'forensicaliente...'

As I work through problems, come up with questions to test and try, I have developed a fairly sizable Evernote library (or maybe not so sizable, who knows?). I finally decided to put things into a blog in the hopes that they may help others. That's one of the things I think is so neat about CF, that so many practitioners share so generously, and I'd like to contribute to the community as well.

While I won't likely be as prolific as some of the great forensic bloggers, I will try to start out with a number of posts from my library of notes, and add to it as I go along. I hope these are of use and benefit to others.


PS: And yes, the site is largely unformatted; I'll be working on that too.