Advanced Wireshark Network Forensics - Part 2/3

Netsec Explained
4 Dec 201813:58

Summary

TLDRThis video script guides viewers through a cybersecurity investigation of a malware-infected system. It details the process of analyzing a network packet capture to identify the source of the malware, extracting the malicious file, and examining its network activity. The tutorial emphasizes safe practices, recommends using a virtual machine, and highlights the importance of documenting findings. It concludes with insights on the malware's behavior, including DNS queries and HTTP traffic, and the absence of self-propagation attempts.

Takeaways

  • 🔍 The scenario involves a system on a network infested with malware that the antivirus failed to detect, locking up the system and preventing access to the hard drive.
  • 💡 The investigation starts with a full network packet capture and the known IP of the infected host, 12.1.83.155, as the starting point for analysis.
  • 🔑 Goals of the analysis include determining the source of the malware infection, reassembling network bits to collect the malware file, and understanding the malware's activity on the system.
  • 🚫 A disclaimer is provided about the risks of carving out a live virus file, recommending the use of a different operating system in a virtual machine for safety.
  • 🛠️ Wireshark is used for the analysis, with custom columns added for stream ID and host to aid in the investigation.
  • 🔎 Pattern matching begins with a display filter to isolate traffic related to the infected IP address, revealing suspicious activity such as a .ru domain name and the absence of a user agent in web requests.
  • 📄 The file signature 'MZ' is identified as indicative of Microsoft file types, including EXE executables, by consulting a file signature database.
  • 🖊️ The process of carving out the malware file from the packet capture involves saving raw bytes, removing HTTP headers, and ensuring the file starts with the correct file signature.
  • 🔒 The importance of disabling antivirus temporarily when handling a live virus file on Windows is highlighted to avoid automatic quarantine.
  • 🔄 The carved file is hashed for repeatability and comparison with the original, using either MD5 or SHA-256 to ensure accuracy.
  • 🌐 VirusTotal is utilized for analyzing the malware file, providing details about detection rates by various antivirus vendors and the nature of the malware.
  • 📊 Network traffic analysis reveals DNS queries to random domain names and HTTP traffic on port 80, indicative of botnet persistence behavior.
  • 🛡️ No evidence of the malware trying to self-propagate over the network was found, and traffic signatures like a high volume of DNS queries in a short time are noted for further investigation.

Q & A

  • What is the main issue presented in the scenario?

    -The main issue is that a system on the network is infested with malware, which the antivirus software failed to detect, and the malware has locked up the system.

  • What is the IP address of the infected host mentioned in the scenario?

    -The IP address of the infected host is 12.1.83.155.

  • What are the primary goals of the investigation in this scenario?

    -The primary goals are to determine the source of the malware infection, reassemble the network bits to collect the malware file for further investigation, and analyze the malware's activity on the system, including its network traffic signatures and propagation behavior.

  • Why is it recommended to use a different operating system with a virtual machine for this scenario?

    -It is recommended to use a different operating system with a virtual machine to prevent any complications that might occur from handling a live virus file, allowing for a safer and more controlled environment.

  • What are the two additional columns added in Wireshark for this investigation?

    -The two additional columns added are 'stream ID' with the field set to TCP.stream, and 'host' with the field set to HTTP.host.

  • What is a file signature and why is it important in this context?

    -A file signature, also known as a magic number, is the first few bytes of a file that indicate its type. It is important for identifying the file type, especially when dealing with unknown or potentially malicious files.

  • How can the file signature be used to identify the type of a file?

    -By looking up the file signature in a file signature database, one can determine the type of file it corresponds to, such as an executable or a library file.

  • What is the purpose of carving out a live virus file in this scenario?

    -Carving out a live virus file allows for the collection and analysis of the malware, which can provide insights into its behavior, characteristics, and potential impact on the system.

  • Why is it necessary to strip off protocol headers and footers when carving out a file?

    -Stripping off protocol headers and footers is necessary to obtain the original file in its pure form, without any additional data that may have been added during transmission.

  • What is the significance of obtaining a hash value of the carved out file?

    -Obtaining a hash value ensures that the file carving process is repeatable and allows for the comparison of the carved out file with the original file to verify accuracy.

  • How can the analysis of the carved out file be performed?

    -The analysis can be done manually by someone with the capability, or by uploading the file to an online service like VirusTotal for automated analysis and detection by multiple antivirus vendors.

  • What does the analysis of the malware file reveal about its behavior?

    -The analysis reveals that the malware makes a large number of DNS queries to seemingly random domain names and engages in HTTP communication with certain domains, indicating potential botnet persistence behavior.

  • What is the significance of observing a high volume of DNS queries within a short amount of time?

    -A high volume of DNS queries in a short time can be a traffic signature indicating potential malware activity, as seen in botnet persistence where the malware attempts to find available command and control servers.

  • What does the absence of evidence for the malware trying to reach out to other internal network addresses suggest?

    -The absence of such evidence suggests that the malware may not be attempting to self-propagate over the network like a worm, at least not in the ways monitored during the investigation.

