WEBVTT

00:00:02.140 --> 00:00:06.240
All right, it's time to hop into the lab for our first demo of the course.

00:00:06.240 --> 00:00:07.530
In this one,

00:00:07.530 --> 00:00:11.790
we're going to practice writing some network traffic signatures and

00:00:11.790 --> 00:00:15.100
then detail each of the components of them to identify what we're

00:00:15.100 --> 00:00:17.350
trying to do and how we can accomplish it.

00:00:18.140 --> 00:00:22.660
Then we'll validate them and see what the outputs look like when we get a match.

00:00:23.840 --> 00:00:26.220
All right, and here we are into the lab,

00:00:26.230 --> 00:00:28.780
or in my Zeek environment, and remember,

00:00:28.790 --> 00:00:30.730
this course assumes that you have a basic

00:00:30.730 --> 00:00:32.659
understanding of Zeek and Zeek control.

00:00:33.140 --> 00:00:36.330
So if you don't, please check out my course,

00:00:36.330 --> 00:00:41.050
Getting Started with Zeek or check out the Zeek documentation to be

00:00:41.050 --> 00:00:44.680
able to install it and get it configured and get it up and running

00:00:44.690 --> 00:00:46.460
so you can follow along in this demo.

00:00:47.240 --> 00:00:51.540
So what we want to do here is create two signatures to help us

00:00:51.550 --> 00:00:54.770
ensure that we can detect specific network traffic,

00:00:54.780 --> 00:00:56.860
and these signatures are going to be pretty basic.

00:00:57.340 --> 00:00:58.900
So the first thing that we're going to do is

00:00:58.900 --> 00:01:01.260
navigate to my local site directory,

00:01:01.840 --> 00:01:04.450
and we're going to hang out here for a little while.

00:01:04.450 --> 00:01:06.360
Now, as you can see,

00:01:06.840 --> 00:01:11.260
I have some logs in here with two signatures already created.

00:01:11.840 --> 00:01:15.570
So we're going to look at this telnet.sig first and break it down,

00:01:15.570 --> 00:01:19.660
and then we'll go into the http.sig and detail that as well.

00:01:20.740 --> 00:01:23.190
So if we're looking at this telnet.sig,

00:01:23.200 --> 00:01:27.490
we have a signature statement saying that this is the signature that follows,

00:01:27.490 --> 00:01:29.850
and then we have the name of the actual signature,

00:01:29.850 --> 00:01:30.850
which is just telnet.

00:01:31.640 --> 00:01:36.050
Now, as you can see here, I'm using a couple of the header conditions,

00:01:36.050 --> 00:01:39.970
so we have the IP protocol, which is going to be TCP,

00:01:39.980 --> 00:01:42.360
and then the destination port, which is 23.

00:01:43.240 --> 00:01:47.160
These are the only conditions that I'm using in this particular signature.

00:01:48.440 --> 00:01:50.490
And this is just a simple detection for saying,

00:01:50.490 --> 00:01:55.060
hey, anybody that is using telnet, let's generate a notification.

00:01:55.940 --> 00:01:59.230
And so this event right here is what's telling Zeek what this

00:01:59.230 --> 00:02:01.550
signature's going to do after it matches.

00:02:02.140 --> 00:02:04.450
So in this case we're going to raise an event,

00:02:05.040 --> 00:02:09.740
and the message of the event's going to ask why are you even doing this?

00:02:09.740 --> 00:02:11.660
Now you can have this as anything.

00:02:11.660 --> 00:02:13.940
You can say telnet protocol detected,

00:02:13.950 --> 00:02:17.810
or you can have instructions on what the SOC analyst might

00:02:17.810 --> 00:02:21.870
have to do in this situation or who to contact in the event

00:02:21.870 --> 00:02:23.140
something like this happens.

00:02:23.210 --> 00:02:25.040
We can put any sort of string in here,

00:02:25.040 --> 00:02:29.030
and we'll show you in the next clip where this gets raised and where we

00:02:29.030 --> 00:02:32.260
can look in order to see the event actually happening.

00:02:33.140 --> 00:02:37.750
So very basic signature, IP protocol, destination port, and that's it.

00:02:38.840 --> 00:02:41.990
Now let's exit this one and go into the HTTP one.

00:02:41.990 --> 00:02:44.650
And now that we're in here, as you can see,

00:02:45.140 --> 00:02:48.000
we have the two header conditions as well.

00:02:48.000 --> 00:02:51.170
We have the IP protocol, which is TCP again,

00:02:51.170 --> 00:02:54.280
and the destination port, which is port 80.

00:02:54.280 --> 00:02:57.460
But now we have a payload in here as well,

00:02:57.460 --> 00:03:00.920
and this payload condition is actually a content condition.

00:03:00.920 --> 00:03:06.450
So we're using regex here to look at the payload of the HTTP request,

00:03:06.460 --> 00:03:11.300
and we're looking for anything that has the database in there.

00:03:11.300 --> 00:03:15.500
And so if we're talking about trying to detect certain signatures,

00:03:15.500 --> 00:03:19.190
this is an example of potentially protecting critical asset data.

00:03:19.190 --> 00:03:22.060
So if we have a server in here that we're trying to

