WEBVTT

00:00:00.000 --> 00:00:02.630
Talking about networking, how we want the network to

00:00:02.630 --> 00:00:03.990
be set up for this virtual machine.

00:00:04.170 --> 00:00:07.475
So there are a number of ways in virtual machines that you can set up

00:00:07.990 --> 00:00:11.440
networking. It comes out to there being three different types of networking

00:00:11.440 --> 00:00:14.090
you can have in VMs. The first is bridged networking,

00:00:14.090 --> 00:00:17.650
which is where you're basically sharing your NIC, your network

00:00:17.650 --> 00:00:20.900
interface, on your host OS with the virtual machine,

00:00:20.900 --> 00:00:24.730
and it basically just kind of creates a separate network for it.

00:00:24.730 --> 00:00:26.040
So when you're in bridged mode,

00:00:26.040 --> 00:00:28.620
it means that you're on the network that your host OS is on.

00:00:28.960 --> 00:00:29.860
There is NAT mode,

00:00:29.860 --> 00:00:33.310
which allows your virtual machine to kind of go through

00:00:33.320 --> 00:00:36.560
your host OS's network interface,

00:00:36.770 --> 00:00:40.750
but it's not requesting a new IP address on the network that you're on.

00:00:40.750 --> 00:00:44.760
So all the traffic looks like it's coming from your host OS.

00:00:45.170 --> 00:00:47.230
Now with bridged and NAT mode,

00:00:47.470 --> 00:00:51.980
you're allowing the malware and your guest 0S to get to the internet,

00:00:51.980 --> 00:00:53.340
and you may not want to do that.

00:00:53.340 --> 00:00:53.920
In fact,

00:00:53.930 --> 00:00:57.090
I recommend at least the first time you run malware, you put

00:00:57.090 --> 00:01:00.610
it into this third type of networking, which is called host‑only networking.

00:01:00.690 --> 00:01:05.330
And it basically creates a private network within your host OS and your

00:01:05.330 --> 00:01:08.580
guest OS so that your guest OS can't get to anything else.

00:01:08.710 --> 00:01:09.100
In fact,

00:01:09.100 --> 00:01:12.690
probably the only thing that it can get to is either other virtual

00:01:12.690 --> 00:01:16.530
machines that are on your host‑only networking network or your

00:01:16.530 --> 00:01:20.540
host OS. And with that host network, it's still a network,

00:01:20.550 --> 00:01:20.790
right?

00:01:20.790 --> 00:01:23.950
It's not like you don't have a NIC attached at all.

00:01:23.960 --> 00:01:26.310
It's going to get an IP address. It's still going to have a gateway.

00:01:26.730 --> 00:01:26.730
Yes. Awesome.

00:01:27.770 --> 00:01:28.990
So it's still going to work.

00:01:29.030 --> 00:01:33.130
The guest OS is going to look like it's on a network because it is on a

00:01:33.130 --> 00:01:36.350
virtual network. It's just not able to get to the network that your

00:01:36.530 --> 00:01:41.030
host OS is connected to. So if you wanted to simulate maybe another VM

00:01:41.030 --> 00:01:44.690
or some sort of enterprise asset, you can put it on the same host network,

00:01:44.690 --> 00:01:46.380
and those two VMs would be able to see each other.

00:01:47.050 --> 00:01:49.360
Yes, and, again, that goes back to why we want to use virtual machines

00:01:49.360 --> 00:01:53.500
because we can throw up a second or third or fourth virtual machine and

00:01:53.500 --> 00:01:56.330
put it on the same host‑only network and allow the malware to try to

00:01:56.330 --> 00:02:01.360
connect to it. Think of it like this. A lot of malware may try to get to

00:02:01.360 --> 00:02:04.250
things like domain controllers, Active Directory servers, file servers,

00:02:04.250 --> 00:02:05.020
things like that.

00:02:05.030 --> 00:02:09.540
We could install a second or third virtual machine under our VM software,

00:02:09.540 --> 00:02:13.860
put it on the host‑only network, and allow the malware to try to connect

00:02:13.860 --> 00:02:17.430
to it. We could essentially simulate an entire enterprise under our own

00:02:17.430 --> 00:02:18.485
VMs if we needed to. Absolutely.

00:02:19.480 --> 00:02:23.730
You could have share drives running and full domain. You can join the domain.

00:02:23.740 --> 00:02:24.560
Yeah, exactly.

00:02:24.560 --> 00:02:26.590
And we're doing all this, we're controlling it.