Outlines

00:00

🔍 Investigating Network Malware Infection

This paragraph outlines a scenario where a system is infected with malware that the antivirus failed to detect. The system is locked up, but a full network packet capture is available. The goal is to determine the source of the malware infection and analyze its activity. The infected host's IP is known, and the speaker advises using Wireshark to analyze the capture, adding specific columns for investigation. A disclaimer is given about the risks of carving out a live virus file, recommending the use of a virtual machine on a different OS. Basic steps for setting up Wireshark and beginning the analysis are provided, including creating a display filter for the infected host's traffic and noting suspicious activities like the absence of a user agent in web requests.

05:00

📚 Carving Out and Analyzing the Malware

The speaker details the process of extracting a live virus file from a network capture using Wireshark. They explain how to filter traffic to include only server-to-client communication, view raw bytes, and save the file while avoiding antivirus detection. The importance of removing protocol headers to obtain the original file is emphasized. The use of a hex editor to strip HTTP headers and the necessity of creating file hashes for repeatability and matching are discussed. The paragraph concludes with the analysis of the extracted file using VirusTotal, which provides details about the malware, including its detection rate by various antivirus programs, and the observation of network traffic indicating botnet behavior with DNS and HTTP traffic on port 80.

10:01

🛡️ Assessing Malware Network Traffic and Propagation

The final paragraph focuses on analyzing the network traffic generated by the malware to determine if it attempts to self-propagate like a worm. The speaker describes how to filter out the virus download traffic and observes DNS queries to seemingly random domain names followed by HTTP communication. They note the lack of evidence for the virus reaching out to internal network addresses, suggesting it does not self-propagate in this manner. The paragraph ends with a summary of findings, including the source of infection, details about the malware file obtained, the type of network calls made, and the absence of self-propagation attempts, as well as the high volume of DNS queries as a potential traffic signature.

Mindmap

Keywords

💡Malware

Malware refers to malicious software designed to infiltrate, damage, or perform unauthorized actions on a computer system. In the video's context, it is the central issue as the system is 'infested with malware' that the antivirus failed to detect, leading to the system's lock-up. The script discusses the process of identifying the source of the malware and analyzing its behavior on the infected system.

💡Packet Capture

A packet capture is a recording of all the data packets that travel across a network. The video mentions having a 'full network packet capture of the incident,' which is crucial for analyzing the network traffic to determine how the malware was contracted and its subsequent activities.

💡IP Address

An IP address is a unique identifier for devices on a network. The script identifies '12.1.8.3.155' as the IP of the infected host, which serves as a starting point for the investigation, allowing the focus to be on the traffic related to this specific device.

💡Antivirus

Antivirus software is designed to detect, prevent, and remove malware. The video script notes that the antivirus on the computer 'didn't detect' the malware, which is a significant point as it highlights the need for further investigation into how the malware managed to evade detection.

💡Wireshark

Wireshark is a network protocol analyzer used for network troubleshooting and analysis. The script describes using Wireshark to add helpful columns, filter traffic, and analyze the pcap file to investigate the malware's activity on the network.

💡File Signature

A file signature, or 'magic number,' is a sequence of bytes at the beginning of a file that identifies the file format. The script refers to the 'MZ' signature as an indicator of Microsoft file types, such as EXE executables, which is used to identify the type of file being downloaded.

💡Virustotal