00:03:22.070 --> 00:03:24.220
protect with critical data on it,

00:03:24.220 --> 00:03:27.380
maybe we want to make sure that nobody tries to web

00:03:27.390 --> 00:03:30.200
into a database or anything like that.

00:03:30.200 --> 00:03:34.340
Now hopefully the databases wouldn't be available via HTTP,

00:03:34.340 --> 00:03:36.640
but this is just an example of this kind of detection.

00:03:36.640 --> 00:03:40.360
So we're looking inside of the payload at the URI itself,

00:03:40.360 --> 00:03:43.650
and if anything says database in that string,

00:03:43.660 --> 00:03:46.170
then it's going to raise this event.

00:03:46.170 --> 00:03:51.100
And to make it even more specific, let's say this is on our server 30.11.

00:03:51.110 --> 00:03:57.030
So, what we'll do is, we'll do the destination IP here and make it 30.11,

00:03:57.040 --> 00:03:58.910
not 30.7.

00:03:58.910 --> 00:04:02.840
All right, and now that that's created, we should be good to save this.

00:04:02.840 --> 00:04:07.800
Now when we're talking about the HTTP analyzer and conditions surrounding that,

00:04:07.800 --> 00:04:10.710
we can have different HTTP types in the mix.

00:04:10.710 --> 00:04:14.780
So we can look at specific request types like GET or POST,

00:04:14.780 --> 00:04:19.420
we can look at HTTP responses or actual requests,

00:04:19.420 --> 00:04:20.209
and stuff like that.

00:04:20.209 --> 00:04:24.820
So there's a lot of capabilities in analyzing HTTP within Zeek.

00:04:24.820 --> 00:04:27.590
For here, we're just going to use the payload.

00:04:27.590 --> 00:04:30.540
Let's save this and exit it.

00:04:30.540 --> 00:04:35.540
Now to actually activate these, we need to modify our local script,

00:04:35.540 --> 00:04:40.640
and we're not going to go into the details of the actual script itself yet,

00:04:40.640 --> 00:04:45.400
but we'll add a couple fields here just to make sure that the signature works.

00:04:45.410 --> 00:04:49.380
So next we're going to nano that local.zeek file,

00:04:49.380 --> 00:04:51.800
and this is our local site script.

00:04:51.800 --> 00:04:55.010
I'm going to scroll down to the bottom. I like loading my new packages

00:04:55.010 --> 00:04:58.110
and everything at the bottom. That way it just breaks it away from the

00:04:58.110 --> 00:05:01.050
built‑in stuff that Zeek comes with.

00:05:01.050 --> 00:05:04.190
So let's comment this and say this is for Globomantics

00:05:04.200 --> 00:05:09.210
custom signatures. Keep it standardized.

00:05:09.210 --> 00:05:14.740
All right, now we have to load two scripts or import them into this script in

00:05:14.740 --> 00:05:19.780
order to be able to activate the signatures that we just did.

00:05:19.780 --> 00:05:24.750
And those two are the notice framework and the signatures framework scripts.

00:05:24.750 --> 00:05:28.950
The notice framework import allows us to be able to use it for notifications

00:05:28.950 --> 00:05:32.160
and stuff like that, and we'll cover that in the next module.

00:05:32.160 --> 00:05:36.590
This main signatures one is a script that Zeek comes with

00:05:36.600 --> 00:05:39.860
that allows us to use its built‑in capabilities for the

00:05:39.860 --> 00:05:41.900
notice framework for signatures.

00:05:41.900 --> 00:05:45.950
So once the signature triggers, this main signatures script is going to

00:05:45.950 --> 00:05:49.950
tell it to send to the notice framework and log the match.

00:05:49.950 --> 00:05:54.470
Now we actually have to load our signatures themselves, and we do

00:05:54.470 --> 00:05:57.750
this by using the load‑sigs command in here.

00:05:57.750 --> 00:06:00.020
These scripts can be very customized,

00:06:00.030 --> 00:06:03.090
remember. The signatures can be customized, and you can use

00:06:03.090 --> 00:06:06.860
combinations of them to make this system really robust.

00:06:06.860 --> 00:06:10.830
And these are just those two basic signatures that we used, but

00:06:10.830 --> 00:06:14.680
combining them with the rest of Zeek's frameworks can really help us use

00:06:14.680 --> 00:06:19.800
these signature‑based IDS capabilities alongside of all of other Zeek's

00:06:19.800 --> 00:06:21.550
behavioral and analysis capabilities.

00:06:21.550 --> 00:06:23.440
All right, now that this is saved,

00:06:23.440 --> 00:06:26.320
what we have to do next is just go ahead and deploy it. And

00:06:26.320 --> 00:06:29.680
in the next clip, we'll test it out and validate that it's

00:06:29.680 --> 00:06:32.340
actually working as expected.

00:06:32.340 --> 00:06:33.040
So to deploy it,

00:06:33.040 --> 00:06:42.960
we're going to use the Zeek control command deploy, (Working) and there we

00:06:44.640 --> 00:06:47.550
go. As you can see, the signature name was the error.

00:06:47.550 --> 00:06:51.180
So modifying that allowed Zeek to actually deploy the new

00:06:51.180 --> 00:06:52.760
configurations and get the signatures going.
