Showing posts with label notes. Show all posts
Showing posts with label notes. Show all posts

Monday, November 17, 2008

Network Logs

rhino.log
rhino2.log
rhino2.log

Network Tools

Just to recap, here is a list of tools that we have been using for network forensics:


Chaosreader

Chaosreader can extract images from the network log files (though not all as we saw) and will print out a nice html report of all the flows.

Here is Chaosreader in action:


Full Screen

It can provide a nice start for making sense of the log file and locating connections of interest. However it doesn't extract all files of interest.

Etherape

Etherape allows you to see the traffic as a graphical representation. You can have it listen on a live device, or you can feed it a network dump file. Here is a video of etherape:



Full Screen

p0f

p0f is a passive OS identification tool. It uses three tests:

1) SYN packet test, where it watches outgoing SYN packets
2) Using the -A switch enables the SYN+ACK test
3) Using the -R switch enables the RST+ACK test

You can have it run on an interface by using the -i switch and interface name, or against a dump file using the -s flag.

snort

Snort is an intrusion detection system, but can also be used to read files. You have been supplied with alert files that were created by snort against the dump files given to you. When running snort you can use flags to make it read in a file. Here are the flags that were used to create the alert files:

# snort -c [config_file] -r [dump_file] -l [directory]

-c lets snort know which configuration to use
-r lets snort know which file to read
-l lets snort know where to write the log files


A brief snort video:


Full Screen


tcpdump

Tcpdump can be used to capture network traffic. When doing so, you let tcpdump know which device to use to read packets using the -i switch. If you want to save the traffic, you can use the -w switch. You can also specify the size of each packet saved by using the -s switch. Here is an example usage:

# tcpdump -i eth0 -s 1515 -w file.lpc


Tcpdump can also be used to read traffic data from a network dump file by using the -r switch followed by the name of the file you want to read. Here are some other switches you should use:

-n used to get only IP numbers
-nn don't translate IP and port numbers
-x used to get hex data of packets
-X used to get hex and ASCII data of packets
-c used to specify a number of packets
-e used to get link layer headers (MAC addresses)


One can also specify other items for tcpdump to look for in the traffic. Here is a TCP header:

tcp header

With all TCP traffic there are flags that are associated with the conversation. Here are some flags of interest:
  • SYN – Synchronize sequence numbers
  • ACK – indicates an ACKnowledgment
  • PSH – Push function
  • RST – Reset the connection
  • FIN - close connection


When a TCP connection is first made, there is a 3-way handshake that must occur before data can be sent. The handshake consists of:

1) A SYN packet sent to the server from the client
2) Response of SYN-ACK from the server
3) An ACK sent back to the server from the client

Seen below:


Therefore, one is often interested in SYN packets and can search for them using tcpdump. If you look at the TCP header you can see that the flags are located in the thirteenth byte. Therefore we can tell tcpdump to look in the thirteenth byte and give it the value. Since the SYN flag is the second one from the right, it has a value of 2 (think binary). So one usage is:

$ tcpdump -n -r [file.lpc] 'tcp[13]==2'


If you want to see packets with the SYN flag (and other flags) set you have to use bitwise AND:

$ tcpdump -n -r [file.lpc] 'tcp[13] & 2 == 2'


Likewise SYN+ACK has a value of 18, since the ACK flag is in location 4 (zero based) from the right which has a value of 16 and since SYN has a value of 2, we can change the total value to 18:

$ tcpdump -n -r [file.lpc] 'tcp[13]==18'

Or Hex:

$ tcpdump -n -r [file.lpc] 'tcp[13]==0x12'


You can also use the tcpflags option:

$ tcpdump -n -r [file.lpc] 'tcp[tcpflags]==2'


You can also indicate a particular host:

$ tcpdump -n -r [file.lpc] 'tcp[13]==2' and host [IP]


tcpxtract

Tcpxtract can be used to extract files from network dumps. We found that it crashed on some dumps with a segmentation fault however while we were doing our analysis.

tcpflow

Tcpflow is a really nice tool that can be used to rebuild conversations between two machines. Therefore we can use it to extract files. Here is a basic usage:

$ tcpflow -r [file.lpc] -c port [port number]


