WEBVTT

00:01.189 --> 00:05.370
>> Welcome to the Nmap
scripting engine lab.

00:05.370 --> 00:07.830
The goal of this lab is to

00:07.830 --> 00:10.590
find a Cisco switch
on the network.

00:10.590 --> 00:13.155
I'm going to run a
vulnerability scan against it,

00:13.155 --> 00:14.580
and then I'll exploit it,

00:14.580 --> 00:17.500
and then we'll look at
the results together.

00:17.780 --> 00:23.280
I'm running Windows 10 on
this scanning station.

00:23.280 --> 00:25.380
I'm going to go ahead
and navigate to

00:25.380 --> 00:28.620
the Nmap directory

00:28.620 --> 00:40.110
[NOISE].

00:40.110 --> 00:41.835
I'll clear the screen.

00:41.835 --> 00:44.900
First, we'll run a ping sweep,

00:44.900 --> 00:48.270
like we've run a lot
of times in the past.

00:51.070 --> 00:53.330
We use CIDR notation,

00:53.330 --> 00:54.770
but I'm going to
limit the scope of

00:54.770 --> 00:56.810
this scan since I

00:56.810 --> 00:59.940
have a little bit of
insight into this network.

01:00.350 --> 01:04.075
We have two Cisco devices here.

01:04.075 --> 01:06.950
I happen to know that
we're most interested in

01:06.950 --> 01:11.370
this device at 192.168.1.2.

01:12.530 --> 01:15.375
I'll clear the screen again.

01:15.375 --> 01:20.240
I'm going to do an OS
discovery on that device,

01:20.240 --> 01:22.250
we'll do it nmap-O.

01:30.130 --> 01:32.890
There's our results.

01:32.890 --> 01:35.810
It says no exact OS matches for

01:35.810 --> 01:38.720
hosts and gives us
the fingerprint.

01:38.720 --> 01:42.775
Does show us that port
23 and port 80 are open,

01:42.775 --> 01:45.170
but doesn't really give us

01:45.170 --> 01:49.160
very good information about
what operating system

01:49.160 --> 01:51.650
that host is running
other than we know

01:51.650 --> 01:55.460
the MAC address is here
and it's a Cisco device.

01:55.460 --> 02:00.060
I'll clear the screen
again [NOISE].

02:00.060 --> 02:02.120
If you remember from our OS

02:02.120 --> 02:06.785
detection scans in the
past, the previous lesson,

02:06.785 --> 02:17.700
we did a nmap-osscan-guess.

02:21.320 --> 02:25.825
What the scan does
is it gives us

02:25.825 --> 02:29.225
a reasonable amount of certainty

02:29.225 --> 02:34.010
about the operating system
that the target is running.

02:34.130 --> 02:41.625
Scroll up. Here you see
aggressive OS guesses,

02:41.625 --> 02:45.945
Cisco 2950 switch
running IOS 12.1,

02:45.945 --> 02:49.650
and that's a 98 percent
degree of certainty.

02:49.650 --> 02:53.325
That's pretty good, that's
good enough for me.

02:53.325 --> 02:57.520
I'll go ahead and clear
the screen again.

02:59.510 --> 03:02.630
First of all, we'll
run a typical

03:02.630 --> 03:05.630
>> default Nmap nse scan,

03:05.630 --> 03:12.930
>> and that is with nmap-sC
against our target.

03:15.260 --> 03:19.070
This runs every nse script

03:19.070 --> 03:22.860
that is categorized
as a default.

03:23.210 --> 03:26.895
It does give us some
good information,

03:26.895 --> 03:30.015
shows us the ports
again that are open,

03:30.015 --> 03:34.080
and you can see that
the HTTP off-script

03:34.080 --> 03:36.700
came back with results.

03:37.700 --> 03:39.915
Not earth-shattering,

03:39.915 --> 03:45.190
but I wanted to show you
that scan nonetheless.

03:45.680 --> 03:49.975
Next, what I really
wanted to show you was,

03:49.975 --> 03:54.620
currently we're in the
Nmap default directory

03:54.620 --> 03:56.045
on a Windows 10 device.

03:56.045 --> 04:00.950
This applies to any
operating system

04:00.950 --> 04:02.210
that you're running really,

04:02.210 --> 04:12.005
but if I go back a folder,

04:12.005 --> 04:13.670
a directory, and run

04:13.670 --> 04:20.070
an Nmap scan against
that same target,

04:20.810 --> 04:25.050
obviously, it'll still run
because Nmap is in the path.

04:25.050 --> 04:27.550
I'm going to cancel that,

04:28.160 --> 04:33.180
get back in the Nmap
folder, clear the screen.

04:33.180 --> 04:38.570
[NOISE] The reason I'm
showing you that is

