Table of Contents

System Forensics, Investigation, and Response

Day 1

port 445 for windows – fileshares, cifs, smb fileshares, netbios a little, direcotry services, rpc, lots of stuff.

0xEBFE jumps back two spaces and loops to produce a processor spike.

Computer Forensics Primer..5

AUP should wave all rights of privacy.

  1. Does the person who gave you computer have authority to investigate machine?
  2. Do you have the authority to investigate machine? Forensics must be part of job description. (Forensic Investigator or Forensic Analsys)
  3. Who approved you to start case.
  4. Make sure you have approval. (cya)

# Following best practices (like chain of custody) of data integrity is used to show expertise in handling evidence. Law enforcement is leagaly bound to follow chain of custody rules. Absence of tampering cannot be used to throw out evidence because it 'could' be tampered with. Evidence of tampering must be present to bring up evidence tampering arguments.


# live image

Forensic Investigation Methodology..19

File System Essentials..30

physical

Drive itself

first 512 bytes(one sector) are MBR

In MBR are partition table and boot loader (LILO, Grub, Windows has one, partition magic has one)

length of partions is in MBR

partition ends in 55aa

DOS based partitions are used by x86 Intel systems despite OS

the 512 byte MBR can have a max of 4 partitions max in MBR

partition table tells starting sector, number of sectors and type (ext3, ntfs, swap)

one of the 4 can designate an extended partion

At the begining of the extended partion is a 512 byte sector of another partition table, or an extended partition table.

file system

uses 512 byte sectors

cluster, fragment or block (depending on OS) can be multiple sectors.

data

everything sits at the data layer

metadata

Similar to Card Catalog

Generic name for metadata is inode. In windows ntfs=master file table entry; fat=fat directory.

many blocks or cluster can be associated with a file,

filename

How the three layers interact

  1. Physical layer–Hard drive
  2. File system Layer–includes partitioning information
  3. Data Layer–Start of partition, addressable block or cluster. allocated/not allocated. multiple sectors.
  4. metadata layer is card catalog. points to data layer
  5. filename points to inode number.

Page 42 has Partition table entry contents

mount (to determine the device name)
dd if=/dev/hda bs=512 count=1 of=mbr.img

Linux FileSystem Basics (Ext2 and EXT3)..56

Linux Ext2/Ext3 File system layer (Superblock)

  1. Block size
  2. Total Number of Blocks
  3. Number of Blocks per group
  4. Number of reserved blocks(prior to first block group.)
  5. total number of inodes
  6. number of inodes per block group

table of contents at each block group Page 58

inode has enough pointer for 12 addressed. 13th entry is an indirect block list. 14th is double indirect block.

Windows File System Basics..70

Day 2

Forensic Methodology Illustrated

Network Forensics..9

If there is suspician of activity, install a wiretap. Since you are protecting your network, there is legal precedent to use a wiretap. There must be “probable cause.”

Law enforcement, however, must have a supena.

Hackers will start out doing a

whois

lookup which gives information about primary network, mail exchange leading to internet cache, newsgroups, administrators asking questions leading to OS type, firewalls, etc.

packet 1776 has ftp data string. Filter on that.

tcp port == 24 shows putty

Linux Compromise: Forensic Verification..13

Helix..22

Set up forensics workstation to receive data via netcat

cd /images/unixforensics
nc -l -p 31337 > vmware_memory_dump

Use the programs from the cd. Memdump output should be sent via netcat (nc).

mount /dev/cdrom
cd /mnt/cdrom/Static-Binaries/linux_x86
./memdump | ./nc -vv 192.168.2.1 31337  

Output can be sent via netcat (nc), just set up listener on forensics workstation.

./uptime
./uname -a
./date
./fdisk -l
./mount
./netstat -anp
./lsof -n
./ls -lit

on forensics workstation:

cd /images/unixforensics
nc -vv -l -p 31337 > vmware_bodyfile/mac

on hacked machine:

mount /dev/cdrom
cd /mnt/cdrom/Static-Binaries/linux_x86
./mac-robber / | ./nc -vv 192.168.2.2 31337  

on forensics workstation:

cd /images/unixforensics
mactime -b vmware_bodyfile.mac > timeline-vmware.txt
less timeline-vmware.txt
  * MACtime Evidence..46
  * Volitile Information..47
  * Creating a Timeline..48
  * Creating your First Timeline..51
  * **mac-robber** Usage..52
  * **mactime**..53
  * Searching the file system [timeline]..57