The -r switch works as before to indicate which file to read. The -c flag says put output to stdout. The port option lets one indicate which port number to use to construct a stream.

Here is a video of tcpflow being used to extract a JPEG file after finding it with chaosreader:



Full Screen

Therefore, if you have a lot of ftp connections, you can extract all files from the streams by using port 20 in the tcpflow command. Why port 20? Because an ftp connection uses two ports: 20 and 21. Port 21 is the control/command port (the connection all your typed commands go to) and port 20 is the data connection where the files get uploaded. You can use it on Venus, just issue the following commands:

$ wget
ftp://ftp.circlemud.org/pub/jelson/tcpflow/tcpflow-0.21.tar.gz
$ tar -xvzf tcpflow-0.21.tar.gz
$ cd tcpflow-0.21/
$ ./configure
$ make


The executable will be in the
tcpflow-0.21/src
folder:



Wireshark et al.

You have been using wireshark for a while now. I will continue writing about it a bit later...



Full Screen

Saturday, November 15, 2008

Network terms

We learned about networks in the last class and we learned about the following terms:

IP (internet protocol) address
NIC (network interface card)
MAC (Media Access Control) address
Port
DNS (Domain Name System)
Packet
netstat
ipconfig/ifconfig
ping
traceroute

We also learned about different internet protocols:
IP (Internet Protocol)
TCP (Transmission Control Protocol)
HTTP (HyperText Transfer Protocol)
HTTPS (The secure HyperText Transfer Protocol)
ICMP (Internet Control Message Protocol
UDP (User Datagram Protocol)
As well as a few others.

We also talked about a few applications that can be used to watch the network:

Etherape, shown below can allow you to see the traffic on your network. Unfortunately for most of you, it only installs under Linux and Mac OS/X:



Etherape Fullscreen


Wireshark is a packet analyzer that you can use to see the packets of information coming in and out of your computer. It easily installs under Windows and Linux. Here we are using it to get the password and username from a fake myspace account:



Wireshark Fullscreen


Here is a video of ping and traceroute commands:



Ping/Traceroute Fullscreen

Thursday, October 16, 2008

Volatility procdump

Ok, so you guys were given a lab to work on yesterday and I see that some of you have been working hard ;-)

One of you asked about how to use the procdump feature of Volatility to extract a process from the memory image. So first of all: how do you know which process you would like to dump? You can get a list of all running processes in the image by using the pslist command:


$ ./volatility pslist -f ../memimages/xp-laptop-2005-07-04-1430.img

Name Pid PPid Thds Hnds Time
[lots of output left out]
VPTray.exe 2496 2392 2 111 Mon Jul 04 18:18:06 2005
atiptaxx.exe 2524 2392 1 51 Mon Jul 04 18:18:06 2005
jusched.exe 2548 2392 1 22 Mon Jul 04 18:18:07 2005
EM_EXEC.EXE 2588 2540 2 80 Mon Jul 04 18:18:09 2005
WZQKPICK.EXE 2692 2392 1 17 Mon Jul 04 18:18:15 2005
wuauclt.exe 3128 800 3 157 Mon Jul 04 18:19:11 2005
taskmgr.exe 3192 2392 3 65 Mon Jul 04 18:19:33 2005
cmd.exe 3256 2392 1 29 Mon Jul 04 18:20:58 2005
firefox.exe 3276 2392 7 189 Mon Jul 04 18:21:11 2005
PluckSvr.exe 3352 680 6 206 Mon Jul 04 18:21:42 2005
PluckTray.exe 3612 3352 3 102 Mon Jul 04 18:24:00 2005
PluckUpdater.ex 368 3352 0 -1 Mon Jul 04 18:24:30 2005
dd.exe 3300 3256 1 22 Mon Jul 04 18:30:32 2005



So let's say that we want to dump the firefox process, we can do that. First of all you should note the Process ID (pid) of the firefox process to make your life much simpler. Firefox's pid is 3276 which we can see above.

Next, how do you know which command you enter to accomplish this? Well, we know that if we just run volatility with no options, we will get a list of the commands that we can use:


./volatility

