Carving Network Packets from Memory Dump Files
A new feature in the recently released CapLoader 1.2 is the ability to carve network packets from any file and save them in the PCAP-NG format. This fusion between memory forensics and network forensics makes it possible to extract sent and received IP frames, with complete payload, from RAM dumps as well as from raw disk images.
CapLoader will basically carve any TCP or UDP packet that is preceded by an IP frame (both IPv4 and IPv6 are supported), and believe me; there are quite a few such packets in a normal memory image!
We've made the packet carver feature available in the free version of CapLoader, so feel free to give it a try!
The packet carving feature makes it possible do much better analysis of network traffic in memory dumps compared to Volatility's connscan2. With Volatility you basically get the IP addresses and port numbers that communicated, but with CapLoader's packet carver you also get the contents of the communication!
EXAMPLE: Honeynet Banking Troubles Image
I loaded the publicly available “Banking Troubles” memory image from the Honeynet Project into CapLoader to exemplify the packet carver's usefulness in a digital forensics / incident response (DFIR) scenario.
CapLoader 1.2 Carving Packets from HoneyNet Memory Image
22 TCP/UDP Flows were carved from the memory image by CapLoader
Let's look at the network traffic information that was extracted in the Honeynet Project's own solution for the Banking Troubles Challenge:
python volatility connscan2 -f images/hn_forensics.vmem"
Local Address Remote Address Pid
192.168.0.176:1176 184.108.40.206:80 888
192.168.0.176:1189 192.168.0.1:9393 1244
192.168.0.176:2869 192.168.0.1:30379 1244
192.168.0.176:2869 192.168.0.1:30380 4
0.0.0.0:0 220.127.116.11:0 0
127.0.0.1:1168 127.0.0.1:1169 888
192.168.0.176:1172 18.104.22.168:80 888
127.0.0.1:1169 127.0.0.1:1168 888
192.168.0.176:1171 22.214.171.124:80 888
192.168.0.176:1178 126.96.36.199:80 1752
192.168.0.176:1184 188.8.131.52:80 880
192.168.0.176:1185 184.108.40.206:80 880
"This connection [marked in bold above] was opened by AcroRd32.exe (PID 1752) and this represents an additional clue that an Adobe Reader exploit was used in order to download and execute a malware sample."
The solution doesn't provide any evidence regarding what Acrobat Reader actually used the TCP connection for. Additionally, none of the three finalists managed to prove what was sent over this connection.
To view the payload of this TCP connection in CapLoader, I simply right-clicked the corresponding row and selected “Flow Transcript”.
Transcript of TCP flow contents (much like Wireshark's Follow-TCP-Stream)
We can see that the following was sent from 192.168.0.176 to 220.127.116.11:
GET /load.php?a=a&st=Internet%20Explorer%206.0&e=2 HTTP/1.1
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Notice that the HTTP GET request took place at the end of the TCP session. Odd? Well, CapLoader doesn't know the timestamp of carved packets, so they are simply ordered as they were discovered in the dump file. The timestamp generated for each carved packet represents where in the image/dump the packet was found. Or more precise: the number of microseconds since EPOCH (1970-01-01 00:00:00) is the offset (in bytes) from where the packet was carved.
Hence, we know that the HTTP GET request can be found between offset 37068800 and 37507072 in the image (a 428 kB region). To be more exact we can open the generated PcapNG file with Wireshark or Tshark to get the timestamp and length of the actual HTTP GET request packet.
tshark.exe -r Bob.vmem.pcapng" -R http.request -T fields -e frame.time_epoch -e frame.len -e http.request.uri
31.900664000 175 *
37.457920000 175 *
37.462016000 286 /load.php?a=a&st=Internet%20Explorer%206.0&e=2
37.509120000 175 *
37.519360000 245 /~produkt/983745213424/34650798253
37.552128000 266 /root.sxml
37.570560000 265 /l3fw.xml
37.591040000 274 /WANCommonIFC1.xml
37.607424000 271 /WANIPConn1.xml
Now, lets verify that the raw packet data is actually 37462016 bytes into the memory dump.
xxd -s 37462016 -l 286 Bob.vmemYep, that's our HTTP GET packet preceded by an Ethernet, IP and TCP header.
23ba000: 0021 9101 b248 000c 2920 d71e 0800 4500 .!...H..) ....E.
23ba010: 0110 3113 4000 8006 8e1a c0a8 00b0 d496 ..1.@...........
23ba020: a4cb 049a 0050 7799 0550 f33b 7886 5018 .....Pw..P.;x.P.
23ba030: faf0 227e 0000 4745 5420 2f6c 6f61 642e .."~..GET /load.
23ba040: 7068 703f 613d 6126 7374 3d49 6e74 6572 php?a=a&st=Inter
23ba050: 6e65 7425 3230 4578 706c 6f72 6572 2532 net%20Explorer%2
23ba060: 3036 2e30 2665 3d32 2048 5454 502f 312e 06.0&e=2 HTTP/1.
23ba070: 310d 0a41 6363 6570 743a 202a 2f2a 0d0a 1..Accept: */*..
23ba080: 4163 6365 7074 2d45 6e63 6f64 696e 673a Accept-Encoding:
23ba090: 2067 7a69 702c 2064 6566 6c61 7465 0d0a gzip, deflate..
23ba0a0: 5573 6572 2d41 6765 6e74 3a20 4d6f 7a69 User-Agent: Mozi
23ba0b0: 6c6c 612f 342e 3020 2863 6f6d 7061 7469 lla/4.0 (compati
23ba0c0: 626c 653b 204d 5349 4520 362e 303b 2057 ble; MSIE 6.0; W
23ba0d0: 696e 646f 7773 204e 5420 352e 313b 2053 indows NT 5.1; S
23ba0e0: 5631 290d 0a48 6f73 743a 2073 6561 7263 V1)..Host: searc
23ba0f0: 682d 6e65 7477 6f72 6b2d 706c 7573 2e63 h-network-plus.c
23ba100: 6f6d 0d0a 436f 6e6e 6563 7469 6f6e 3a20 om..Connection:
23ba110: 4b65 6570 2d41 6c69 7665 0d0a 0d0a Keep-Alive....
Give it a Try!
Wanna verify the packet carving functionality? Well, that's easy! Just follow these three steps:
Download a sample memory image (thanks for the great resource Volatility Team!)
Download the free RAM dumper DumpIt and dump your own computer's memory.
Locate an existing file that already contains parts of your RAM, such as pagefile.sys or hiberfil.sys
- Download the free version of CapLoader and open the memory dump.
Select destination for the generated PcapNG file with carved packets and hit the “Carve” button!
Carving Packets from Proprietary and odd Capture Formats
CapLoader can parse PCAP and PcapNG files, which are the two most widely used packet capture formats. However, the packet carving features makes it possible to extract packets from pretty much any capture format, including proprietary ones. The drawback is that timestamp information will be lost.
We have successfully verified that CapLoader can carve packets from the following network packet capture / network trace file formats:
- .ETL files created with netsh or logman. These Event Trace Log files can be created without having WinPcap installed.
- .CAP files created with Microsoft Network Monitor
- .ENC files (NA Sniffer) from IBM ISS products like the Proventia IPS (as well as Robert Graham's old BlackICE)
- .ERF files from Endace probes
Posted by Erik Hjelmvik on Monday, 17 March 2014 10:05:00 (UTC/GMT)
Tags: #Netresec #PCAP #carve #carver #packets #RAM #memory #dump #forensics #DFIR #CapLoader #memory forensics #PcapNG