Virustotal is an online service that analyzes files and URLs for viruses and other malicious content. The script mentions uploading the carved-out malware file to Virustotal for analysis, which provides valuable information about the file, including detection rates by various antivirus vendors.

💡DNS Traffic

DNS traffic refers to the exchange of information between clients and DNS servers to resolve domain names into IP addresses. The script notes a 'spike of DNS traffic' associated with the malware, indicating that it may be attempting to communicate with command-and-control servers or generate domain names for botnet persistence.

💡Botnet

A botnet is a network of compromised computers controlled remotely by a malicious actor. The video script suggests that the malware exhibits botnet-like behavior by making numerous DNS queries and HTTP connections, indicative of its attempts to establish communication with external servers.

💡Traffic Signature

A traffic signature is a pattern of network traffic that can be used to identify specific types of activity or threats. The script discusses identifying 'possible network traffic signatures' that could be used to detect other systems infected with the same malware, such as the high volume of DNS queries.

💡RFC 1918

RFC 1918 defines a set of IP addresses reserved for private networks and are not routed on the public Internet. The script mentions checking for traffic to these addresses as a way to determine if the malware is attempting to self-propagate within the network by reaching out to other devices.

Highlights

A system on the network is infested with malware that the antivirus failed to detect.

The malware has locked up the system, and access to the hard drive is unavailable.

A full network packet capture is available for incident analysis.

The IP address of the infected host is known, providing a starting point for investigation.

The goal is to determine the source of the malware infection and reassemble network bits to collect the malware file.

Investigating the malware's activity includes analyzing internet calls and potential self-propagation.

A disclaimer about safely carving out a live virus file on a Windows PC is provided.

Instructions on adding helpful columns in Wireshark for stream ID and HTTP host are given.

The importance of documenting goals and results during an investigation is emphasized.

Pattern matching is used to filter traffic related to the infected device's IP address.

Suspicious web requests without a user agent may indicate manual virus download or pre-existing malware.

The file signature 'MZ' is identified as a signature for Microsoft file types, including EXE executables.

Instructions on carving out the live virus file from the network capture are provided.

The necessity of disabling antivirus to save the carved file on a Windows system is mentioned.

The carved file's hash value is crucial for ensuring the repeatability of the process.

VirusTotal is recommended for analyzing the carved malware file and obtaining detailed information.

The malware generates a large number of DNS queries to seemingly random domain names.

HTTP communication is observed with websites on certain domains, indicating possible botnet persistence.

No evidence of the malware trying to self-propagate over the network is found.

A high volume of DNS queries within a short time frame is identified as a potential traffic signature.

Transcripts

play00:00

let's take a look at scenario one you

play00:02

can download this and the other capture

play00:03

files from the github link in the

play00:05

description below so in this scenario

play00:07

we're being told that there's a system

play00:09

on the network infested with malware for

play00:12

some reason the antivirus on the

play00:13

computer didn't detect it and the

play00:15

malware is managed to lock up the system

play00:16

we don't have access to the hard drive

play00:18

but we do have a full network packet

play00:21

capture of the incident and we already

play00:23

know the IP of the infected host this

play00:26

12.1 8 3 1.55 this gives us a good

play00:31

starting point now for our goals since

play00:34

we have a full packet capture of the

play00:36

incident we'll want to know where the

play00:37

system managed to contract the malware

play00:38

from and if we can we'll want to see if

play00:40

we can reassemble the network bites to

play00:42

collect the malware file for further

play00:44

investigation then we'll want to see

play00:46

what we can find out about the malware

play00:48

is activity on the system things like

play00:50

what kind of calls to the internet

play00:52

doesn't make and does it try to self

play00:54

propagate like a worm and are there any

play00:57

possible network traffic signatures that

play00:59

we can use to catch other systems

play01:01

potentially infected with the same piece

play01:02

of malware ok we have a capture we know

play01:06

what we're looking for and we have our

play01:08

goals one last thing before we move on I

play01:12

want to give a little disclaimer in this

play01:14

scenario I will be showing you how to

play01:16

carve out a live virus file I will be

play01:18

doing it on my Windows PC and will need

play01:20

to disable my antivirus to do so

play01:22

following my steps exactly it should not

play01:25

cause any problems but I recommend that

play01:28

you do not do this on Windows and use a

play01:30

different operating system with a