Volatile Systems Volatility Framework v1.3
Copyright (C) 2007,2008 Volatile Systems
Copyright (C) 2007 Komoku, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

usage: volatility cmd [cmd_opts]

Run command cmd with options cmd_opts
For help on a specific command, run 'volatility cmd --help'

Supported Internel Commands:
connections Print list of open connections
connscan Scan for connection objects
connscan2 Scan for connection objects (New)
datetime Get date/time information for image
dlllist Print list of loaded dlls for each process
dmp2raw Convert a crash dump to a raw dump
dmpchk Dump crash dump information
files Print list of open files for each process
hibinfo Convert hibernation file to linear raw image
ident Identify image properties
memdmp Dump the addressable memory for a process
memmap Print the memory map
modscan Scan for modules
modscan2 Scan for module objects (New)
modules Print list of loaded modules
procdump Dump a process to an executable sample
pslist Print list of running processes
psscan Scan for EPROCESS objects
psscan2 Scan for process objects (New)
raw2dmp Convert a raw dump to a crash dump
regobjkeys Print list of open regkeys for each process
sockets Print list of open sockets
sockscan Scan for socket objects
sockscan2 Scan for socket objects (New)
strings Match physical offsets to virtual addresses (may take a while, VERY verbose)
thrdscan Scan for ETHREAD objects
thrdscan2 Scan for thread objects (New)
vaddump Dump the Vad sections to files
vadinfo Dump the VAD info
vadwalk Walk the vad tree

Supported Plugin Commands:
getsids Print the SIDs owning each process
memmap_ex_2 Print the memory map
pslist_ex_1 Print list running processes
pslist_ex_3 Print list running processes
ssdt Display SSDT entries
thread_queues Print message queues for each thread
usrdmp_ex_2 Dump the address space for a process
volshell Shell in the memory image

Example: volatility pslist -f /path/to/my/file



Now if you run the procdump command without any other options it will dump all processes in the memory dump, which is not what we want. Therefore we should figure out how to get a usage statement for this command. If we issue Volatility with the command and the option -h then we get the following:

./volatility procdump -h
Usage: procdump [options] (see --help)

Options:
-h, --help show this help message and exit
-f FILENAME, --file=FILENAME
(required) XP SP2 Image file
-b BASE, --base=BASE (optional, otherwise best guess is made) Physical
offset (in hex) of directory table base
-t TYPE, --type=TYPE (optional, default="auto") Identify the image type
(pae, nopae, auto)
-o OFFSET, --offset=OFFSET
EPROCESS Offset (in hex) in physcial address space
-p PID, --pid=PID Dump the process with this Pid
-m MODE, --mode=MODE strategy to use when saving executable. Use "disk" to
save using disk-based section sizes, "mem" for memory-
based sections. (default: "mem")
-u, --unsafe do not perform sanity checks on sections when dumping



Now to dump the firefox process we can type the following:

./volatility procdump -p 3276 -f ../memimages/xp-laptop-2005-07-04-1430.img



You should end up with a file called executable.3276.exe

Sunday, October 5, 2008

Memory images

As we have already learned: we can copy all of physical memory from our computer using win32dd. This was part of your homework.

There are several practice images available online of different types of Windows OSes.

The image information for your lab is here:

[xp-laptop.tgz | xp-laptop.md5]

Some other things:

Volatility [direct download]
SID [direct download]
System call table [direct download | supporting library]
Windows messages [direct download]

The supporting library goes in the ``forensics/win32/'' folder under Volatility
All other plugins go in the ``memory_plugins/'' folder under Volatility

Sunday, September 14, 2008

Computer basics

We covered this, but I'll add these terms to the blog for clarity.

An Operating System (OS) is the a software program that works as the interface between the user and the hardware. Examples of Operating Systems are Windows XP/Vista, Linux, Mac OS/X, and Unix. Modern Operating Systems support multiple programs (processes) and multiple users at one time. The OS manages everything on the computer such as: programs that are running (processes), files that are open, network connections, users who are logged on (and their processes, files, etc), memory usage, etc.



A process is a program that is currently running (executing) on a computer. Every process running has a unique number associated with it called a Process Identifier (PID). This allows the Operating System to keep track of each process. A process that is running is currently in main memory or Random Access Memory (RAM).

