Dynamic Analysis Process Part 2

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
or

Already have an account? Sign In »

Time
3 hours 41 minutes
Difficulty
Advanced
CEU/CPE
5
Video Transcription
00:00
alright. In part two of our dynamic analysis process, we're gonna learn about how our malware affect our Windows 10 operating system.
00:09
To safely analyze malware, we should create malware sandbox. Now, these days it's pretty easy to create a malware sandbox. All you need is a piece of virtual ization software like VM ware. Or you could download Virtual Boxer free, and you could set up a target system to run the malware Windows 10. You could get an evaluation copy of Windows 10.
00:27
What I like to dio is I like to set up another virtual guest
00:31
in this case will use Linux rednecks to perform some other malware operations, such as faking Internet services. Now, if you're not familiar with rednecks, it is a Linux distribution, preloaded with a lot of malware analysis tools that will help you get up and running and analyzing malware fairly quickly.
00:50
If you've never used it before, I encourage you to head over to
00:53
room next dot org's and download a copy and added to your malware analysis lab and my lab set up, I am running Os X VM ware with two virtual guests, the Windows 10 box and the remnants box and they're connected together. The 1 72 network with
01:11
the realm next machine acting as a gateway for the Windows host.
01:15
In my Windows lab, I've got Windows 10 with little to no updates, user access, controls, disabled as well as the firewall in Windows Defender. From a sandbox security perspective, we want to implement some controls so that we limit the risk of malware escape ability. In that regard, we have created a
01:34
virtual air gap system as thes two hosts are Onley connected
01:38
via host Onley mode. We have no Internet access and cutting paces disabled as well as no network share access. Now remember, my lab may look a little bit different than yours, but if you're running any recent version of Windows, any of the tools that you see here will run in your lap.
01:57
Okay, so here we are in our Windows 10 environment. And before we get started, we just want to test our connectivity between this host and our room next guest. So let's go ahead and bring up a terminal window.
02:08
And to test connectivity, will Ping the host 172 down 16.0 dot one and As you can see, we're getting a ping back. So our collectivity is established and we could go ahead and start analyzing our malware in my lab. I've got a folder on the desktop that contains my malware samples.
02:27
So let's go ahead and navigate to sample one which is contained within
02:31
this malware samples folder. And one thing you want to remember is that when you do handle now where you want to handle it appropriately to save a bit of time already gone through the process of unzipping my malware sample so that it's ready to go for analysis now a good rule of thumb before attempting to dynamically analyze your malware
02:51
is to do a
02:52
quick, static analysis of your sample. This will give you some insight as to what you're looking for when you actually run the sample in your now our analysis environment. Now it's up to you as to how far you're going to go with your initial analysis.
03:09
However, the first thing I do in my lab is I typically run the file Command to be sure that the particular file I'm working on is going to run on my target system.
03:20
Okay, So first things first, Let's run the file tool on our sample one dot been.
03:25
And, as you can see here, our file tool response that our sample one top in is in fact a P E 30 to execute Herbal.
03:34
Now that we know that this is an executed file, let's go ahead and rename our been filed to sample dot e x e.
03:44
All right, so go ahead and click. Yes, all right, so now we can put our execute herbal into P e studio. Okay, so what is P e Studio? Well, P e studio is a malware assessment tool, and it's a multi functional application, which allows us to view different properties of a suspicious file. We can also view
04:02
different hash values, time stamps,
04:04
certification information as well as a view Windows AP Ice strings and other file properties. Now to view Windows Ap eyes, we can click on the import menu item, and by viewing this information, we can get an idea of the different type of functionality we might encounter when we're running the sample in our lab.
04:24
Now, in our malicious file here, you can see that we've got some windows, a p. I. S
04:28
that hint at different interactivity, such as interactions with the file system.
04:33
We've got interactions with process execution.
04:36
There are also functions related to D. L. L's and indications that this malware might interact with the console.
04:46
Another nice feature of P e studio is that with the tool we can look at what strings are contained within our application, and by doing so, we can see right off the bat that the sample appears to create a scheduled task, which is used for persistence.
05:00
We also have some type of network functionality. It looks like it's going to be creating some shortcut links. You can also see that we've got a process name here that we should be on the lookout for. And finally, our malware contains some base 64 encoded strings.
05:17
Now, if you remember, the first step of our dynamic analysis process is, of course, to start with a clean snap shop. We've already done that. So next we want to start our malware analysis tools so that we can see what affect the malware has on our target system. When it's run, there's several tools that we can use that will assist us in this process,
05:36
and the ones that you use are largely based off
05:40
the typical Mauer artifacts, which we'd like to retrieve
05:43
in my lab. I've got a few tools that I typically stick to. The first is process hacker, and this allows me to see which processes are created on the system as the malware runs.
05:53
So let's go ahead and open process Hacker
05:56
and at the same time will close up a few of these services that are running already
06:00
and will make this a little bit smaller and move it to the right part of the screen here.
06:09
And let's also move our malware folder container over a little bit. And, of course, that's the problem you run into when you're doing this type of analysis, right? You start to run out of real estate on your screen.
06:20
In addition to using process hacker, we can view what type of changes the malware is making tow our system in real time. Using the CIS internals Parkman application,
06:31
we can execute Brockmann directly from the command line, and when Parkman launches, we can set up a filter so that we only get events related to our sample one. Execute herbal now. I already added the sample one Dottie xy to the process list here that I wanted to monitor. But you can get the process Monitor filter dialog box
06:50
by pressing control l
06:53
and then using the filter drop down for the condition that you'd like to filter on to view what changes the malware will make to the Windows registry. You can use a registry snapshot ing tool such as red shop.
07:06
The way that rig shot works is you take a snapshot of the registry before you run your malware. You run your malware and then you take another shot of system registry and you can compare the changes
07:18
to run right? Shot. All you need to do is double click on the execute herbal, and then the only change you want to make is you want to put a check mark in the box that says scan directory, and you want to change this to the root directory, which will scan the entire hard drive. Once you make the change, you click. First shot.
07:38
It will take
07:39
a shot of the registry as it stands, depending on how big your hard drive is. This could take a little bit of time. As you can see here, mine took a little bit more than a minute. But after the registry has been scanned, the second shot button becomes illuminated and you're ready to run your malware. Another artifact that we're gonna want to look for from a
07:58
dynamic analysis perspective
08:00
is network traffic. So to do this will use wire shark running on our rednecks machine toe. Actively monitor the network connection.
08:09
So let's hop over to our Lennox machine and from the command line will simply run wire shark.
08:15
Oops, Wire shark.
08:16
Now, once the dialog appears, will pick the Ethernet link that we want to monitor. In this case, mine is N s 34 then I will enter my password for VM Ware. And as you can see here now, we are monitoring the network. Blink.
08:33
Okay, so now let's navigate back to our windows host
08:37
and run our malware
08:39
to run our sample. We can just double click it, and as you can see, it begins. And the process can be viewed from process hacker on the right hand side.
08:48
Now it initially starts under the console application
08:52
and through looking at process hacker, you can see that it executes yet another process that's dropped to the system named a DB. Trey Soto Let malware do It's malicious work. We can let it run for a little bit. This will ensure that all of our tools
09:09
can log all of the changes that it's making to the system.
09:13
Okay, so let's terminate the process. And from here we can stop our monitoring tools. Now that our process is terminated, we can take our second registry shot,
09:24
and once it's completed, we can compare the first one to the second one. But before we compare the two, let's stop process monitor from capturing events by pressing the magnifying glass. And if we maximize the pro common dialog box, we can see that our malicious sample
09:41
has made different registry changes.
09:43
It's logged how the sample has created processes and threads, etcetera. Now we can use the compare button to look at the different events that regs shot has logged.
09:56
Remember, this is taking a diff of both registry files before and after we've run them out. Where
10:03
and when we look at the file, we can see that the malware sample has interacted with our hard drive.
10:09
It's been making modifications to the file system into the system registry.
10:13
And when we look even further, you can see that the samples adding temporary files and folders to file system. It's adding a process called a D B manager to the temporary folder. As you can see, you temporary spelled wrong.
10:28
And so here you can see that the registry is definitely a database that we're gonna want to monitor because essentially all the changes that are made to the system are tracked in the Windows registry. And these events, combined with all of the outputs from our different types of tools,
10:46
can give you a really good sense of what your malware is doing on this system.
10:50
Okay, so next, in addition to understanding what's happening on our Windows host, we also want to investigate the network traffic. Earlier, of course, we set up our Lennox machine to capture network traffic, so lets navigate over there and investigate any network activity.
11:09
That theme our sample would have initiated.
11:13
All right, so here we are in our Lennox environment and wire shark has been happy enough to capture all of our network traffic.
11:18
Now, if we inspect it, we can see that the problem with Windows 10 is that it's pretty noisy from a network perspective. Now there's some tools out there that can help you remove some unwanted Windows 10 applications. However, in the interest of time, we'll review our network traffic here and we'll try to detect any anomalies.
11:37
Now, as you see here, as we scroll through the network traffic, we've got lots of traffic related to Windows domains. However, in interesting domain, here is this colonel dot W s domain, which looks a little bit strange. The DNS record has quite a long name,
11:52
and this could be an indication that this particular piece of malware is trying to utilize some DNS channel
11:58
to communicate with the command and control server. Now, because of the domain name can't be reached, pack is gonna be dropped. However, this still may be of interest to us. So what we could do is we could look at the contents of the communication by right clicking on the wire, shark output,
12:15
navigating to follow and then looking at the UDP stream.
12:20
Now, as you can see, this really doesn't give us much information, however, we could run our simulation again and this time with the tools such as in its, um, where we could fake the DNS server and observe the traffic there by attempting to observe what the malware needs to communicate with the command and control server.
12:39
Now, as I mentioned with dynamic analysis, we get a pretty good idea of what a piece of malware is doing by first inspecting it from a quick analysis perspective and then viewing the changes made to your system as the malware is run.
12:52
Now remember, during this process, you're looking for changes to the file system. This includes dropped and creative processes, changes to the system registry persistence mechanisms like newly created services, scheduled tasks or run keys and finally looking for anomalous network traffic.
13:11
Now, as we've gone through this session, you may have noticed that I didn't cover every single tool detail.
13:16
Now we took this approach because not only are there many different tools we can use to accomplish the same analysis tasks, but because also in this course we want to present you with a clear methodology that you can implement using any tool that you choose and any Mauer sample that you wish to analyze,
13:35
All right, So now that we have performed some basic dynamic analysis in the next session, let's look at performing some advanced analysis using some debugging tools.
Up Next
Advanced Malware Analysis: Redux

In this course, we introduce new techniques to help speed up analysis and transition students from malware analyst to reverse engineer. We skip the malware analysis lab set up and put participants hands on with malware analysis.

Instructed By