play01:32

virtual machine that you can reflash

play01:34

later the virus is non-destructive and

play01:37

I'm not liable for any complications

play01:39

that might occur so with that let's get

play01:42

started

play01:43

the first thing I like to do with any

play01:45

new Wireshark install is to add a few

play01:47

helpful columns so let's go ahead and

play01:49

open our pcap file we can right-click on

play01:52

one of the columns and select column

play01:53

preferences from there click on the plus

play01:56

sign to add two columns the first we're

play01:59

gonna call stream ID and the second will

play02:01

be called host set the fields to be TCP

play02:04

stream and HTTP host I'd like to put the

play02:09

stream ID column between protocol and

play02:11

length and the host column between

play02:13

length and info so when we're done it'll

play02:16

look like this the other thing I like to

play02:19

do when starting a new investigation is

play02:21

to document what we know our goals and

play02:23

the results of each goal as we go

play02:25

through this since we're walking through

play02:27

this together I won't write down the

play02:28

steps we've taken but you'll want to

play02:30

write those down as well now that we

play02:32

have our Wireshark set up and our goals

play02:34

written down we can start with our

play02:35

analysis we begin with pattern matching

play02:38

we already know the IP address of the

play02:40

system we're interested in so let's

play02:41

create a display filter to show us only

play02:43

the traffic related to that device you

play02:45

can type in IP addr for IP address

play02:48

equals equals and then our victim's IP

play02:52

already we see something that looks a

play02:54

little suspicious now I want to point

play02:57

out something really important when

play02:58

investigating capture files what may be

play03:00

true for one network may not be true for

play03:03

another in this case a dot ru domain

play03:06

name might seem like something to worry

play03:07

about but it's also possible that this

play03:10

is a company that does a lot of business

play03:11

with other Russian companies either way

play03:15

we're gonna want to check our suspicions

play03:17

right click and follow TCP stream

play03:22

okay there's a few things we want to

play03:24

take note of here first what's something

play03:26

strange that we notice about the web

play03:28

request there is no user agent normally

play03:32

when you use a web browser or even curl

play03:34

to make a web request the browser

play03:36

includes its user agent in the web

play03:38

headers so not seeing a user agent here

play03:41

can mean one of two things either the

play03:44

user manually downloaded this virus

play03:45

themselves using some sort of local

play03:47

utility or there was already a piece of

play03:50

malware on the system that downloaded

play03:52

the rest of the virus next what kind of

play03:55

file is it that's being downloaded

play03:57

it's an exe executable obvious the name

play04:01

is pus about exe but another way we can

play04:03

tell what kind of file it is is by

play04:05

looking at the first few bytes of the

play04:06

file this is known as the file signature

play04:10

see in Windows you need to have the

play04:12

correct extension to open a file with

play04:14

the right application Exe PNG do see but

play04:19

with Linux you don't need that in fact

play04:22

there's a Linux utility called file that

play04:24

will tell you what type of file

play04:25

something is and it does that by looking

play04:28

at the file signatures I'll show you

play04:31

where you can look up your own file

play04:32

signatures in a second but first let's

play04:35

write down what we have so far the file

play04:37

was downloaded from this dot ru domain

play04:40

with the name puska Exe and there was no

play04:43

user agent in the request okay so if we

play04:47

search google for a file signature

play04:48

database several pop-up personally I

play04:52

prefer gary kessler net since it's

play04:54

updated regularly from here we can just

play04:57

do a ctrl F search for MZ which was the

play05:00

first two bytes of the file and we can

play05:02

see here that MZ is a file signature for

play05:04

a number of Microsoft file types

play05:06

including Exe executables and DLL

play05:09

libraries so now that we have the bytes

play05:12

of the file how can we pull this out

play05:14

with Wireshark well first we want to

play05:17

change the traffic we're looking at to

play05:18

only include the communication coming

play05:20

from the server to the client we can do

play05:23

that in the bottom left corner here then

play05:25

we'll want to show the raw bytes instead

play05:27

of their ASCII form finally just save

play05:30

the file now remember this is a live

play05:33

virus and since I'm using Windows I

play05:35

don't

play05:36

save it as a dot exe file I'm also gonna

play05:38

save this file twice as dump one and

play05:41