Random Access Memory (RAM) or main memory is a volatile form of computer storage that for items that are currently being used on the computer. Processes (and data needed by the processes) that are currently running must be in RAM in order for them to run.



A Hard Disk or Hard Drive is a piece of hardware that is used for longterm storage. Every time you save documents and pictures they are on the hard drive.



A Central Processing Unit (CPU) is hardware that is the brain of the computer. All instructions by programs running on the computer are processed by the CPU.



A user is someone who is currently using the computer or programs on the computer.

A programmer is someone who creates computer programs. Programs are created using programming languages. Some example programming languages are C, C++, Java, Perl, and Python.

Binary is a numerical system that contains only 1's and 0's and is the basis representing ``On'' and ``Off'' switches in computer circuits. This is what the computer understands and speaks as a native language. Most computers use the ASCII encoding scheme to represent characters. You can find a table of these values here.

Hex (short for hexadecimal) is a base-16 numerical system that contains the characters 0-9 and A-F.

A Network Interface Card (NIC) is a piece of hardware that allows a computer to communicate on a computer network.



An Internet Protocol (IP) address is a numerical address for a computer on a network. An example of an IP address might be: 192.168.0.99

A Media Access Control (MAC) address is the hardware address of a computer on a network. It is assigned by the maker of the computer's NIC card. An example of a MAC address might be: 00:3G:2D:10:AF:7E

A Port is the result of a program on a computer that is connected to the network. This results in an ``opening'' on the computer to the network. There are 65536 ports numbered from 0 to 65535. Well known ports range from 0-1023, which means that we can usually tell which programs are running if we see these ports are open. This doesn't mean that these programs can change ports, however, just that they normally run on these known ports. Here you can find a list of known port numbers. Here is a look at nmap being used to see the open ports on a computer:


# nmap -O 192.168.0.10

Starting Nmap 4.52 ( http://insecure.org ) at 2008-09-10 00:14 EDT
Interesting ports on 192.168.0.10:
Not shown: 1709 closed ports
PORT STATE SERVICE
135/tcp filtered msrpc
137/tcp filtered netbios-ns
138/tcp filtered netbios-dgm
139/tcp filtered netbios-ssn
445/tcp filtered microsoft-ds
MAC Address: 00:XX:XX:AA:99:44 (Intel)
Device type: general purpose
Running: Microsoft Windows 2003|XP
Too many fingerprints match this host to give specific OS details
Network Distance: 1 hop

OS detection performed. Please report any incorrect results at http://insecure.org/nmap/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 15.992 seconds



Transmission Control Protocol (TCP) is a connection oriented network connection (like a phone call). For more information see Wikipedia.

User Datagram Protocol (UDP) is a connectionless network connection (like the mail). For more information see Wikipedia

Sunday, September 7, 2008

9/3/08: Slides

Sorry for the late post! The slides are now up on Blackboard under ``Course Documents.'' Future slides will be placed there as well.

Let me know if you have any problems downloading/viewing them.

Wednesday, August 27, 2008

8/27/08: Notes

Overview

We discussed the class expectations, policies and information which can be found on the class website. We also did a very brief overview of the things to come in this class.

We defined Computer Forensics and talked about computer basics:

1) What is a computer?
2) How does it work?
3) Different types of computer data
4) Other devices such as PDAs or cell-phones

We also discussed the difference between Dead and Live Forensics; and we discussed hardware as evidence itself. Dead Forensics deals with data that is ``at rest'' or not currently in use. Examples that we covered are hard drives, CDs/DVDs, USB flash drives and floppies. Live Forensics deals with a system that is in current use. Live data is volatile and can be overwritten or lost. Examples of volatile data include RAM contents, open files, programs (often called processes), network connections as well as other items that we will cover later.

We also discussed some basic ideas of computer networking.

During our discussion of data obliteration I had mentioned the case of the hard drive that survived a shuttle crash. Here is a link about the hard drive that survived the failed Columbia mission

All of these topics will be discussed in depth as the class continues.

Your homework is to join the Listserve and read Chapters 1-2 before the next class next week.