04:38.570 --> 04:41.360
because one of the
ways that you can

04:41.360 --> 04:45.620
run an Nmap scan
is simply by using

04:45.620 --> 04:50.515
the command nmap --script,

04:50.515 --> 04:53.860
and then the name of the
script that you want to run.

04:53.860 --> 04:56.720
Well, where we're at right now,

04:56.720 --> 04:59.300
we don't know the name
of any of the scripts.

04:59.300 --> 05:02.905
Unless you just happen
to memorize them all,

05:02.905 --> 05:06.010
you wouldn't really
know what to run.

05:06.010 --> 05:08.780
Well, what I like to
do when I'm running

05:08.780 --> 05:11.150
Nmaps scripts, personally,

05:11.150 --> 05:12.905
if I'm doing it from
the command line,

05:12.905 --> 05:18.030
is I like to navigate into
the scripts directory.

05:18.760 --> 05:22.280
I'll do a dir*., which

05:22.280 --> 05:25.889
will show me all the folders
in the Nmap directory.

05:28.070 --> 05:32.225
You see this directory right
here, which is scripts.

05:32.225 --> 05:34.939
When I run Nmap scripts,

05:34.939 --> 05:36.950
I like to navigate
to that folder.

05:36.950 --> 05:44.940
We'll do a cd scripts.

05:44.940 --> 05:46.730
I'll clear the screen again

05:46.730 --> 05:49.290
because it's getting
a little lot messy.

05:49.850 --> 05:52.050
You do a dir here,

05:52.050 --> 05:55.380
you'll see every single
Nmap script that

05:55.380 --> 06:01.785
downloads and installs with
a default Nmap install.

06:01.785 --> 06:04.560
There's going to
be a lot of them.

06:04.560 --> 06:08.420
You can see there's 591 scripts,

06:08.420 --> 06:12.090
all with the extension of nse.

06:14.030 --> 06:16.595
Any of these scripts can be run

06:16.595 --> 06:21.590
from any location at the
command line because Nmap,

06:21.590 --> 06:23.210
as we learned earlier,

06:23.210 --> 06:28.110
is in the path in this
operating system.

06:28.160 --> 06:30.540
But I like to run

06:30.540 --> 06:33.890
the nse scripts from the
scripts folder simply

06:33.890 --> 06:36.950
because I can narrow down

06:36.950 --> 06:40.220
what script I'm
interested in the most,

06:40.220 --> 06:42.560
and there's just a
ton of them here.

06:42.560 --> 06:47.920
I think you get my main point.

06:48.200 --> 06:54.700
For instance, we see
this xmpp-info.nse.

06:55.360 --> 06:58.895
If I want to run that script,

06:58.895 --> 07:07.950
we can do an nmap
--script xmpp-info.

07:09.610 --> 07:12.200
Nmap has a lot of flexibility.

07:12.200 --> 07:19.060
We can do nmap --script
equals xmpp-info,

07:19.060 --> 07:24.100
or you can add the
nse if you want,

07:24.230 --> 07:28.295
or you can leave out
the equal sign and do

07:28.295 --> 07:34.905
xmpp-info alone or add
the nse, both will run.

07:34.905 --> 07:38.710
I actually don't know
what that script does.

07:38.780 --> 07:41.180
As we learned in the past,

07:41.180 --> 07:43.670
if you're interested in learning

07:43.670 --> 07:46.595
what a particular script does,

07:46.595 --> 07:52.620
you run a nmap  --script help.

07:55.250 --> 07:57.540
I can run it like that,

07:57.540 --> 08:00.045
or like I said, I
can add the nse.

08:00.045 --> 08:02.445
We'll go ahead and
run it like this,

08:02.445 --> 08:05.089
and just for giggles,

08:05.089 --> 08:07.530
I'll add the equal sign.

08:09.650 --> 08:12.755
The xmpp info,

08:12.755 --> 08:15.680
here are the categories that
it belongs to: default,

08:15.680 --> 08:18.930
safe, discovery, and version.

08:19.190 --> 08:21.980
Here's a brief description that

08:21.980 --> 08:24.620
the programmer provided
for us connects to

08:24.620 --> 08:28.040
xmpp server port
5222 and collect

08:28.040 --> 08:32.925
server information and so forth.

08:32.925 --> 08:34.940
If we want more information,

08:34.940 --> 08:41.080
we can highlight that URL
and go to it in our browser.

08:41.990 --> 08:45.995
The main point I wanted to
provide to you was that

08:45.995 --> 08:49.505
there's multiple ways that
you can run scripts in nse.

08:49.505 --> 08:51.290
You can run them from
multiple locations,

08:51.290 --> 08:54.589
but I like to run them in the
scripts folder personally

08:54.589 --> 08:58.310
because it's easy to
get help on them,