dump two you don't have to do this but

play05:44

you'll see why in a moment we're not

play05:47

done yet

play05:48

to get the original file we need to

play05:49

strip off any and all protocol headers

play05:51

and footers in this case we only have

play05:54

the HTTP headers to deal with open the

play05:57

file in a hex editor now the way HTTP

play06:01

headers work is that they let you know

play06:03

where the headers end and the data

play06:05

starts by this 0d 0a 0d 0a so just

play06:10

delete that and everything above it when

play06:13

we're done the file will start with MZ

play06:14

the first few bites of our file

play06:16

signature see this is why I saved the

play06:20

file twice when I tried to reconstruct

play06:22

the original virus my antivirus

play06:24

recognized it and put it in quarantine

play06:26

so here I'm gonna go ahead and disable

play06:29

my antivirus and try it again I'm only

play06:32

using Windows Defender so all I need to

play06:34

do is open my security settings virus

play06:36

and threat protection then turn off real

play06:38

time protection this little video glitch

play06:41

is from it asking me for privileged

play06:43

permissions so don't worry about that ok

play06:47

with the antivirus now disabled let's go

play06:49

ahead and try it again

play06:55

and success immediately after carving

play06:59

out any file in this investigation

play07:01

you'll want to get a hash of the file it

play07:03

doesn't matter too much of its md5 or

play07:05

shot 256 since the likelihood of a

play07:08

collision is pretty much zero but you'll

play07:10

want to make sure that you get the hash

play07:12

value so that your process is repeatable

play07:14

and so that the carved out file and the

play07:16

original file can be matched together

play07:18

for example if you're following along

play07:21

and managed to get different hash values

play07:23

that means that the file was carved out

play07:25

wrong and you should try it again

play07:26

don't worry it happens from time to time

play07:29

but this just illustrates why it's so

play07:31

important to collect the right hash

play07:32

values okay now to send the file for

play07:36

analysis if you're capable you can

play07:38

analyze the file yourself or we can do

play07:41

my preferred method and upload it to

play07:43

virustotal

play07:44

I love virustotal it's just a great

play07:47

website from our research here we have

play07:49

the sha-256 hash the original name pasta

play07:52

Exe remember we didn't give it that name

play07:55

they already knew it and elicited

play07:57

details about the virus itself there's

play07:59

also a list of antivirus vendors where

play08:02

they note which AV can and cannot detect

play08:04

the virus remember in our scenario where

play08:08

the antivirus wasn't able to detect it

play08:10

it might be on this list with a green

play08:12

checkmark and maybe we should

play08:13

re-evaluate our AV solution

play08:15

just a thought okay so we were able to

play08:19

collect and analyze the malware file

play08:21

let's take a look at what kind of

play08:22

network traffic it generates we can

play08:25

filter out the virus download by

play08:26

filtering out TCP stream 5

play08:29

and here we can see a lot of DNS traffic

play08:32

to what seems to be somewhat randomly

play08:35

generated domain names if we scroll down

play08:38

a little we can start to see quite a few

play08:40

syn packets being sent before we reach

play08:42

our first syn ACK that usually means

play08:45

that they were all sent out in a short

play08:46

amount of time if we kept scrolling down

play08:49

we would start to see connections that

play08:51

were being established and then closed

play08:53

immediately if you're new to malware

play08:56

traffic this is pretty standard form for

play08:58

botnet persistence the virus comes with

play09:00

a pre-loaded list of domains or with a

play09:02

built-in way to generate domain names it

play09:05

then tries to reach out to each of the

play09:06

domain names in the list to see what's

play09:08

available and online that way if some of

play09:11

the domains in the list are blocked or

play09:13

shut down it still has a way to call

play09:15

home let's look at one of the packets to

play09:18

see what TCP port it's trying to

play09:20

communicate on ok port 80 so most likely

play09:24

web traffic now if we wanted to see

play09:27

which of these domains it connected to

play09:29

and stayed connected to it's very likely

play09:32

that it would be using HTTP web traffic

play09:34

so let's check the hosts headers ad and

play09:38

and HTTP host to our filter and we can

play09:42

see that most of the communication

play09:44

happens with this

play09:45

wham-o Jeff desi comm domain let's

play09:50

follow one of the streams and see what