00:02:26.740 --> 00:02:29.390
And we're not allowing the malware to escape out to the internet,

00:02:29.400 --> 00:02:31.080
to the network that we're connected to, to our

00:02:31.080 --> 00:02:32.950
organization's network, and so on.

00:02:33.270 --> 00:02:36.620
So as we get more advanced in it, we're not just simulating the

00:02:36.630 --> 00:02:39.110
hardware. We're not just simulating a real OS.

00:02:39.110 --> 00:02:42.130
We're also going to simulate a real network infrastructure and

00:02:42.140 --> 00:02:45.700
potentially real resources and services that would normally be on a

00:02:46.080 --> 00:02:51.490
network. Right. Now the one thing that I'll say, too, is when you're

00:02:51.490 --> 00:02:52.890
in host‑only networking mode,

00:02:53.340 --> 00:02:57.940
your guest OS is by default going to be able to connect to your host OS.

00:02:57.980 --> 00:02:58.740
And, again,

00:02:58.740 --> 00:03:03.330
you may not want that to happen. If you're guest OS is running

00:03:03.330 --> 00:03:06.550
malware that has a zero‑day exploit in it that could

00:03:06.550 --> 00:03:08.970
potentially affect your host OS, you may not want it to be able

00:03:08.970 --> 00:03:10.180
to communicate over the network.

00:03:10.260 --> 00:03:15.080
So there are ways that we can turn off that connection in the host‑only

00:03:15.080 --> 00:03:19.470
networking mode so that our guest OS does not connect to our host OS or

00:03:19.470 --> 00:03:21.050
it doesn't even have the ability to do so.

00:03:21.140 --> 00:03:21.550
I got it.

00:03:21.550 --> 00:03:24.300
And so as I understand it, even on a host OS,

00:03:24.300 --> 00:03:24.940
there's a gateway,

00:03:24.940 --> 00:03:28.110
and that gateway is a virtual interface on your device that is shared

00:03:28.110 --> 00:03:32.880
now. There's a default route to that gateway from your host OS to get

00:03:32.880 --> 00:03:35.350
to the guest. So that's something that we should be concerned about,

00:03:35.520 --> 00:03:38.821
potentially put some firewall rules on. Potentially put some firewall

00:03:39.175 --> 00:03:42.730
rules, or we can actually modify it within a VMware itself and tell

00:03:42.730 --> 00:03:46.350
VMware just don't even allow the guest OS to even be able to access the

00:03:46.350 --> 00:03:47.120
host OS.

00:03:47.130 --> 00:03:48.070
Excellent. Do you want to show me that?

00:03:48.070 --> 00:03:48.360
Yeah.

00:03:48.440 --> 00:03:51.770
So what we're going to do is we're going to go into VMware, and we're going to

00:03:51.770 --> 00:03:56.200
modify the virtual network settings. Right here I have VMware up and running. I

00:03:56.200 --> 00:03:58.270
have a Windows 10 virtual machine up and running.

00:03:58.270 --> 00:04:00.420
But what we're going to do is we're going to go up to the Edit

00:04:00.420 --> 00:04:02.800
menu and go down to Virtual Network Editor.

00:04:02.930 --> 00:04:07.090
And what this is going to do is it's going to load up the way that we can go in

00:04:07.090 --> 00:04:10.450
and modify any of the virtual network settings within VMware. And what I'm going

00:04:10.450 --> 00:04:11.874
to do is I'm going to go down here to Change Settings. I'm going to click

00:04:16.260 --> 00:04:19.290
through all this. And once it comes back up,

00:04:19.300 --> 00:04:22.230
what it's going to do is it's going to allow us to modify the

00:04:22.230 --> 00:04:26.310
settings for the host‑only network. And then you apply that to

00:04:26.320 --> 00:04:29.550
whatever virtual NIC is attached to the VM. Yes.

00:04:29.640 --> 00:04:32.140
So here the Virtual Network Editor has come back up.

00:04:32.140 --> 00:04:34.030
You can see that I have three networks here, the three

00:04:34.030 --> 00:04:35.750
networks that we talked about. I have bridged.

00:04:35.840 --> 00:04:37.690
I have NAT. And then I have host‑only,

00:04:37.700 --> 00:04:40.611
and I want my virtual machine that I'm going to be

00:04:40.611 --> 00:04:42.380
running malware be in host‑only mode.

00:04:42.380 --> 00:04:44.850
But I don't want it to be able to connect to my host OS.

00:04:45.010 --> 00:04:46.730
Each of those seem to have a different subnet as well.