commands hacker initially used

w
last
add user jack 
changed password to jack -checks password sc
secure copy rootkit
netstat 
top 
ps
creates /usr/sbin/mkxfs
creates /dev/ida/.. /sl2
/dev/ida/.drag-on

commonly trojanized files

these files look odd because the c time is only modified

ifconfig
ps
netstat
top

files with just a time have been accessed or executed.

logclear
linsniffer
.drag-on
..(space)

The modification times indicate that the innodes themselves werer changed (likely indicating that the files were decompressed). The c time shows that the files themselves were modified, which typically hpapens during installation.

lsof and netstat

set up nc listener

./lsof -n | ./nc 192.168.2.2 31337
./netstat -nap | ./nc 192.168.2.2 31337

lsof is a process list of open files on the system listing even deleted files that are still in use.

mkxsf is probably a trojanized ssh

inodes are sequential on a newly installed system.

./ls -lit /usr/bin | ./sort | ./less

directories to look at are /usr/bin, /usr/sbin, /sbin

To look at all files:

./ls -litR

if files are modified, they will have sequential inode allocations also. Look for very high or vary low numbers

Evidence Integrity..70

md5sum

./md5deep -r / | ./nc 192.168.2.2 31337 -w 3
  * National Software Reference Library..76

Forensic Imaging..77

dd if=INFILE of=OUTFILE

    bs= block size
    count=N
    skip=N
    conv=noerror,sync

ddfcl if=INFILE of=OUTFILE

    hashwindow=0 (entire machine)
    hashlog=drive.md5.txt

Host Protected Area

disk_stat /dev/hdb

removal (temporary)

disk_reset /dev/hdb

Before imaging nc these commands

mount
fdisk -l

On Forensics workstation:

cd /images/unixforensics
nc -l -p 31337 > vmware_dev_sda.img
md5sum vmware_dev_sda.img

On hacked machine:

mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom/Static_Binaries/linux_x86
fdisk -l
mount
./ddfcl if=/dev/sda hashwindow=0 | ./nc 129.168.2.2 31337

mmls disk1.dd if mmls cannot determine the type, try

mmls -t dos disk1.dd
dd if=disk1.dd bs=512 skip=62 count 1028097 of=part1.dd

the first extened partition is numbered 5 and then not from there on.

do not normally extract extended partitions; they are just boundaries.

the first 512 bytes contains the MBR. At byte 446 is the start of the partition table. Each entry is 16 bytes long. The last 8 bytes are useful. The last four are the length of the partition and the four before that are the offset. Don't forget to add 63 for the partition boundary(?).

mount root then mount the other partitions in there.

mount -t ext2 -o ro,loop,noexec vmware_dev_sda6.img /mnt/hack/unixforenseics_mount
mount -t ext2 -o ro,loop,noexec vmware_dev_sda1.img /mnt/hack/unixforenseics_mount/boot

Day 3

Grab - GUI Imaging Interface..104

Linux Media Analysis..108

Critical Tool Overview..110

Identifies file by using a configuration file called the magic file across systems.

/usr/share/directory/magic

Usage:

file <filename>

0:25:00

/usr/share/backgrounds/images/earthfromspace.jpg
/usr/share/backgrounds/images/stonebird.jpg

Each has the same starting byte string.

Thought process number 1.

Look for header then look for footer. All in between is the image.

Side note: Vulnerability in Microsoft jpeg rendering. Heap overflow in comment string. Length always did -2 to find the comment field, so a value of less than 2 would give a really large number for a signed integer.

displays 4 or more ascii characters List byte offset of string on the image:

strings --radix=d

byteoffset–>block number–>inodenumber–>metadata–>Filename

byteoffset/block size=block number

file size and name stored in metadata

datalayer comprised of data blocks

  1. Idenfiy block the string sits in.
  2. Find inode number with that block.
  3. Then find filename.

Linux Media Analysis: The Sleuth Kit..123

File System Layer..133

fsstat dev_sda6.img | less

Data Layer

dstat gives Allocated or Unallocated for a data unit

dstat dev_sda6.img 368055

dcat displays contents of a data unit

dcat dev_sda6.img 368055 |less

for hex display:

dcat -h dev_sda6.img 368055 |less

