SY110: Digital Forensics



Digital Forensics

Learning Outcomes

After completing these activities you should be able to:


Digital Forensics and the War on Terror

When terrorists or insurgents are captured, or when a hideout is discovered, one of the first orders of business is to search for computers, memory sticks, cell phones, and other kinds of electronic devices. Then operatives carry out forensic analysis on the electronic devices in hopes of finding information about things like attack plans, or identities of other terrorists.

For example, when Osama bin Laden's compound was raided, a wealth of digital data were captured: five computers, dozens of hard drives, and more than 100 other storage devices.

CNN Article, May 2012

Abbottabad Compound

What is Digital Forensics?

Forensics is the scientific analysis of physical evidence, as from a crime scene or other related incident. When we use the term 'digital forensics' we are referring to the analysis of events on an information system. From this evidence, we can reconstruct certain incidents and gather information about the user, the system, and the data affected.

When might we want to reconstruct a sequence of digital events? If a server is hacked and we need to know how it was done or even when, we want to check the status of our system. The sexiest of the digital forensic scenarios is more CSI style: you recover a computer and you want to know what kind of shenanigans were done with it. You might be looking for criminal evidence or traces of certain events. We'll focus on that kind of scenario.

Locard's Exchange Principle

In traditional, CSI-style forensics, one of the guiding concepts is Locard's Exchange Principle, which speculates that every time you make contact with another person, place, or thing, it results in an exchange of physical materials. Thus, in the commission of a crime, the perpetrator leaves something at AND takes something from the crime scene. These "somethings" are evidence. More colorfully:

Wherever he steps, wherever he touches, whatever he leaves, even without consciousness, will serve as a silent witness against him, his fingerprints or his footprints, but his hair, the fibers from his clothes, the glass he breaks, the tool mark he leaves, the paint he scratches, the blood he deposits or collects. All of these and more, bear mute witness against him. This is evidence that does not forget. It is not confused by the excitement of the moment. It is not absent because human witnesses are. It is factual evidence. Physical evidence cannot be wrong, it cannot perjure itself, it cannot be wholly absent. Only human failure to find it, study and understand it, can diminish its value. — Paul L. Kirk. 1953.

Locard's principle holds in the digital world as well and, in fact, it holds whether you are perpetrating a crime or not. We have seen several examples of this already.

A few more examples of "things you leave" on remote hosts

In addition to visiting websites, one of the ways we've seen that we "go somewhere" in the cyber world is by using SSH to get a terminal on a remote host. It's interesting to see what you leave behind when you do this:

  1. Login attempts: Every attempt you make to login to a system, successful or not, is logged! On ssh.cyber.usna.edu, for example, there is a file /var/log/auth.log that the sysadmin (System Administrator) has access to, that contains a log entry for every successful and unsuccessful attempt to login. Here's an example of a few entries:
    Nov  1 08:38:05 ssh.cyber.usna.edu sshd[3962]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=131.122.6.104  user=mxxxxxx
    Nov  1 08:38:05 ssh.cyber.usna.edu sshd[3962]: Accepted password for mxxxxxx from 131.122.6.104 port 49961 ssh2
    Nov  1 08:38:05 ssh.cyber.usna.edu sshd[3962]: pam_unix(sshd:session): session opened for user mxxxxxx by (uid=0)
    This tells us that at 8:38am on 1 November, someone at host 131.122.6.104 tried to login as user mxxxxxx, gave the wrong password, then tried to login again and was successful. Think about how this could be used to track someone who was doing or trying to do bad things!
  2. Commands executed: Every command you execute is logged! On ssh.cyber.usna.edu, for example, the sysadmin has a tool called lastcomm that lists every command executed by any user. Here's an example of a few lines output by the command:
    md5sum                 mxxxxxx  ??         0.00 secs Thu Nov  3 07:36
    bash              F    mxxxxxx  ??         0.00 secs Thu Nov  3 07:36
    ssh                    mxxxxxx  ??         0.00 secs Thu Nov  3 07:36
    bash              F    mxxxxxx  ??         0.00 secs Thu Nov  3 07:36
    What do we learn from this? We learn that at 7:36am on 3 November user mxxxxxx computed an MD5 hash and then ssh'd to some host. Think about how that might be used as evidence.

    In fact, there's a command called history that will bring up the last N commands you've given, along with arguments like filenames, etc. If you login to your ssh.cyber.usna.edu account and give the history command, you'll see all the commands probably that you've ever given on ssh.cyber.usna.edu!

A few more examples of things that stay with you on your machine

Altering the registry on a Windows system can lead to system instability or system crashes. Do not modify registry data unless you know what you are doing. In SY110 we will not have you modify registry values, you will only read registry values.
Follow the below steps to launch an alternate version of regedit:
  • Direct from Search Dialog, Run Dialog, or an Administrator shell:
    1. Enter command: regedt32
    2. If prompted, click Yes in the User Account Control dialog.

The digital forensics lab will explore the kind of information that stays behind — perhaps unexpectedly — on your Windows computer. So we mention only a few examples here (these are the typical locations, although exact locations may vary due to operating system version, implementations, and local IT policies):

  1. Browser cache: C:\Users\m9999\AppData\Local\Google\Chrome\User Data\Default\Cache
      - Browser history: Ctl + H
      - Browser history in the file system: C:\Users\m9999\AppData\Local\Google\Chrome\User Data\Default\History
  2. Recently accessed files: If you launch regedit and look under:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs
    you will see a list that shows files that you opened recently, sorted by file extension. If you right-click and choose "Modify", you'll see the file names.
  3. Networks you've been on:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures
    and then look under both Managed and Unmanaged you'll see among other things the MAC Addresses of the Gateway Routers for networks you've been on.
      - View previously connected wireless networks: netsh wlan show profiles
  4. "Meta-data" in documents: Programs like Microsoft Word store "meta data" in the documents they create. For example, if you right-click on the icon for a Word file, choose "Properties," and look under the "Details" tab, you often find information like the name of the document's author, an e-mail address, the username of the author, and so forth. These documents that get published to the world may leak information that could be used for evil purposes.

File Carving

File carving is an incredibly useful skill to have in the world of digital forensics. It is the process used in computer forensics to extract data from a storage device after the files have been deleted, the device has been erased, or the device has been damaged. But, at this point, the data on the device just looks like a sequence of "raw bytes" — meaning a sequence of bytes without any information as to where any file begins or ends in the sequence of bytes. In order to extract valuable data from these raw bytes, file carving is necessary.