00:04:46.740 --> 00:04:47.300
Exactly.

00:04:47.300 --> 00:04:50.650
You can go in here, you can modify the VM settings, the IP address settings,

00:04:50.650 --> 00:04:53.880
the gateways. All that fun stuff you can modify in here. But I'm going to

00:04:53.880 --> 00:04:57.700
select host‑only, and then down here where it says Connect a host virtual

00:04:57.700 --> 00:05:00.050
adapter to this network, I'm going to uncheck that.

00:05:00.540 --> 00:05:01.110
I see.

00:05:01.370 --> 00:05:05.190
Then just click OK, and it saves it.

00:05:05.200 --> 00:05:08.900
And now my guest OS cannot talk to my host OS.

00:05:09.310 --> 00:05:09.650
I see.

00:05:09.650 --> 00:05:12.000
And so if I run any malware in here,

00:05:12.010 --> 00:05:15.510
what's going to happen is that malware is not going to be able

00:05:15.510 --> 00:05:17.500
to talk to my host was over the network.

00:05:17.510 --> 00:05:17.950
Now,

00:05:18.830 --> 00:05:22.890
if there are any VM escape exploits within there, it's still could

00:05:22.890 --> 00:05:26.430
escape out to the host OS because that goes through a different

00:05:26.440 --> 00:05:29.090
interface. It doesn't go through the network. However,

00:05:30.090 --> 00:05:33.360
at least now it's not going to be going over the network to get to the host

00:05:33.360 --> 00:05:37.435
OS, which you may want and you may not want. You may want to allow your host

00:05:37.435 --> 00:05:39.850
OS and your guest OS to talk over the network,

00:05:39.940 --> 00:05:41.890
but at least we have the option to turn that off.

00:05:41.990 --> 00:05:42.730
Yeah, absolutely.

00:05:42.730 --> 00:05:45.794
So if we're in VirtualBox or Hyper‑V, essentially what we're doing is,

00:05:45.880 --> 00:05:48.905
there's probably some checkbox for this in those as well, essentially what

00:05:48.905 --> 00:05:53.370
we're doing is taking that gateway or that default route for the host

00:05:53.370 --> 00:05:57.350
network that the VM's taking out to get to the host, we're taking that and

00:05:57.360 --> 00:05:58.800
disconnecting it from the host.

00:05:58.810 --> 00:06:01.544
So it still is there for the VM, but it's not routable from the host

00:06:02.090 --> 00:06:03.760
OS. So whatever setting you need to do to do that,

00:06:03.770 --> 00:06:04.730
that's how you cut it off.

00:06:04.940 --> 00:06:07.960
Great. So with this in these network settings,

00:06:07.960 --> 00:06:12.060
if we wanted to monitor the network traffic or do

00:06:12.060 --> 00:06:14.450
simulations for network traffic, how are we going to do that?

00:06:14.840 --> 00:06:17.810
So there are a couple ways that you can do, and at that point,

00:06:17.810 --> 00:06:20.700
you kind of need to rely on some tools to help you out.

00:06:20.750 --> 00:06:23.110
And there are a number of tools that you can use for this.

00:06:23.110 --> 00:06:25.790
One tool from FireEye is called FakeNet.

00:06:26.010 --> 00:06:29.150
And what FakeNet does is you run it in your guest OS so you

00:06:29.150 --> 00:06:30.720
don't need any other separate systems.

00:06:30.730 --> 00:06:34.630
You only need your single virtual machine and you run that.

00:06:34.630 --> 00:06:39.490
And what FakeNet does is it will basically intercept all the traffic going out

00:06:39.500 --> 00:06:43.270
over the network from your virtual machine and respond to it.

00:06:43.270 --> 00:06:47.730
So if you're running malware and your malware makes a DNS request, FakeNet

00:06:48.770 --> 00:06:52.250
is going to capture that DNS request and respond to it.

00:06:52.460 --> 00:06:55.840
And then if the malware then tries to go to a web server or some other

00:06:55.840 --> 00:06:59.430
IP address, FakeNet is going to capture that and respond to it, and

00:06:59.430 --> 00:07:02.410
it's going to be logging all of this as it goes through. It logs both

00:07:02.420 --> 00:07:04.450
the text of the connections,

00:07:04.450 --> 00:07:09.070
saying this program tried to go to this IP address and so on.

00:07:09.070 --> 00:07:12.760
And it's also going to log those as PCAP. So you can then go in and use

00:07:13.410 --> 00:07:18.335
Wireshark or Suricata or Bro or any other network analysis tool that can

