34
For Forensics Sake… What to do when IR Strikes By : Joe Gumke Joe Gumke Twitter : @joegumke

For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

For Forensics Sake…What to do when IR

StrikesBy : Joe Gumke

Joe GumkeTwitter : @joegumke

Page 2: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Presentation Overview

1. Incident Response Lifecycle

2. Forensic Artifacts

1. DISK & RAM

3. Demo

Page 3: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Incident Response Lifecycle

1.Preparation• creating documentation, building tools, etc.• Understanding of

assets/software/environment2.Identification• moment victim becomes aware an attack has

occurred3.Containment /Intel Development • keeping further damage from occurring.4.Eradication/Remediation• Remediating compromised hosts, removing

implants, etc.5.Recovery• restoring all business functions6.Lessons Learned • How can we do better next time?

Page 4: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

NIST

u NIST SP 800-61

Page 5: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Importance of IR Timeline

u Documentation/Consistent Timeline Usage

u SANS Timeline Documentation

u SANS Incident Forms

Page 6: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Artifacts Logic Format

u Who – Is causing this activity?

u What – activity are we trying to identify ?

u When – Did this artifact occur (timeline) ?

u Where -- Is this located on the system ?(if applicable- OS dependent)

u Why – Is this artifact important?

u How – To use them (commercial/open source tools)

Page 7: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Acquisition Types

u Memory Acquisition

u Software

u Logical Acquisition

u Enterprise Acquisition

u Physical Acquisition

u Write Blocker

Page 8: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Order of Volatility

Order of Volatility of Digital Evidence

1. CPU, cache and register content

2. Routing table, ARP cache, process table, kernel statistics

3. Memory

4. Temporary file system / swap space

5. Data on hard disk

6. Remotely logged data

7. Data contained on archival media

Page 9: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Artifact Retrieval Tools

Commercial Free/Open Source

Encase Forensics Rekall Framework

FTK Google Rapid Response

Tanium Winrm / Powershell

F-Response FTK Imager Lite

Page 10: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

SIFT Workstationu https://digital-forensics.sans.org/community/downloads

Page 11: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

RAM - Memory

u Processes

u Network Connections

u Open Files

u Configuration/Command Line Parameters

u Loaded DLLs

u Open files and registry handles

u Network information

u Passwords and cryptographic keys

u Unencrypted content

u Hidden data and files

u Malicious code

Page 12: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

RAM - Memory

Tools To Acquire Tools To Analyze

FTK Imager volatility

Dumpit.exe > Moonsols Rekall framework

Mandiant Memoryze Mandiant redline

winpmem F-Response

Caploader (packets)

Page 13: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

RAM - Memory

Mandiant Redline Volatility

GUI Command Line

Outdated Update To Date

Ease of Identifying Indicators Harder to Spot Evil

Volatility Usage : $ python vol.py [plugin] -f [image] --profile=[profile]

Volatility Example :$ python vol.py pslist -f /path/to/memory.img --profile=Win7SP1x64

Page 14: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Virtual Machine RAM

u Vmware >> .vmem = raw memory

u Fusion: /users/<username>/Documents/VirtualMachines/

u Workstation: <Drive Letter>\XXX\My Virtual Machines\<VM Name>

u ESX:<DatacenterName>\<DatastoreName>\<DirectoryName>\<VirtualMachineName>

u Microsoft Hyper-V >> .bin = memory image / .vsv = save state

u Location : <Drive Letter>\XXX\<VM Name>\Virtual Machines\GUID\

u Parallels >> .mem == raw memory image

u Location : /Users/<username>/Documents/Parallels/<VM Name>/Snapshots/

u VirtualBox >> .sav = partial memory image

u Location : .VirtualBox/Machines/<VM Name>/Snapshots/

Page 15: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Other Memory Objects

u Hibernation file :

u Compressed RAM Image

u Location : %SYSTEMDRIVE%\hiberfil.sys

u Memory dumps u Complete/Kernel/Small/Automatic (Default) > Same as Kernel

u Full crash dump will be complete copy of RAM

u Location : %WINDIR%\MEMORY.DMP

u Page/Swap Files

u %SYSTEMDRIVE%\pagefile.sys

u %SYSTEMDRIVE%\swapfile.sys (win8+\2012+)

Page 16: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

RAM - Memoryu Items Of Interest

u Suspicious Process Names

u Suspicious Process Path

u Suspicious Network Connections

u Rogue Processes:

u Incorrectly Named Image/Executable Name

u Incorrect / Suspicious File Location

u Suspicious Parent Process

u Suspect Command Line and parameters used

u Start Time Information Vs Boot Time

u Security Identifiers (SIDs)

Page 17: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

MFT – Master File Table

u NTFS

u Hidden file on the windows file system.