lists contents of unallocatted data (by default)

  1. e dhoe sll blocks
  2. l lists details
  3. s show slack space (no slack in linux)

extract all unallocated data:

dls dev_sda6.img > dev_sda6.dls

extract between 8000 and 9000:

dls -el dev_sda6 8000-9000

since the blocks are now not in the same sequence because the allocated blocks are removed, use dcalc to cross to the origial block unumber

dcalc dev_sda6.img -u 233429

gives:

368055

takes every single data block and runs file against it.

carves out files based and sorts them on file header

mkdir /images/unixforensics/foremost_gzip (need to create a directory where the output will go)
foremost -o /images/unixforensics/foremost_gzip -c /usr/local/src/foremost.conf dev_sda6.dls

may need to remove the 13 data block. In the example, open in khexedit and got to blocksize(4096)*12 position. Delete blocksize(4096) amount of data.

in audit.txt, the gzip file is listed at byte offset 98304

98304/4096=24 (block number in unallocated dls file)
dcalc dev_sda6.img -u 24
8171  (block number)

Metadata Layer..164

give ifind the block and it will return an inode number that is/was associated with it.

ifind dev_sda6.img -d 8171
2880

displays metadata information about an inode

istat dev_sda6.img 2880

list inode information

ils dev_sda6.img |grep 2880

copies files by inode number

icat -r dev_sda6.img
icat -r dev_sda6.img 2880 > /images/unixforensics/lk.tgz

Filename Layer..181

takes inode of directory and displays filenames in directory.

fls dev_sda6.img
fls -l dev_sda6.img
fls dev_sda6.img 174593

SleuthKit Exercises..190

Advanced Timelines Deleted Files and Unallocated Metadata..200

like mac_robber, the folloing will create the timeline information

  1. m tells the mount point to prepend the output with
  2. r says recurse directories

fls -m / -r dev_sda6.img > /images/unixforensics/dev_sda6.fls or on live system

fls -m / -r /dev/sda6 | less

extracts data on deleted inodes yet without the missing filename infomation

ils -m dev_sda6.img > /images/unixforensics/dev_sda6.ils

integrate them with cat

cat dev_sda6.?ls > dev_sda6.mac

the question mark says any charater

make the data human readable

mactime -b dev_sda6.mac > timeline_sda6.all
-d for comma deleniated

File Content Type..211

uses file to categorize everything on the system including deleted files, put them in directories.

Indexes and searches the database

hfind -i md5sum linux_hash.txt
hfind linux_hash.txt <md5 hash>
    * sorter and hashes..220

hash all files

md5deep -r / > /mnt/LinuxFC3.txt

Use database to exclude known good files with sorter:

sorter -d sorter_dir -x LinuxFC3.txt hda1.dd

Autopsy Forencis Browser..221

Review..270

Forensic Investigation Methodology..271


Day 4

Windows File System Forensics..1

Windows Compromise: Forensic Verification- network capture..5

# smb ports are 139,445

In middle pane, filter on SMB Header, SMB Command: NT Create AndX (0xa2) will show filenames

This will include a bunch of junk.

Just save as RAW and edit in HexEditor searching the the file header listed in the file data section of wireshark. In this example 4d5a9000, then copy out the number of bytes specified in the packet 'Write AndX Request

Windows Incident Response..18

use an existing share or add a share of the cdrom using system_config_samba so the binaries will be available. restart smb.

Stand alone machines with xpsp2, the firewall will block port 445. As a part of domain, it should be open.

Date, Time, Uptime

Use the code in d:\IR\Cygwin on the Helix CDRom

date
time
uptime
hostname
uname -a
id
whoami

d:\IR\sysinternals\psinfo.exe

psinfo

Determine system environment.

Install date can be a clue that someone has tampered with a system.

Determine system running processes

d:\IR\sysinternals\pslist.exe

pslist

gather open ports and sockets. Determin which apps are listenting for network connections.

Shows current listening ports

d:\IR\Foundstone\fport.exe

fport

http://www.spectorsoft.com/ rootkit that is non hacker relaed to grab screenshots, email keylogger, all knds of stuff for $100.

Automatically record everything they do on the internet.

Windows Media Imaging..55

for win2k, xp, 2003

d:\IR\FAU\dd.exe

\\.\PhysicalDrive1 If doing Physical drives, it is still better to use linux