00:07:18.335 --> 00:07:21.780
analyze PCAPS to analyze that network traffic. That's great.

00:07:21.780 --> 00:07:22.940
So, really,

00:07:22.940 --> 00:07:25.590
what you're being able to do is by simulating or putting kind of a

00:07:25.590 --> 00:07:29.630
proxy layer in between the network and the malware, you're able to

00:07:29.760 --> 00:07:33.150
then capture the indicator as a compromise. Right. So when we're

00:07:33.150 --> 00:07:34.510
looking at static analysis,

00:07:34.510 --> 00:07:38.065
that's the stuff that's going to pop into memory as we ran the machine

00:07:38.065 --> 00:07:41.860
if we dynamically debugged that malware. Right. But, instead now,

00:07:41.860 --> 00:07:45.003
instead of having to to understand how to do any of that or unpack it or

00:07:45.003 --> 00:07:47.610
hit the correct entry point or anything, we essentially just

00:07:47.610 --> 00:07:51.920
double‑click the malware, let it do its thing, and then let FakeNet tell

00:07:51.920 --> 00:07:52.740
us where it's going to go.

00:07:52.740 --> 00:07:55.500
So we get domains and IPs and that kind of thing that we can use to

00:07:55.500 --> 00:07:57.920
then search throughout the rest of our environment.

00:07:58.010 --> 00:07:58.290
Yeah,

00:07:58.300 --> 00:08:01.260
that's exactly what we're doing here. We're setting up our environment

00:08:01.260 --> 00:08:03.580
so we don't have to go in and understand assembly.

00:08:03.580 --> 00:08:09.555
We don't have to go in and try to deobfuscate IP addresses or strings or

00:08:09.555 --> 00:08:12.670
hostnames or anything like that. We're going to let the malware kind of unpack

00:08:12.670 --> 00:08:16.940
itself, undo all of its protections that it might have in place so that we can

00:08:16.940 --> 00:08:19.070
monitor how it interacts with the environment.

00:08:19.370 --> 00:08:20.360
Yeah, that's awesome.

00:08:20.360 --> 00:08:22.060
And I've used TCPView.

00:08:22.210 --> 00:08:24.930
Is that what you‑‑‑another thing you mentioned that I think is really important

00:08:24.930 --> 00:08:27.630
is we can look at a PCAP and you can kind of come from a network perspective,

00:08:27.630 --> 00:08:31.750
and this goes back to monitoring security operations, we kind of look at the

00:08:31.750 --> 00:08:35.335
network and then separately we look at the host. But when we're detonating the

00:08:35.335 --> 00:08:38.960
malware, a really important part is tying that process to the TCP connection to

00:08:38.970 --> 00:08:40.070
the network indicators.

00:08:40.080 --> 00:08:44.830
That's a much better behavioral analysis capability

00:08:44.830 --> 00:08:46.880
than you would otherwise have. Yeah,

00:08:46.890 --> 00:08:50.390
and that's a good point here. With FakeNet, it actually will

00:08:50.390 --> 00:08:54.030
tie that process, the process ID, the process name to the

00:08:54.290 --> 00:08:56.100
process that made that connection.

00:08:56.490 --> 00:08:58.750
There's another way to do kind of this network

00:08:58.750 --> 00:09:01.820
simulation where you use a second system.

00:09:01.820 --> 00:09:07.500
So what you would do is we had talked about we can set up a second VM and have

00:09:07.500 --> 00:09:11.370
it be on the same network. We could do that and set up a, let's say like a

00:09:11.370 --> 00:09:14.320
Linux VM and run software like INetSim or PyNetSim,

00:09:15.200 --> 00:09:18.240
which are essentially just a bunch of scripts that do the same thing

00:09:18.240 --> 00:09:20.760
that FakeNet does, except they run on another system.

00:09:20.940 --> 00:09:25.700
And so there's a bit more configuration that's needed on your end.

00:09:25.890 --> 00:09:29.180
You need to do things like on your Windows guest, set up the DNS

00:09:29.360 --> 00:09:33.010
server to be your Linux box that's running the software, the default

00:09:33.010 --> 00:09:35.050
gateway to be the software, and so on.

00:09:36.330 --> 00:09:37.230
But it still might work.

00:09:37.240 --> 00:09:40.450
You still might need to go down this route because malware

00:09:41.050 --> 00:09:42.800
might be looking to see if FakeNet is running,

00:09:42.800 --> 00:09:43.240
and if it is,

