Name: Ruben Recabarren Description: v2. Typos and added some clarifications. The easiest way to determine web requests is with a simple grep command. The -A and -B switches made sure we get GET, POST, Host: strings that "correspond" to each other: noone@bt:~/forensic-challenge$ strings -n 6 evidence06.pcap | egrep -A 3 -B 3 'GET |POST |Host: ' GET /index.php HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Host: 10.10.10.10:8080 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: text/html -- n> O GET /index.phpmfKSxSANkeTeNrah.gif HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */* Referer: http://10.10.10.10:8080/index.php Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Host: 10.10.10.10:8080 Connection: Keep-Alive HTTP/1.1 200 OK Content-Type: image/gif -- NtLockVirtualMemory InitServerExtension core_loadlib GET /123456789 HTTP/1.0 ProcessIdToSessionId kernel32.dll DSA-SHA1-old -- NtLockVirtualMemory InitServerExtension core_loadlib GET /123456789 HTTP/1.0 ProcessIdToSessionId kernel32.dll DSA-SHA1-old noone@bt:~/forensic-challenge$ The first two matches are obviously web requests from actual HTTP conversations, whereas the last two may be strings from binaries that look that they will try and make web requests once executed. The first match requests for index.php, whereas the second match requests for index.phpmfKSxSANkeTeNrah.gif. The Referer header from the second match assertains that this request was actually performed after the first GET request for index.php. In order to create an inventory of all the artifacts exchanged in the packet capture, it is easy to use tcpflow: noone@bt:~/forensic-challenge$ mkdir tcpflow noone@bt:~/forensic-challenge$ cd tcpflow noone@bt:~/forensic-challenge/tcpflow$ tcpflow -r ../evidence06.pcap noone@bt:~/forensic-challenge/tcpflow$ ls -alh total 2.2M drwxr-xr-x 2 noone noone 4.0K May 26 18:46 . drwxr-xr-x 3 noone noone 4.0K May 26 18:46 .. -rw-r--r-- 1 noone noone 1.2M May 26 18:46 010.010.010.010.04444-010.010.010.070.01036 -rw-r--r-- 1 noone noone 1.4G May 26 18:46 010.010.010.010.04445-010.010.010.070.01044 -rw-r--r-- 1 noone noone 5.9K May 26 18:46 010.010.010.010.08080-010.010.010.070.01035 -rw-r--r-- 1 noone noone 658 May 26 18:46 010.010.010.070.01035-010.010.010.010.08080 -rw-r--r-- 1 noone noone 94K May 26 18:46 010.010.010.070.01036-010.010.010.010.04444 -rw-r--r-- 1 noone noone 1.1M May 26 18:46 010.010.010.070.01044-010.010.010.010.04445 noone@bt:~/forensic-challenge/tcpflow$ and then simply have foremost carve out the artifacts: noone@bt:~/forensic-challenge/tcpflow$ foremost -i 010.010.010.0* [AFTER A COUPLE OF MINUTES OF ANALYSIS] noone@bt:~/forensic-challenge/tcpflow$cat output/audit.txt [SNIPPING uninteresting parts of the OUTPUT] Foremost version 1.5.4 by Jesse Kornblum, Kris Kendall, and Nick Mikus File: 010.010.010.010.04444-010.010.010.070.01036 Length: 1 MB (1239098 bytes) Num Name (bs=512) Size File Offset Comment 0: 00000000.dll 730 KB 4 04/03/2010 04:07:31 ------------------------------------------------------------------ File: 010.010.010.010.04445-010.010.010.070.01044 Length: 1 GB (1437183436 bytes) Num Name (bs=512) Size File Offset Comment 1: 02805371.dll 730 KB 1436350349 04/03/2010 04:07:31 Finish: Wed May 26 18:53:28 2010 ------------------------------------------------------------------ File: 010.010.010.010.08080-010.010.010.070.01035 Length: 5 KB (6019 bytes) Num Name (bs=512) Size File Offset Comment 2: 00000011.gif 43 B 5976 (1 x 1) 3: 00000000.htm 5 KB 174 ------------------------------------------------------------------ 4 FILES EXTRACTED gif:= 1 htm:= 1 exe:= 2 ------------------------------------------------------------------ So now, we have an nice inventory of artifacts from which we can answer several forensic questions. Notice the Comment output which gives interesting "absolute" time info. 1.- What was the full URI of Vick Timmes' original web request? (Please include the port in your URI.) As per the first egrep match describe at the beginning of this document, the full URI of the original web request is: http://10.10.10.10:8080/index.php 2.- In response, the malicious web server sent back obfuscated JavaScript. Near the beginning of this code, the attacker created an array with 1300 elements labeled "COMMENT", then filled their data element with a string. What was the value of this string? We can try to extract the session where this took place and perform a very narrow manual analysis of the javascript exchanged. However, I rather use a more general approach that is usefull in cases where such an exchange could have happened more than once or in an unknown location in the capture file. A couple of grep commands is all it takes: We start looking for the string "COMMENT": noone@bt:~/forensic-challenge$ strings -n 6 evidence06.pcap | grep COMMENT var UWnHADOfYHiHDDXj = "COMMENT"; noone@bt:~/forensic-challenge$ So we see there is only one occurence of the string "COMMENT" and is used to set the variable UWnHADOfYHiHDDXj. The strange variable name is supposed to be an attempt at obfuscating the javascript. Or so they think. So next, we search the variable name that holds our string: noone@bt:~/forensic-challenge$ strings -n 6 evidence06.pcap | grep UWnHADOfYHiHDDXj var UWnHADOfYHiHDDXj = "COMMENT"; qSNgVkOrdIjaiFpPTfDjbPHQppHSGtzpmOOyqEbLEFxNqAxicRyZKKWiRWmUaDHFOuzHPHqLrRFSzQuPusTnQyqpQwVpARdlR[i] = document.createElement(UWnHADOfYHiHDDXj); noone@bt:~/forensic-challenge$ So we see there is one additional occurrence of the variable UWnHADOfYHiHDDXj, using it as argument to the function document.createElement(). The element created is stored in the array qSNgVkOrdIjaiFpPTfDjbPHQppHSGtzpmOOyqEbLEFxNqAxicRyZKKWiRWmUaDHFOuzHPHqLrRFSzQuPusTnQyqpQwVpARdlR. This means we are getting closer to the object we are looking for. Looking for this array, we get: noone@bt:~/forensic-challenge$ strings -n 6 evidence06.pcap | grep -B 2 qSNgVkOrdIjaiFpPTfDjbPHQppHSGtzpmOOyqEbLEFxNqAxicRyZKKWiRWmUaDHFOuzHPHqLrRFSzQuPusTnQyqpQwVpARdlR