\\.\C:

^Name^Windows^Linux^

Physical\\.\PhysicalDrive0/dev/hda /dev/sda
Logical\\.\C: \\?\Volume{cc5deda7-d558-11d5-9226-806d6172696f}/dev/hda1 /dev/sda1

D:\> dd.exe if=\\.\PhysicalDrive0 of=E:\drive0.img

D:\> dd.exe if=\\.\C: of=E:\images\Cdrive.img Use logical imaging for RAID's

D:\> dd.exe if=\\.\PhysicalMemory of=D:\images\mem.img conv=noerror An EOF error is normal.

memparser <image of memory>

D:\> dd.exe if=\\.\C: of=D:\CDrive.img –md5sum –verifymd5 –md5out=D:\CDrive.md5

of=\\server\share\output.img image memory over network share:

  D:\> dd.exe if=\\.\PhysicalMemory of=\\Linuxforensics\images\windowsforensics\mem.img --md5sum --verifymd5 md5out=\\Linuxforensics\image\windowsforensics\mem.img.md5 conv=noerror
  D:\> dd.exe if=\\.\C: of=\\Linuxforensics\images\windowsforensiscs\CDRIVE.img --md5sum --verifymd5 md5out=\\Linuxforensiscs\images\windowsforensics\CDrive.img.md5

Windows Forensics Using Linux..84

mount -t ntfs -o loop,ro,umask=0222,uid=forensic,gid=users /images/windowsforensics/hacked_ntfs.img /mnt/hack/windows_mount

mount -t ntfs -o umask=0222,loop,uid=forensic,gid=users,show_sys_files=true /images/windowsforensics/hacked_ntfs.img /mnt/hack/windows_mount/ showes $shares

  mount -t smbfs -o ro,noexec,username=administrator //Winforensics/C$ /mnt/windows_forensic_server
  1. Share C on compromised machine
  2. mount C through Linux SMBFS in READ-ONLY mode
  3. Share out directory form linux using SAMBA
  4. Any machine can now examine the compromised machine without changing any of the files

use dls on the linux machine on the image.

dls -f ntfs hacked_ntfs.img -s > ntfs.slack

lazarus, foremost, dirty word search

slack space is tough to get a case from.

Windows Media Analysis..95

to examine index.dat file on linux

pasco 
  * Recycle Bin..107

Subfolder created with users sid where files are placed. files in recycle bin are not named by their normalnames. Time and date stamps remain. INFO or INFO2 file keeps a map of the original filename and location.

rifiuti can examine an INFO2 file

fifiuti INFO2

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Explorer Bars\{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}\FilesNamedMRU

HKEY_CURRENT_USERS\Software\Microsoft\Internet Explorer\TyperdURLs

HKEY_CURRENT_USERS\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU

  HKEY_USERS\S-1-5-21-1801674531-1563985344-839522115-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*

a tool to read last time a key was written

keytime <full key path> (case sesitive)

Windows Challenge..123

Day 5

Computer Investigative Law for Forensic Analysts..1

Topics Overview

Who Can Investigate:

Crimes of Damage Outsider (Hacker or Trespasser)Insider Some Authority
Intentional DamageFelonyFelony
Reckless DamageFelonyNo Crime
Other DamageMisdemeanorNo Crime

Acquiring Data:

contents of communicationsHeaders, logs, and other information
Access to stored communicationsECPAECPA
Real-time interceptionWiretap ActPen/Trap statute

* Network Devices..60

Your use of this network constitutes consent to monitoring and disclosure of the fruits of monitoring. You have no reasonable expectation of privacy on this network

Post Collection: Data Preservation..85

Data Analysis Investigative Report..88

Report Writing Fundamentals..91

Presentation in Court

Day 6

Binary Analysis..2

Process Wiretapping..25

Malware Dissection..36

x2 is the program

gdb x2

objdump -x x2

readelf -a x2

The Forensic Challenge Hands-On Case Study..70

The Analysis..95

Analysis Results..100

File Analysis..105

Unallocated Space Analysis..146

Swap Space Analysis..149

Find something on these

lots of 0x90's in a transmission is buffer overflow attack winalysis least privilage Pen-trap, trap and trace WinHex substantial nexus

another file recovery tool - Rapier

http://www.citadelsystems.net/index.php/forensics-tools/34-data-carver/46-rapier