00:09:43.240 --> 00:09:46.510
it might not work, or it might it not execute like you expect it to.

00:09:46.510 --> 00:09:49.200
So you have to have that second system somehow.

00:09:49.620 --> 00:09:51.380
Now when you have the second system like this, and

00:09:51.380 --> 00:09:53.040
you're using INetSim or PyNetSim,

00:09:53.270 --> 00:09:57.160
in order to capture the network traffic and fake the malware into

00:09:57.160 --> 00:10:01.020
thinking that it's on the internet or network, you lose that ability

00:10:01.020 --> 00:10:04.300
to see what process generated that traffic.

00:10:04.310 --> 00:10:04.640
I see.

00:10:04.640 --> 00:10:06.206
So you're going to need other tools to be able to

00:10:06.206 --> 00:10:08.080
correlate that information? Exactly.

00:10:08.230 --> 00:10:08.930
It's a really good point.

00:10:08.930 --> 00:10:10.060
And then also you talked about having to set up DNS and

00:10:10.060 --> 00:10:14.060
potentially DCP or whatever is going to make it look like a real

00:10:14.070 --> 00:10:15.890
kind of network environment for enterprise.

00:10:15.990 --> 00:10:19.660
But that goes back to comfortability level. If you're not comfortable

00:10:19.660 --> 00:10:22.420
using VirtualBox versus VMware, then don't do it.

00:10:22.430 --> 00:10:25.180
If you're not comfortable setting up DNS in a way that you

00:10:25.180 --> 00:10:28.160
think's going to make sure that you're protecting your host OS

00:10:28.160 --> 00:10:29.290
or whatever else you're connected to,

00:10:29.360 --> 00:10:32.050
then don't do it. You're making a good point here

00:10:32.060 --> 00:10:34.620
in that we're analyzing malware,

00:10:34.620 --> 00:10:38.980
but it's still not something that I would recommend for somebody beginning

00:10:38.980 --> 00:10:43.110
in computers or IT or security to necessarily do. You do need to understand

00:10:43.110 --> 00:10:47.600
how to do these things and why you need to do these things and when you

00:10:47.600 --> 00:10:53.320
should do them. We're talking so far about initially having your malware

00:10:53.470 --> 00:10:57.770
only connect over the network in host‑only network remote so it can't get

00:10:57.770 --> 00:10:58.580
to the internet.

00:10:58.940 --> 00:11:02.200
Right. There are times where you do want the malware to

00:11:02.200 --> 00:11:04.620
connect to the internet or to another network,

00:11:04.630 --> 00:11:09.310
and so you have to put your VM in NATs or bridged mode to allow it to do that.

00:11:09.320 --> 00:11:13.380
But you also have to understand the consequences of doing that and why

00:11:13.380 --> 00:11:16.670
you should do and, more importantly, how you should do that. You want

00:11:16.670 --> 00:11:19.470
to make sure you're not connected to your corporate network when you're

00:11:19.480 --> 00:11:23.300
doing it or even any network that's able to be attributed back to you

00:11:23.420 --> 00:11:28.130
because looking at the worst‑case scenario, if the attacker sees that

00:11:28.130 --> 00:11:32.200
you're analyzing their malware from an IP address that they don't

00:11:32.200 --> 00:11:35.070
expect, they could attack back,

00:11:35.080 --> 00:11:37.590
they could launch a denial of service attack back at you.

00:11:37.590 --> 00:11:41.840
And this stuff has happened, so you really do need to be careful if and when

00:11:41.840 --> 00:11:46.930
you do this. I've seen where malware authors will leave notes for reverse

00:11:47.320 --> 00:11:50.440
engineers from FireEye and stuff. Absolutely.

00:11:50.450 --> 00:11:53.700
I've even had malware that I've been analyzing that I wanted to connect up

00:11:53.700 --> 00:11:57.740
to the network where I've had the malware author start chatting with me in

00:11:57.740 --> 00:12:00.450
my virtual machine and start asking me questions, and we get into a

00:12:00.450 --> 00:12:03.260
conversation. So this stuff does happen.

00:12:03.290 --> 00:12:03.660
That's great.

00:12:03.660 --> 00:12:06.270
Were they nice at least? They were nice. There were nice.

00:12:06.270 --> 00:12:09.600
Well, that's good. I kept trying to get them to give me some

00:12:09.610 --> 00:12:12.090
interesting information, who they were, where they were at.

00:12:12.360 --> 00:12:15.400
Unfortunately, they didn't fall for that, but it does happen.