08:58.310 --> 09:00.200
learn about them, and easy

09:00.200 --> 09:02.450
to see a list of
all the ones that

09:02.450 --> 09:04.410
>> you're interested in.

09:06.589 --> 09:09.050
>> Another thing I want
to show you is that

09:09.050 --> 09:11.630
you can run scripts.

09:11.630 --> 09:15.125
For instance, this is in
the category default,

09:15.125 --> 09:17.540
safe, discovery, and version.

09:17.540 --> 09:22.040
You can run scripts
by their category

09:22.040 --> 09:29.290
by simply doing nmap  --script,

09:29.290 --> 09:33.100
and then putting the category.

09:33.830 --> 09:36.290
This one is a default script,

09:36.290 --> 09:37.520
but it's also a safe script.

09:37.520 --> 09:38.990
If I wanted to,

09:38.990 --> 09:44.200
I could also add safe to it,
and then put your target.

09:44.360 --> 09:46.395
I'll go ahead and run this.

09:46.395 --> 09:48.830
I'm going to run all of the
default and safe scripts

09:48.830 --> 09:52.980
against the target
that we found earlier.

09:56.180 --> 09:58.820
That script was taking
a little bit too long,

09:58.820 --> 10:01.100
so I'm going to
clear the screen.

10:01.100 --> 10:02.430
But you get the point.

10:02.430 --> 10:04.610
You can run multiple
categories by

10:04.610 --> 10:07.640
simply naming the category
and separating by a comma.

10:07.640 --> 10:10.460
The same is true with
a particular script.

10:10.460 --> 10:14.975
I'm currently in the
scripts folder of Nmap.

10:14.975 --> 10:16.865
I'll do a dir again,

10:16.865 --> 10:18.425
there's a ton of them here.

10:18.425 --> 10:22.730
Let's say I'm interested
in these vnc scripts.

10:22.730 --> 10:32.645
I'll do a dir *vnc*.* wildcards.

10:32.645 --> 10:38.280
Here's all the scripts
related to vnc.

10:38.660 --> 10:43.890
I'm interested in vnc
info and vnc title.

10:43.890 --> 10:50.280
I can do nmap  --script

10:50.280 --> 10:56.430
and see info and vnc tittle.

10:56.430 --> 10:59.320
We'll do against
the same target.

11:04.340 --> 11:09.575
My point is, next to the script,

11:09.575 --> 11:11.585
you can put an equals
sign if you want,

11:11.585 --> 11:15.500
and you can either
list the categories

11:15.500 --> 11:17.270
that you're interested
in or you can actually

11:17.270 --> 11:20.130
put the specific scripts.

11:20.390 --> 11:25.020
We've got our results. I'll
move on to the next thing,

11:25.020 --> 11:26.900
and that is one of the
most important reasons

11:26.900 --> 11:28.955
why I wanted to do this lab.

11:28.955 --> 11:31.400
That is, now that we found

11:31.400 --> 11:33.710
our Cisco switch on our network,

11:33.710 --> 11:36.830
I want to do a vulnerability
scan against it.

11:36.830 --> 11:41.330
In Nmap, one of the simplest
ways that you can do

11:41.330 --> 11:42.710
a vulnerability scan against

11:42.710 --> 11:47.015
any device is by using
the category vuln.

11:47.015 --> 11:52.670
We'll do nmap --script category

11:52.670 --> 11:57.930
vuln against the Cisco switch.

11:58.970 --> 12:01.565
The script takes a
little bit of time,

12:01.565 --> 12:05.930
so I'll cut the video and
once the results come back,

12:05.930 --> 12:10.125
we'll talk about them.
There's our results.

12:10.125 --> 12:12.850
I'm going to scroll up.

12:12.880 --> 12:18.230
Essentially that ran
every nse script

12:18.230 --> 12:25.870
that had a category of
vulnerability or vuln.

12:27.230 --> 12:31.575
I entered a bunch of
times to see the status,

12:31.575 --> 12:37.925
but you can see several
different vulnerabilities here.

12:37.925 --> 12:43.260
It's not vulnerable
to this dos attack.

12:43.930 --> 12:48.150
Does that telnet open,

12:49.810 --> 12:52.070
shows that it's vulnerable to

12:52.070 --> 12:56.280
authentication bypass
by HTTP Verb tampering,

12:58.130 --> 13:01.155
gives all the details here,

13:01.155 --> 13:03.350
the URLs where you can find

13:03.350 --> 13:07.780
out more information about
those vulnerabilities.

13:09.140 --> 13:13.025
It's really interesting
information to me.

13:13.025 --> 13:15.620
I would like to try to

13:15.620 --> 13:18.485
attack and exploit some
of those vulnerabilities.

13:18.485 --> 13:20.940
I'm going to clear the screen.