u Will be created on the system until disk is reformatted

u Location : \$MFT

u Backup MFT called : $MftMirr > first four records of MFT

u USRJournal > Records(in $Extend\$UsnJrnl) changes to files, streams, and directories on volume

u Volume Shadow Copy > keeps historical versions of files and folders on NTFS volumes

u LogFile > record metadata changes to the volume

Page 18: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

MFT – Master File Table

u DISK Forensics

u AnalyzeMFT : https://github.com/dkovar/analyzeMFT

u Memory Forensics

u Volatility Plugin > mftparser

u Example :

Page 19: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Windows Event Logu Security – populates authentication events

u System – Windows System components activity

u Application – tied to applications that leverage windows api, otherwise look for local application event logs

u Forwarded Logs (Subscription Logging)

u Old Event ID (EVT) + 4096 = New Event ID (EVTX)

Page 20: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Windows Event Log

u Disk Forensics

u Will Ballenthin EVTX Parser

u Command line : wineventvwr.msc

u Event Log Explorer

u FTK Imager Lite to copy locked files

u Psloglist (sysinternals)

u Memory Forensics

u Volatility Plugin : evtlogs (xp/2003 only)

u Volatility Plugin : evtxlogs (vista+)

Page 21: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Registry Artifacts

u Hives Contain Keys/Valuesu Location : C:\windows\system32\config\

u NTUSER.DST : $USERPROFILE\NTUSER.DAT

u Keys = Folders

u Values = data stored in keys

NTUSER.DAT SAM SYSTEM SOFTWARE

• User Activity • Profile Users • Password Policies • Group Information

• System Configuration • Time Zone• Network Interfaces

• Analyze USB Devices• Windows Version• Install Date of Machine

Page 22: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Registry Artifactsu NTUSER.DAT

u UserAssist Keysu Displays a list of the programs run by a user on Windows

u Location : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist

u Didier Stevens Userassist

u Shellbagsu Based on structure of what you see when you view files via windows explorer

u Tracks user window viewing preferences

u TZWorks Shellbag Parser

u MRU Listu Most Recently Used List from user

u Regripper

u MUI Cacheu Another Location to see if an executable has been run (doesn’t list the run time)

u NIRSOFT MUICacheView

Page 23: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Registry Artifactsu DISK Forensics

u Command line : regedit

u Regripper

u YARU (Yet another registry utility)

u Memory Forensics

u Volatility Plugin : dumpregistry

Page 24: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Registry Artifacts – Live Box FTK

Page 25: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

SHIM Cache

u Application compatibility for windows

u Current versions of windows continually attempt to identify if application runs better on previous version of windows

u Each version that runs on the windows system is a SHIM

u Tracks compatibility issues

u Records file path, size, last modified, last exec time (if supported by OS)

u Located : Windows SYSTEM registry hive

u (HKLM\SYSTEM\CurrentControlSet\Control\SessionManager\AppCompatibility\AppCompatCacheHKLM\SYSTEM\CurrentControlSet\Control\SessionManager\AppCompatCache\AppCompatCache)

u Mandiant ShimCacheParser

Page 26: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Prefetchu Introduced in Win XP, designed to speed up the application startup process

u Identifies when applications run

u Prefetch file format :

u name of the executable

u list of DLLs used by that executable

u count of how many times the executable has been run

u timestamp indicating the last time the program was run

u Prefetch Directory limited to 128 files

u Win 7+ with SSD drives, not enabled by default

Page 27: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Prefetchu DISK Forensics

u LOCATION: C:\windows\prefetch

u FileName Structure: <executable filename>-<prefetch hash>.pf

u TZWORKS Prefetch

u Memory Forensics

u Volatility : PrefetchParser

Page 28: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows
Page 29: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

RAM Items of Interestu Volatility Screenshot

Page 30: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

RAM Items of Interestu Volatility: iehistory

Page 31: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

RAM Items of Interestu Volatility: mimikatz

u Volatility: hashdump

u Volatility: lsadump

Page 32: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Home/DIY Logging Fun

u HP Arcsight Logger

u Logrhythm Network Monitor Freemium

u AlienVault OSSIM

u Suricata IDS

u ELK Stack

u Bro network sensors

u GrayLog

u Apache Metron

Page 33: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

Links / Resources

u Forensic Artifacts

u SANS Blog

u Harlan Carvey

u Didier Stevens

u Forensics Wiki

u Digital Evidence - Best Practices

u SANS Memory Forensics Cheat Sheet

u SANS Digital Forensics Cheat Sheet

Page 34: For Forensics Sake… What to do when IR Strikes - NDSU · 2017-03-22 · Registry Artifacts uNTUSER.DAT u UserAssistKeys u Displays a list of the programs run by a user on Windows

DEMO