play09:52

kind of traffic we have

play09:55

yep this looks like a normal webpage

play09:58

might have redirected the user to their

play10:00

site to buy a fake antivirus says here

play10:03

Windows 7 total security let's make a

play10:07

note of what we found we saw that we now

play10:09

have a list of domain names that we can

play10:11

add to our blacklist we also noticed a

play10:13

spike of DNS traffic followed by a spike

play10:16

in port 80 traffic okay we're almost

play10:19

done the last thing we want to know is

play10:22

if the virus tries to self propagate

play10:24

over the network like a worm so what do

play10:27

we look for well if the virus tries to

play10:30

reach out to other devices on the

play10:32

network it might try to follow RFC 1918

play10:34

and look for private IP addresses

play10:36

there's also a chance that it takes the

play10:39

IP address of the infected machine and

play10:40

tries to reach out to other devices on

play10:43

that network as well if you're not

play10:45

familiar RFC 1918 is the standard for

play10:48

private IP addressing this is where we

play10:50

get the $10 the 192 168 and 172 dot 16

play10:56

networks these are all well known

play10:58

addresses and they're sometimes reached

play11:00

out to by computer worms we're also

play11:03

going to want to check the 12 networks

play11:05

with a / 8 subnet because it's at least

play11:07

a Class A address so we're gonna build

play11:11

one large filter and you're gonna want

play11:14

to be careful doing this since the

play11:16

larger the filter the trickier it can be

play11:18

we want to include the source IP address

play11:21

of 12.1 83 155 and the list of the

play11:27

following addresses 192.168.0.0 / 16 172

play11:35

dot 16 dot 0 dot 0 / 12 10.0.0.0

play11:41

/ 8 and 12.000 / 8 again since 12 dot is

play11:51

a Class A address we're gonna use these

play11:54

double pipes instead of the double ands

play11:56

since we're only need one of these to

play11:58

show up in our filter and we want to

play12:00

make sure that we wrap it with a

play12:01

parenthesis for the proper boolean logic

play12:03

with the and earlier okay let's stir

play12:07

this into Wireshark

play12:09

you might see these ICMP destination

play12:12

unreachable messages this is actually a

play12:14

bug in the Wireshark filters where it

play12:16

thinks that the ICMP messages are

play12:18

sourced and destined for the same

play12:20

address these are quick to look through

play12:23

and we can easily sort them out by just

play12:25

adding no ICMP to the end of our filter

play12:28

at this point it doesn't look like there

play12:30

are any attempts from the virus to try

play12:32

and connect to other internal systems so

play12:34

let's write this down and that's it

play12:37

awesome so now we're done let's hop back

play12:40

to the slides and review what we found

play12:44

okay

play12:45

let's revisit what we found where did

play12:47

the user contract the malware from well

play12:49

the user made a direct call to the

play12:51

executable therefore the user either

play12:52

deliberately downloaded the malware or

play12:54

there was a piece of malware sleeping on

play12:56

the system how about the malware file

play13:00

well we were able to get that carved out

play13:02

we have the md5 and the sha-256 hashes

play13:04

of these files we were able to analyze

play13:06

them through virustotal

play13:08

so here are some results taking

play13:11

screenshots of the virus total output so

play13:14

here we have a list of antivirus that

play13:15

was able to detect the virus and here's

play13:18

a list of those that weren't so what

play13:22

kind of calls did it make well we saw a

play13:24

large number of DNS queries to a number

play13:26

of what seemed like randomly generated

play13:28

domain names and we also saw a lot of

play13:30

HTTP communication for websites located

play13:33

on a few of these domains did it try to

play13:37

self propagate no we didn't find any

play13:39

evidence that it tried to reach out to

play13:41

any other internal network addresses and

play13:43

as far as traffic signatures we saw a

play13:45

high volume of DNS queries within a

play13:47

short amount of time so that's

play13:49

definitely something to look at well

play13:52

that's it for now in the next video

play13:54

we're going to take a look at our second

play13:55

scenario

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
Malware AnalysisNetwork ForensicsWireshark ToolVirustotalHTTP TrafficDNS QueriesAntivirus BypassFile CarvingSecurity InvestigationBotnet Detection
Benötigen Sie eine Zusammenfassung auf Englisch?