WEBVTT

00:00:00.000 --> 00:00:10.320 align:middle line:90%


00:00:10.320 --> 00:00:13.410 align:middle line:84%
Now that we've covered the
basics of what a CVE is,

00:00:13.410 --> 00:00:18.150 align:middle line:84%
what a vulnerability is, and the
CVE and National Vulnerability

00:00:18.150 --> 00:00:21.660 align:middle line:84%
database, let's look at
some examples to help

00:00:21.660 --> 00:00:25.180 align:middle line:90%
understand a little more.

00:00:25.180 --> 00:00:28.710 align:middle line:84%
We're going to look at
Heartbleed, EternalBlue,

00:00:28.710 --> 00:00:29.480 align:middle line:90%
and Log4J.

00:00:29.480 --> 00:00:32.130 align:middle line:90%


00:00:32.130 --> 00:00:35.940 align:middle line:90%
We'll start with Heartbleed.

00:00:35.940 --> 00:00:42.120 align:middle line:84%
Now, I'm going to bring you over
to the CVE page for Heartbleed,

00:00:42.120 --> 00:00:46.590 align:middle line:84%
and here it talks about it being
TLS and DTLS implementation

00:00:46.590 --> 00:00:51.660 align:middle line:90%
of OpenSSL 1.0.1 through 1.0.1g.

00:00:51.660 --> 00:00:56.310 align:middle line:84%
Now, TLS-- and we'll get it
to this in a little example--

00:00:56.310 --> 00:00:59.900 align:middle line:84%
will encrypt data
in transmission.

00:00:59.900 --> 00:01:06.150 align:middle line:84%
Now, OpenSSL is the software
that allows for that encryption

00:01:06.150 --> 00:01:14.070 align:middle line:84%
and for private-public key
infrastructure that then

00:01:14.070 --> 00:01:16.770 align:middle line:90%
leads to a shared private key.

00:01:16.770 --> 00:01:21.405 align:middle line:84%
And it's in that utilization
where we see what

00:01:21.405 --> 00:01:22.530 align:middle line:90%
they're talking about here.

00:01:22.530 --> 00:01:28.050 align:middle line:84%
There is a heartbeat
extension for the packets,

00:01:28.050 --> 00:01:31.500 align:middle line:84%
and it allows remote attackers
to obtain sensitive information

00:01:31.500 --> 00:01:34.770 align:middle line:84%
from process memory
via crafted packets

00:01:34.770 --> 00:01:38.280 align:middle line:84%
that trigger a buffer
over read as demonstrated

00:01:38.280 --> 00:01:41.220 align:middle line:90%
by reading private keys.

00:01:41.220 --> 00:01:43.140 align:middle line:84%
That might not make
a lot of sense,

00:01:43.140 --> 00:01:45.780 align:middle line:84%
and I'll dig into
exactly how it works

00:01:45.780 --> 00:01:48.160 align:middle line:84%
and how you would
take advantage of it,

00:01:48.160 --> 00:01:50.220 align:middle line:84%
how you would exploit,
it in a minute.

00:01:50.220 --> 00:01:53.220 align:middle line:84%
But let's continue to
look at what research

00:01:53.220 --> 00:01:55.692 align:middle line:90%
we have on this vulnerability.

00:01:55.692 --> 00:02:00.120 align:middle line:90%


00:02:00.120 --> 00:02:02.340 align:middle line:84%
Now, National
Vulnerability database--

00:02:02.340 --> 00:02:05.070 align:middle line:84%
it's a lot of the
same information.

00:02:05.070 --> 00:02:06.900 align:middle line:90%
You can see evaluator impact.

00:02:06.900 --> 00:02:07.660 align:middle line:90%
This is new.

00:02:07.660 --> 00:02:14.500 align:middle line:84%
This is helpful, and you
got to take into account

00:02:14.500 --> 00:02:16.510 align:middle line:84%
the nature of the
data being protected

00:02:16.510 --> 00:02:19.300 align:middle line:84%
according to the
organization's risk acceptance.

00:02:19.300 --> 00:02:22.330 align:middle line:84%
That's exactly what
we talked about before

00:02:22.330 --> 00:02:23.710 align:middle line:90%
in risk management.

00:02:23.710 --> 00:02:28.510 align:middle line:84%
This vulnerability, though,
it's got a high rank, 7.5.

00:02:28.510 --> 00:02:31.270 align:middle line:84%
Organizations will
have to determine what

00:02:31.270 --> 00:02:32.440 align:middle line:90%
they're going to do with it.

00:02:32.440 --> 00:02:36.250 align:middle line:90%


00:02:36.250 --> 00:02:39.040 align:middle line:84%
It does not allow
unrestricted access to memory,

00:02:39.040 --> 00:02:42.370 align:middle line:84%
but it does leak
information from memory.

00:02:42.370 --> 00:02:45.610 align:middle line:84%
That could include cryptographic
keys and passwords.

00:02:45.610 --> 00:02:48.288 align:middle line:84%
If you have the cryptographic
keys and passwords,

00:02:48.288 --> 00:02:50.080 align:middle line:84%
well, passwords are
pretty straightforward,

00:02:50.080 --> 00:02:52.540 align:middle line:84%
but the cryptographic keys
mean that you could un-encrypt

00:02:52.540 --> 00:02:54.850 align:middle line:84%
all the traffic,
which TLS is meant

00:02:54.850 --> 00:03:03.680 align:middle line:84%
to prevent the eavesdropping and
reading of data in transport.

00:03:03.680 --> 00:03:04.828 align:middle line:90%
So that's not a good thing.

00:03:04.828 --> 00:03:05.620 align:middle line:90%
We don't want that.

00:03:05.620 --> 00:03:08.590 align:middle line:90%


00:03:08.590 --> 00:03:11.260 align:middle line:84%
Impact depends on sensitivity
of the data and function

00:03:11.260 --> 00:03:13.640 align:middle line:90%
of the system.

00:03:13.640 --> 00:03:17.010 align:middle line:90%
There's a bunch of references.

00:03:17.010 --> 00:03:20.320 align:middle line:84%
A lot of references,
and includes

00:03:20.320 --> 00:03:23.140 align:middle line:84%
some exploits and proof of
concepts on how to use this.

00:03:23.140 --> 00:03:25.030 align:middle line:84%
We'll actually look
at a few of those,

00:03:25.030 --> 00:03:27.160 align:middle line:84%
and then you have
weakness enumeration,

00:03:27.160 --> 00:03:29.830 align:middle line:84%
improper restriction of
operations within bounds

00:03:29.830 --> 00:03:33.250 align:middle line:84%
of memory buffer,
and you could dive

00:03:33.250 --> 00:03:35.110 align:middle line:90%
into exactly what that means.

00:03:35.110 --> 00:03:38.110 align:middle line:84%
But here's the known effect of
its software configurations,

00:03:38.110 --> 00:03:43.330 align:middle line:84%
and it's just different
versions of OpenSSL.

00:03:43.330 --> 00:03:46.885 align:middle line:84%
Looks like some implementations
in other software.

00:03:46.885 --> 00:03:50.740 align:middle line:90%


00:03:50.740 --> 00:03:55.840 align:middle line:84%
And so that's worthwhile
to look at and identify

00:03:55.840 --> 00:03:57.430 align:middle line:84%
are we using any of
the software that

00:03:57.430 --> 00:04:00.790 align:middle line:84%
is using that outdated
version of SSL.

00:04:00.790 --> 00:04:04.750 align:middle line:90%
We'll see this again in Log4J.

00:04:04.750 --> 00:04:09.560 align:middle line:84%
It's an underlying system
that other software might use.

00:04:09.560 --> 00:04:16.945 align:middle line:84%
So has long reach and a
lot of potential impact.

00:04:16.945 --> 00:04:21.100 align:middle line:90%


00:04:21.100 --> 00:04:23.740 align:middle line:90%
Now, we can scan for this.

00:04:23.740 --> 00:04:25.930 align:middle line:84%
You can find out
what version of SSL

00:04:25.930 --> 00:04:32.560 align:middle line:84%
is being utilized with this
Nmap script that will show which

00:04:32.560 --> 00:04:34.010 align:middle line:90%
enum ciphers are being used.

00:04:34.010 --> 00:04:37.120 align:middle line:84%
And there's an
example down here.

00:04:37.120 --> 00:04:42.130 align:middle line:84%
If we were to do
our service scan

00:04:42.130 --> 00:04:44.710 align:middle line:84%
and then with the
script ssl-enum-ciphers,

00:04:44.710 --> 00:04:48.400 align:middle line:84%
we've looked at
this in enumeration.

00:04:48.400 --> 00:04:53.740 align:middle line:84%
And so if you're not used
to using a script with Nmap,

00:04:53.740 --> 00:04:57.340 align:middle line:84%
go back and take a look at those
videos and review those labs.

00:04:57.340 --> 00:05:00.100 align:middle line:90%


00:05:00.100 --> 00:05:02.410 align:middle line:84%
In this situation, it's
going to be port 443

00:05:02.410 --> 00:05:04.330 align:middle line:90%
because that's HTTPS.

00:05:04.330 --> 00:05:07.750 align:middle line:84%
There's other-- again,
other utilizations of TLS.

00:05:07.750 --> 00:05:09.410 align:middle line:90%
This is just one of them.

00:05:09.410 --> 00:05:11.660 align:middle line:84%
This would be an example of,
hey, you found something.

00:05:11.660 --> 00:05:14.140 align:middle line:84%
Let's see if this
applies and see

00:05:14.140 --> 00:05:16.364 align:middle line:90%
if we can find a vulnerability.

00:05:16.364 --> 00:05:19.270 align:middle line:90%


00:05:19.270 --> 00:05:26.320 align:middle line:84%
In here, there is TLS
version 1, and that's not

00:05:26.320 --> 00:05:27.370 align:middle line:90%
terribly helpful.

00:05:27.370 --> 00:05:32.380 align:middle line:84%
It all depended on which
version of SSL or OpenSSL

00:05:32.380 --> 00:05:33.620 align:middle line:90%
was being utilized.

00:05:33.620 --> 00:05:35.590 align:middle line:90%
So we can go even deeper.

00:05:35.590 --> 00:05:39.700 align:middle line:84%
There's a specific script
for SSL Heartbleed,

00:05:39.700 --> 00:05:43.780 align:middle line:84%
and you can detect if a server
is vulnerable to the Heartbleed

00:05:43.780 --> 00:05:46.000 align:middle line:90%
bug.

00:05:46.000 --> 00:05:51.820 align:middle line:84%
Again, it's going to look
for TLS 1.0, 1.1, and 1.2.

00:05:51.820 --> 00:05:54.120 align:middle line:90%
Let's look at it down here.

00:05:54.120 --> 00:05:59.480 align:middle line:84%
What we see is when it runs a
scan, it comes back with, hey,

00:05:59.480 --> 00:06:02.058 align:middle line:90%
this is vulnerable.

00:06:02.058 --> 00:06:03.850 align:middle line:84%
It tells you a little
bit about Heartbleed,

00:06:03.850 --> 00:06:07.540 align:middle line:84%
says it's vulnerable, high risk
factor, and the description.

00:06:07.540 --> 00:06:16.000 align:middle line:84%
It's using OpenSSL version
1.01 and 1.02 beta.

00:06:16.000 --> 00:06:19.720 align:middle line:84%
So we can scan for that
exact vulnerability

00:06:19.720 --> 00:06:23.080 align:middle line:84%
to see if it's on network,
and you don't necessarily

00:06:23.080 --> 00:06:26.050 align:middle line:90%
have to pick just one port.

00:06:26.050 --> 00:06:27.820 align:middle line:84%
If you found a whole
bunch of open ports

00:06:27.820 --> 00:06:30.400 align:middle line:84%
and you know several
of them are using

00:06:30.400 --> 00:06:35.552 align:middle line:84%
a secured encrypted
protocol, then you

00:06:35.552 --> 00:06:37.510 align:middle line:84%
might want to run the
scan against all of them.

00:06:37.510 --> 00:06:39.490 align:middle line:84%
You could run
against all of them.

00:06:39.490 --> 00:06:42.490 align:middle line:84%
If it doesn't apply,
it'll skip it.

00:06:42.490 --> 00:06:44.650 align:middle line:84%
Nmap scripts are usually
pretty helpful that way.

00:06:44.650 --> 00:06:49.310 align:middle line:90%


00:06:49.310 --> 00:06:54.560 align:middle line:84%
What we have here is Exploit
DB, the exploit database.

00:06:54.560 --> 00:06:58.460 align:middle line:84%
You can see it's run
by Offensive Security.

00:06:58.460 --> 00:07:01.920 align:middle line:84%
It's a great tool they
put out for the community,

00:07:01.920 --> 00:07:04.190 align:middle line:84%
and I've searched
just for Heartbleed.

00:07:04.190 --> 00:07:08.180 align:middle line:84%
Normally, on Exploit DB, this is
the first implementation here.

00:07:08.180 --> 00:07:11.990 align:middle line:90%
It's just a large database.

00:07:11.990 --> 00:07:15.650 align:middle line:84%
If you take a look down
there, 44,000 entries, and it

00:07:15.650 --> 00:07:19.040 align:middle line:84%
gets updated fairly
regularly-- these last three

00:07:19.040 --> 00:07:22.670 align:middle line:84%
in the last week
of this recording.

00:07:22.670 --> 00:07:26.450 align:middle line:90%


00:07:26.450 --> 00:07:29.270 align:middle line:84%
It can be fairly straightforward
to search for things.

00:07:29.270 --> 00:07:33.770 align:middle line:84%
If I just type "Heartbleed,"
we come across a few proof

00:07:33.770 --> 00:07:37.400 align:middle line:84%
concepts, and here's
what they look like.

00:07:37.400 --> 00:07:41.000 align:middle line:90%
This one is a Python script.

00:07:41.000 --> 00:07:46.686 align:middle line:84%
It looks like it's
Python 2 or I think 2.7.

00:07:46.686 --> 00:07:49.070 align:middle line:90%
Don't look like Python 3.

00:07:49.070 --> 00:07:51.020 align:middle line:84%
You don't necessarily
need to know what

00:07:51.020 --> 00:07:53.180 align:middle line:90%
all this code is doing yet.

00:07:53.180 --> 00:07:57.128 align:middle line:84%
It'll be nice if you
get there, but you

00:07:57.128 --> 00:07:58.670 align:middle line:84%
could look at these
proof of concepts

00:07:58.670 --> 00:08:00.410 align:middle line:90%
and get an idea of, oh, OK.

00:08:00.410 --> 00:08:02.570 align:middle line:84%
So if I run that scan,
what is it doing?

00:08:02.570 --> 00:08:06.980 align:middle line:84%
Because that's what
this code is doing.

00:08:06.980 --> 00:08:10.170 align:middle line:84%
It is just checking to
see if it is vulnerable.

00:08:10.170 --> 00:08:11.460 align:middle line:90%
It's not exploiting it.

00:08:11.460 --> 00:08:15.330 align:middle line:84%
It's just saying is
this vulnerable or not.

00:08:15.330 --> 00:08:20.510 align:middle line:84%
So you could see
what it returns.

00:08:20.510 --> 00:08:26.360 align:middle line:84%
If it receives an alert
and it is vulnerable,

00:08:26.360 --> 00:08:32.669 align:middle line:90%
then we should see this warning.

00:08:32.669 --> 00:08:33.169 align:middle line:90%
Warning.

00:08:33.169 --> 00:08:35.090 align:middle line:84%
Server returned more
data than it should.

00:08:35.090 --> 00:08:37.190 align:middle line:90%
Server is vulnerable.

00:08:37.190 --> 00:08:39.919 align:middle line:84%
Now, you may be wondering
what all that means.

00:08:39.919 --> 00:08:43.130 align:middle line:84%
Why is it returning more
data than it should?

00:08:43.130 --> 00:08:46.745 align:middle line:90%
Now let's return to our example.

00:08:46.745 --> 00:08:52.250 align:middle line:90%


00:08:52.250 --> 00:08:53.750 align:middle line:84%
So we've looked at
some of the data.

00:08:53.750 --> 00:09:00.943 align:middle line:84%
If you came across a service
that was utilizing encryption,

00:09:00.943 --> 00:09:03.110 align:middle line:84%
then you might want to run
some of those Nmap scans.

00:09:03.110 --> 00:09:06.110 align:middle line:84%
You might want to
run the Metasploit

00:09:06.110 --> 00:09:09.080 align:middle line:90%
module that enumerates that.

00:09:09.080 --> 00:09:10.670 align:middle line:84%
You might want to
run Nessus scan.

00:09:10.670 --> 00:09:15.560 align:middle line:84%
All those things can find
whether it's vulnerable or not.

00:09:15.560 --> 00:09:16.620 align:middle line:90%
Now, what does it mean?

00:09:16.620 --> 00:09:18.620 align:middle line:84%
What does it look like
when it is vulnerable?

00:09:18.620 --> 00:09:22.070 align:middle line:90%
So you can run your Nmap scan.

00:09:22.070 --> 00:09:23.310 align:middle line:90%
Check for services.

00:09:23.310 --> 00:09:27.860 align:middle line:84%
If you come across something
that uses encryption,

00:09:27.860 --> 00:09:35.240 align:middle line:84%
it might utilize that
OpenSSL 1.0.1 to 1.0.1f, fox,

00:09:35.240 --> 00:09:45.320 align:middle line:84%
and then you could utilize an
actual proof of concept and run

00:09:45.320 --> 00:09:47.373 align:middle line:84%
the vulnerability,
exploit the code,

00:09:47.373 --> 00:09:49.790 align:middle line:84%
exploit that vulnerability,
and this is what it would look

00:09:49.790 --> 00:09:50.290 align:middle line:90%
like.

00:09:50.290 --> 00:09:53.450 align:middle line:90%


00:09:53.450 --> 00:09:57.830 align:middle line:84%
The way TLS normally
happens is we send a packet

00:09:57.830 --> 00:09:59.960 align:middle line:90%
as part of the TLS handshake.

00:09:59.960 --> 00:10:01.730 align:middle line:90%
So there's the TCP handshake.

00:10:01.730 --> 00:10:04.820 align:middle line:84%
It sets up the connection, and
then the next layer above that

00:10:04.820 --> 00:10:07.430 align:middle line:90%
is the encryption connection.

00:10:07.430 --> 00:10:10.550 align:middle line:84%
As part of that, there's going
to be public and private keys

00:10:10.550 --> 00:10:14.180 align:middle line:84%
for either side that are
going to encrypt a shared

00:10:14.180 --> 00:10:19.460 align:middle line:90%
private key that is symmetric.

00:10:19.460 --> 00:10:26.360 align:middle line:84%
What's important there is
as part of the TLS handshake

00:10:26.360 --> 00:10:29.820 align:middle line:84%
the client tells the server
this is the password,

00:10:29.820 --> 00:10:31.400 align:middle line:90%
and the password is this length.

00:10:31.400 --> 00:10:33.440 align:middle line:84%
And then the server
itself is going

00:10:33.440 --> 00:10:38.760 align:middle line:84%
to respond with confirmed,
this is the password.

00:10:38.760 --> 00:10:43.850 align:middle line:84%
And that confirmation, what
it's sending back is based on--

00:10:43.850 --> 00:10:47.900 align:middle line:84%
I'll go back-- that
password length.

00:10:47.900 --> 00:10:53.210 align:middle line:84%
Now, someone found that if
you sent here's the password,

00:10:53.210 --> 00:10:59.150 align:middle line:84%
and the password length is in
this case 52 instead of 12.

00:10:59.150 --> 00:11:01.970 align:middle line:84%
Then you could get back,
hey, this is the password,

00:11:01.970 --> 00:11:09.200 align:middle line:84%
then in memory whatever the
next 40 characters are as well.

00:11:09.200 --> 00:11:12.170 align:middle line:84%
And all that would
come back, and you'd

00:11:12.170 --> 00:11:13.550 align:middle line:90%
have to take a look at it.

00:11:13.550 --> 00:11:15.890 align:middle line:90%
It's going to be in the packets.

00:11:15.890 --> 00:11:19.070 align:middle line:84%
It's not necessarily
going to be obvious.

00:11:19.070 --> 00:11:22.040 align:middle line:84%
And the way that you craft
packets to find this,

00:11:22.040 --> 00:11:23.030 align:middle line:90%
you could use Scapy.

00:11:23.030 --> 00:11:24.320 align:middle line:90%
You could use Python.

00:11:24.320 --> 00:11:28.640 align:middle line:84%
There's Metasploit modules
that take advantage of this

00:11:28.640 --> 00:11:31.400 align:middle line:84%
and exploits in the
Metasploit framework

00:11:31.400 --> 00:11:34.340 align:middle line:84%
that you can gather back
the information you want.

00:11:34.340 --> 00:11:36.860 align:middle line:90%


00:11:36.860 --> 00:11:41.990 align:middle line:84%
It can go all the way
up to 64,000 characters

00:11:41.990 --> 00:11:45.830 align:middle line:84%
so that you could
pull pages of data.

00:11:45.830 --> 00:11:49.130 align:middle line:84%
Thus, if someone were to
find this vulnerability,

00:11:49.130 --> 00:11:52.220 align:middle line:84%
then they could just keep
asking for more information.

00:11:52.220 --> 00:11:56.990 align:middle line:84%
And as the server
processes information,

00:11:56.990 --> 00:11:59.940 align:middle line:84%
it doesn't always go
to the same location.

00:11:59.940 --> 00:12:03.080 align:middle line:84%
It's a buffer over-read,
and so depending

00:12:03.080 --> 00:12:08.960 align:middle line:84%
on where in memory that variable
that is part of the handshake

00:12:08.960 --> 00:12:11.690 align:middle line:84%
gets stored, it's then
going to read Linux stuff.

00:12:11.690 --> 00:12:14.450 align:middle line:90%
So it can be quite dangerous.

00:12:14.450 --> 00:12:16.820 align:middle line:84%
You can get pages and
pages of information

00:12:16.820 --> 00:12:19.320 align:middle line:90%
from the memory of the server.

00:12:19.320 --> 00:12:22.820 align:middle line:84%
And if the server is
compromised and the client

00:12:22.820 --> 00:12:27.440 align:middle line:84%
was utilizing a vulnerable
version of OpenSSL,

00:12:27.440 --> 00:12:29.790 align:middle line:84%
it could actually
go the other way.

00:12:29.790 --> 00:12:36.690 align:middle line:84%
So that's why even as
attackers or practitioners

00:12:36.690 --> 00:12:38.630 align:middle line:84%
we need to keep our
systems up to date.

00:12:38.630 --> 00:12:41.580 align:middle line:90%


00:12:41.580 --> 00:12:44.000 align:middle line:84%
And in this situation, it
sends back information,

00:12:44.000 --> 00:12:48.950 align:middle line:84%
and I cut it off
after a certain point

00:12:48.950 --> 00:12:51.170 align:middle line:84%
with some dot, dot,
dot 64,000 characters.

00:12:51.170 --> 00:12:53.820 align:middle line:84%
It's going to fill up
the page way too much.

00:12:53.820 --> 00:12:55.590 align:middle line:84%
And so that's how
Heartbleed works.

00:12:55.590 --> 00:13:00.560 align:middle line:84%
That's how it's utilized and
understanding that you probably

00:13:00.560 --> 00:13:01.340 align:middle line:90%
won't--

00:13:01.340 --> 00:13:04.400 align:middle line:84%
hopefully, you won't see it
in the wild on a pen test.

00:13:04.400 --> 00:13:06.770 align:middle line:84%
But if you were to
run something similar,

00:13:06.770 --> 00:13:10.430 align:middle line:84%
now you know how to look for it
in the National Vulnerability

00:13:10.430 --> 00:13:13.795 align:middle line:84%
Database and then
on ExploitDB see

00:13:13.795 --> 00:13:15.170 align:middle line:84%
if there's proof
of concepts, see

00:13:15.170 --> 00:13:18.560 align:middle line:84%
if there's Nmap scans that
can enumerate specific lead

00:13:18.560 --> 00:13:20.100 align:middle line:90%
that vulnerability.

00:13:20.100 --> 00:13:21.248 align:middle line:90%
And that's crucial.

00:13:21.248 --> 00:13:23.540 align:middle line:84%
We're going to see that again
in the next vulnerability

00:13:23.540 --> 00:13:25.580 align:middle line:90%
with EternalBlue.

00:13:25.580 --> 00:13:29.010 align:middle line:90%


00:13:29.010 --> 00:13:33.240 align:middle line:84%
EternalBlue is a very
well known vulnerability

00:13:33.240 --> 00:13:37.230 align:middle line:84%
because it was part of a
WannaCry ransomware attack,

00:13:37.230 --> 00:13:41.400 align:middle line:84%
and it affected hospitals,
organizations, governments all

00:13:41.400 --> 00:13:47.640 align:middle line:84%
across the world for quite
a time period in 2017.

00:13:47.640 --> 00:13:49.380 align:middle line:90%
The basis of it--

00:13:49.380 --> 00:13:51.930 align:middle line:84%
there was a zero-day
exploit that

00:13:51.930 --> 00:13:56.130 align:middle line:84%
took advantage of SMB and SMB
version 1 and a buffer overflow

00:13:56.130 --> 00:13:56.970 align:middle line:90%
situation.

00:13:56.970 --> 00:13:59.480 align:middle line:90%


00:13:59.480 --> 00:14:02.630 align:middle line:84%
It was alleged that the United
States National Security

00:14:02.630 --> 00:14:04.850 align:middle line:84%
Agency had known about
this vulnerability,

00:14:04.850 --> 00:14:09.470 align:middle line:84%
had created an exploit
for it, and when

00:14:09.470 --> 00:14:12.440 align:middle line:84%
there was insider
threat and release

00:14:12.440 --> 00:14:15.290 align:middle line:84%
of confidential
information, their toolkit

00:14:15.290 --> 00:14:19.880 align:middle line:84%
including EternalBlue was
released and then exploited

00:14:19.880 --> 00:14:25.880 align:middle line:84%
by APTs as part of the
WannaCry ransomware.

00:14:25.880 --> 00:14:28.370 align:middle line:84%
And that affected
so much of the world

00:14:28.370 --> 00:14:32.060 align:middle line:84%
and seemed almost
impossible to stop.

00:14:32.060 --> 00:14:35.600 align:middle line:84%
Fortunately, a young
researcher, Marcus Hutchins,

00:14:35.600 --> 00:14:39.230 align:middle line:84%
found out what was the
kill code, essentially,

00:14:39.230 --> 00:14:43.520 align:middle line:90%
for the WannaCry virus.

00:14:43.520 --> 00:14:47.870 align:middle line:84%
Because of the way that
this vulnerability acts,

00:14:47.870 --> 00:14:51.290 align:middle line:84%
it can easily spread
throughout a whole ecosystem,

00:14:51.290 --> 00:14:55.010 align:middle line:84%
especially since if one
machine is vulnerable,

00:14:55.010 --> 00:14:56.720 align:middle line:84%
other machines might
also be vulnerable.

00:14:56.720 --> 00:14:57.540 align:middle line:90%
Why?

00:14:57.540 --> 00:14:59.390 align:middle line:84%
Why might they
also be vulnerable?

00:14:59.390 --> 00:15:01.790 align:middle line:90%
Let's jump in.

00:15:01.790 --> 00:15:06.560 align:middle line:90%
So CVE-2017-0143.

00:15:06.560 --> 00:15:11.960 align:middle line:84%
It's SMB version 1
server and Vista service

00:15:11.960 --> 00:15:17.150 align:middle line:84%
pack two, server 2018 service
pack two and service pack one.

00:15:17.150 --> 00:15:20.810 align:middle line:84%
Windows 7 service pack one,
Windows 8.1, Windows Server

00:15:20.810 --> 00:15:22.160 align:middle line:90%
2012.

00:15:22.160 --> 00:15:25.760 align:middle line:84%
Almost all operating
systems being

00:15:25.760 --> 00:15:29.390 align:middle line:84%
used at the time
that weren't patched,

00:15:29.390 --> 00:15:35.540 align:middle line:84%
and Microsoft didn't know until
it got released because the US

00:15:35.540 --> 00:15:38.220 align:middle line:90%
government didn't tell them.

00:15:38.220 --> 00:15:39.650 align:middle line:84%
So it had to be
found in the wild

00:15:39.650 --> 00:15:46.430 align:middle line:84%
as part of that leaked
toolkit from the NSA,

00:15:46.430 --> 00:15:50.150 align:middle line:84%
and people just didn't
update their service packs.

00:15:50.150 --> 00:15:52.490 align:middle line:84%
It wasn't too hard to
switch from Windows 7

00:15:52.490 --> 00:15:55.460 align:middle line:84%
service pack one to Windows
7 service pack two, which

00:15:55.460 --> 00:16:00.166 align:middle line:84%
mitigated this SMB version 1,
but it's quite a vulnerability.

00:16:00.166 --> 00:16:03.740 align:middle line:90%


00:16:03.740 --> 00:16:06.020 align:middle line:84%
Microsoft Corporation
was the assigning CNA.

00:16:06.020 --> 00:16:13.430 align:middle line:84%
Once they were informed of it,
they shared the vulnerability

00:16:13.430 --> 00:16:15.530 align:middle line:84%
with the community,
and you can see

00:16:15.530 --> 00:16:18.120 align:middle line:84%
some more white paper, some
exploits, and proof of concepts

00:16:18.120 --> 00:16:18.620 align:middle line:90%
to.

00:16:18.620 --> 00:16:21.380 align:middle line:90%
Take advantage of it.

00:16:21.380 --> 00:16:25.580 align:middle line:84%
On the National Vulnerability
Database, same information

00:16:25.580 --> 00:16:30.315 align:middle line:90%
we see and fairly high score.

00:16:30.315 --> 00:16:32.990 align:middle line:90%


00:16:32.990 --> 00:16:37.340 align:middle line:84%
Now there's solutions,
tools, proof of concepts,

00:16:37.340 --> 00:16:41.150 align:middle line:84%
and the weakness enumeration
improper input validation

00:16:41.150 --> 00:16:44.090 align:middle line:84%
for SMB version 1, and
then affected software

00:16:44.090 --> 00:16:44.870 align:middle line:90%
configurations.

00:16:44.870 --> 00:16:48.380 align:middle line:84%
And there are versions of
Windows 10, Windows 7, Windows

00:16:48.380 --> 00:16:50.000 align:middle line:90%
8 servers.

00:16:50.000 --> 00:16:54.140 align:middle line:84%
This was part of Windows
implementation, Microsoft's

00:16:54.140 --> 00:16:56.510 align:middle line:90%
implementation of SMB.

00:16:56.510 --> 00:17:03.290 align:middle line:84%
Now, you could say it
was the operating system.

00:17:03.290 --> 00:17:08.119 align:middle line:84%
It was a service that was built
and baked in the operating

00:17:08.119 --> 00:17:11.480 align:middle line:84%
system and required a service
pack, a patch, or an update

00:17:11.480 --> 00:17:14.510 align:middle line:90%
to the OS itself.

00:17:14.510 --> 00:17:19.702 align:middle line:84%
It wasn't patched software
that may or may not be running.

00:17:19.702 --> 00:17:21.619 align:middle line:84%
If the operating system
itself wasn't patched,

00:17:21.619 --> 00:17:23.540 align:middle line:90%
then it was vulnerable.

00:17:23.540 --> 00:17:30.770 align:middle line:84%
And it's such a
ubiquitous vulnerability

00:17:30.770 --> 00:17:34.850 align:middle line:84%
that it had far-ranging
consequences.

00:17:34.850 --> 00:17:39.350 align:middle line:84%
There is a specific
Nmap scan for the script

00:17:39.350 --> 00:17:42.996 align:middle line:90%
to look for, ms17-010.

00:17:42.996 --> 00:17:49.400 align:middle line:84%
The ms17-010 comes from
Microsoft's internal bug

00:17:49.400 --> 00:17:54.020 align:middle line:84%
numbering system, and
it's how a lot of exploits

00:17:54.020 --> 00:17:55.510 align:middle line:90%
are talked about.

00:17:55.510 --> 00:17:59.942 align:middle line:90%
ms08-067 is another older one.

00:17:59.942 --> 00:18:01.400 align:middle line:84%
You might see it
in some courseware

00:18:01.400 --> 00:18:06.350 align:middle line:84%
because the net API also
relies on SMB, essentially,

00:18:06.350 --> 00:18:10.370 align:middle line:84%
that same protocol
suite, if you will.

00:18:10.370 --> 00:18:15.530 align:middle line:84%
And a very similar
problem, very similar

00:18:15.530 --> 00:18:20.910 align:middle line:84%
exploit, very similar
vulnerability, and very far

00:18:20.910 --> 00:18:21.410 align:middle line:90%
reaching.

00:18:21.410 --> 00:18:26.810 align:middle line:84%
Again, part of the
operating system,

00:18:26.810 --> 00:18:29.090 align:middle line:84%
but also if you
want to explain how

00:18:29.090 --> 00:18:32.077 align:middle line:84%
these vulnerabilities
work, 60% of the time,

00:18:32.077 --> 00:18:32.910 align:middle line:90%
it works every time.

00:18:32.910 --> 00:18:34.368 align:middle line:84%
So if you create
a lab and you want

00:18:34.368 --> 00:18:37.460 align:middle line:84%
it to work for your
students every time,

00:18:37.460 --> 00:18:42.950 align:middle line:84%
ms08-067 ms17-010 are really
high up there for entry level.

00:18:42.950 --> 00:18:43.550 align:middle line:90%
Hey.

00:18:43.550 --> 00:18:44.700 align:middle line:84%
I just want to
show you something,

00:18:44.700 --> 00:18:45.658 align:middle line:90%
and it's going to work.

00:18:45.658 --> 00:18:49.260 align:middle line:90%


00:18:49.260 --> 00:18:51.530 align:middle line:84%
What this one looks like--
it will test and see

00:18:51.530 --> 00:18:53.000 align:middle line:90%
if it's vulnerable.

00:18:53.000 --> 00:18:55.970 align:middle line:84%
It'll test that SMB connection,
see if it gets back,

00:18:55.970 --> 00:18:59.000 align:middle line:84%
what it expects to get
back if it was vulnerable,

00:18:59.000 --> 00:19:07.960 align:middle line:84%
and it will tell you that it's
vulnerable in CVE-2017-0143.

00:19:07.960 --> 00:19:10.150 align:middle line:84%
Again, looking at
exploit database--

00:19:10.150 --> 00:19:13.310 align:middle line:90%
in this case for ms17-010--

00:19:13.310 --> 00:19:15.430 align:middle line:90%
there's some proof of concepts.

00:19:15.430 --> 00:19:17.590 align:middle line:90%
There's some pretty good ones.

00:19:17.590 --> 00:19:20.050 align:middle line:84%
There's some Metasploit
code in here.

00:19:20.050 --> 00:19:22.630 align:middle line:90%


00:19:22.630 --> 00:19:24.130 align:middle line:84%
This one right here
says Metasploit.

00:19:24.130 --> 00:19:25.030 align:middle line:90%
Let's take a look.

00:19:25.030 --> 00:19:26.560 align:middle line:90%
It's the execution scanner.

00:19:26.560 --> 00:19:28.730 align:middle line:90%
It's an auxiliary module.

00:19:28.730 --> 00:19:29.230 align:middle line:90%
Sorry.

00:19:29.230 --> 00:19:30.430 align:middle line:90%
This is Ruby.

00:19:30.430 --> 00:19:34.450 align:middle line:84%
You're not expected to know how
to read Ruby, but a lot of it's

00:19:34.450 --> 00:19:35.530 align:middle line:90%
just plain English.

00:19:35.530 --> 00:19:37.870 align:middle line:84%
And if you've worked
with Metasploit at all,

00:19:37.870 --> 00:19:39.880 align:middle line:84%
there's a whole course
that [? Alexei ?]

00:19:39.880 --> 00:19:42.940 align:middle line:84%
has made that goes
into how Metasploit,

00:19:42.940 --> 00:19:48.220 align:middle line:84%
the framework, and the
modules all work together.

00:19:48.220 --> 00:19:50.950 align:middle line:84%
The basis for Metasploit
framework is Ruby,

00:19:50.950 --> 00:19:54.940 align:middle line:84%
and so you should
read through this code

00:19:54.940 --> 00:19:57.640 align:middle line:84%
and see things that make a lot
of sense-- name, description,

00:19:57.640 --> 00:19:58.660 align:middle line:90%
all the references.

00:19:58.660 --> 00:20:02.030 align:middle line:84%
If you were to run
info on a module,

00:20:02.030 --> 00:20:03.190 align:middle line:90%
you're going to get this.

00:20:03.190 --> 00:20:05.710 align:middle line:84%
It's going to pull
it out of the Ruby

00:20:05.710 --> 00:20:08.245 align:middle line:90%
and present it in the console.

00:20:08.245 --> 00:20:10.960 align:middle line:90%


00:20:10.960 --> 00:20:12.580 align:middle line:84%
But looking through
this code, we

00:20:12.580 --> 00:20:14.560 align:middle line:84%
can see what works,
what doesn't work.

00:20:14.560 --> 00:20:18.670 align:middle line:84%
And if for some odd reason,
maybe during a pen test

00:20:18.670 --> 00:20:21.620 align:middle line:84%
they don't want you to use
Metasploit for some odd reason.

00:20:21.620 --> 00:20:25.750 align:middle line:84%
You could see what is going
on in the exploit module

00:20:25.750 --> 00:20:28.810 align:middle line:84%
or in the auxiliary
module-- this is a scanner--

00:20:28.810 --> 00:20:32.080 align:middle line:84%
and then perhaps
recreate that in Python

00:20:32.080 --> 00:20:37.060 align:middle line:84%
or another language
that's rather advanced.

00:20:37.060 --> 00:20:40.210 align:middle line:84%
That's not going to be a
requirement any time soon

00:20:40.210 --> 00:20:43.720 align:middle line:90%
in this courseware.

00:20:43.720 --> 00:20:50.090 align:middle line:84%
Just wanted to give you an
example of similar code.

00:20:50.090 --> 00:20:50.590 align:middle line:90%
All right.

00:20:50.590 --> 00:20:58.980 align:middle line:90%


00:20:58.980 --> 00:21:03.990 align:middle line:84%
Now, again, going to spell this
out exactly how EternalBlue

00:21:03.990 --> 00:21:06.180 align:middle line:90%
works.

00:21:06.180 --> 00:21:07.335 align:middle line:90%
It's scary simple.

00:21:07.335 --> 00:21:13.440 align:middle line:90%


00:21:13.440 --> 00:21:17.070 align:middle line:84%
So you scan your victim,
and if it is Windows

00:21:17.070 --> 00:21:20.490 align:middle line:84%
7 service pack one,
if it's running

00:21:20.490 --> 00:21:26.190 align:middle line:90%
SMB, if it is server 2012--

00:21:26.190 --> 00:21:28.600 align:middle line:84%
any of those vulnerable
operating systems--

00:21:28.600 --> 00:21:33.870 align:middle line:84%
then it's worthwhile to run
that ms17-010 script from Nmap.

00:21:33.870 --> 00:21:36.591 align:middle line:90%


00:21:36.591 --> 00:21:41.250 align:middle line:84%
You might want to check to
make sure it's a safe script

00:21:41.250 --> 00:21:45.180 align:middle line:84%
because the exploit
EternalBlue can shut down SMB.

00:21:45.180 --> 00:21:48.270 align:middle line:84%
And depending on
what that system

00:21:48.270 --> 00:21:51.720 align:middle line:84%
is used for in the
network, shutting down SMB

00:21:51.720 --> 00:21:53.490 align:middle line:90%
could be very bad.

00:21:53.490 --> 00:21:55.710 align:middle line:84%
There's implications
there, so understanding

00:21:55.710 --> 00:21:58.650 align:middle line:84%
what those implications when you
are exploiting a vulnerability

00:21:58.650 --> 00:22:02.040 align:middle line:90%
is really huge as a pen tester.

00:22:02.040 --> 00:22:05.400 align:middle line:84%
But we find out that
it is SMB version 1

00:22:05.400 --> 00:22:07.530 align:middle line:84%
and it is vulnerable
to EternalBlue.

00:22:07.530 --> 00:22:10.350 align:middle line:90%
So then what do we send?

00:22:10.350 --> 00:22:13.980 align:middle line:84%
If you use the Metasploit
exploits for it,

00:22:13.980 --> 00:22:17.670 align:middle line:84%
it's going to send an SMB
packet with a malicious payload.

00:22:17.670 --> 00:22:22.290 align:middle line:84%
What it does is it takes
advantage of a buffer overflow

00:22:22.290 --> 00:22:26.130 align:middle line:84%
inside of the SMB
version, and then it

00:22:26.130 --> 00:22:30.090 align:middle line:90%
can allow remote code execution.

00:22:30.090 --> 00:22:33.720 align:middle line:84%
In that payload, there's
going to be probably,

00:22:33.720 --> 00:22:35.092 align:middle line:90%
most likely, a reverse shell.

00:22:35.092 --> 00:22:37.050 align:middle line:84%
That's what you're going
to put in your payload

00:22:37.050 --> 00:22:38.670 align:middle line:90%
more often than not.

00:22:38.670 --> 00:22:44.970 align:middle line:84%
What that will do is tell the
server tell your victim machine

00:22:44.970 --> 00:22:47.820 align:middle line:84%
to call back to you
and give you a shell,

00:22:47.820 --> 00:22:53.850 align:middle line:84%
give you command line
interaction with that system.

00:22:53.850 --> 00:22:57.910 align:middle line:84%
And that's really
straightforward.

00:22:57.910 --> 00:22:59.280 align:middle line:90%
It's very, very dangerous.

00:22:59.280 --> 00:23:05.880 align:middle line:84%
Now, you don't necessarily
need full command line access.

00:23:05.880 --> 00:23:07.630 align:middle line:90%
You can run any sort of code.

00:23:07.630 --> 00:23:12.060 align:middle line:84%
So if you have a virus, a worm
that installs itself, installs

00:23:12.060 --> 00:23:13.980 align:middle line:84%
ransomware, encrypts
the whole system,

00:23:13.980 --> 00:23:15.810 align:middle line:84%
and puts up a
splash page of this

00:23:15.810 --> 00:23:25.590 align:middle line:84%
is now encrypted for ransom, and
then also finds other systems

00:23:25.590 --> 00:23:28.320 align:middle line:84%
on the network that
also are vulnerable,

00:23:28.320 --> 00:23:30.150 align:middle line:84%
and then sends the
exploit to them.

00:23:30.150 --> 00:23:35.190 align:middle line:84%
That's not very
difficult code to write,

00:23:35.190 --> 00:23:37.800 align:middle line:84%
and it will just propagate
and keep doing the same thing

00:23:37.800 --> 00:23:39.330 align:middle line:90%
over and over and over again.

00:23:39.330 --> 00:23:44.340 align:middle line:84%
That's what happened, and
that's why it was so bad because

00:23:44.340 --> 00:23:46.605 align:middle line:90%
if one system on a network--

00:23:46.605 --> 00:23:47.730 align:middle line:90%
and it was a flat network--

00:23:47.730 --> 00:23:53.010 align:middle line:84%
got hit, if there weren't
the right things to place,

00:23:53.010 --> 00:23:55.240 align:middle line:84%
it spread across whole
hospitals and spread

00:23:55.240 --> 00:24:01.380 align:middle line:84%
across whole communities and
quite a bad vulnerability.

00:24:01.380 --> 00:24:06.180 align:middle line:84%
One that we still want to check
for if you see old operating

00:24:06.180 --> 00:24:07.440 align:middle line:90%
systems.

00:24:07.440 --> 00:24:10.710 align:middle line:84%
Old operating system exists
in operational technology

00:24:10.710 --> 00:24:13.980 align:middle line:84%
in your ICS or
SCADA environments,

00:24:13.980 --> 00:24:18.330 align:middle line:84%
often because they've
worked and perhaps

00:24:18.330 --> 00:24:23.010 align:middle line:84%
the software to run a system
hasn't needed to update.

00:24:23.010 --> 00:24:24.570 align:middle line:90%
It works.

00:24:24.570 --> 00:24:28.060 align:middle line:84%
It pumps the oil
out of the ground,

00:24:28.060 --> 00:24:31.080 align:middle line:84%
and so it does that
day in and day out.

00:24:31.080 --> 00:24:34.470 align:middle line:84%
We don't need Windows 10 running
the software that does it.

00:24:34.470 --> 00:24:39.870 align:middle line:84%
It worked perfectly fine on
Windows XP, and that's fine,

00:24:39.870 --> 00:24:45.960 align:middle line:84%
but there needs to then be
some segmentation and a lot

00:24:45.960 --> 00:24:48.000 align:middle line:84%
of mitigation in there
to keep something

00:24:48.000 --> 00:24:52.590 align:middle line:84%
that you know is very
vulnerable on your network

00:24:52.590 --> 00:24:58.740 align:middle line:84%
because operational technology
and information technology

00:24:58.740 --> 00:24:59.280 align:middle line:90%
do touch.

00:24:59.280 --> 00:25:02.680 align:middle line:84%
They touch quite often,
and it's often overlooked,

00:25:02.680 --> 00:25:05.490 align:middle line:84%
so that's something that
we don't want to forget.

00:25:05.490 --> 00:25:08.340 align:middle line:90%


00:25:08.340 --> 00:25:09.780 align:middle line:90%
Now Log4J.

00:25:09.780 --> 00:25:13.650 align:middle line:84%
It's a library that's
used for logging in Java,

00:25:13.650 --> 00:25:16.860 align:middle line:84%
and let's take a
look at the CVE page

00:25:16.860 --> 00:25:22.365 align:middle line:84%
to kind of understand the
jargony way of explaining it.

00:25:22.365 --> 00:25:28.560 align:middle line:84%
It says Apache Log4J 2.0-beta 9
through other versions of JNDI

00:25:28.560 --> 00:25:32.130 align:middle line:84%
features used in configuration
log messages and parameters do

00:25:32.130 --> 00:25:35.400 align:middle line:84%
not protect against controlled
LDAP and other JNDI-related

00:25:35.400 --> 00:25:36.390 align:middle line:90%
endpoints.

00:25:36.390 --> 00:25:38.490 align:middle line:84%
I will break down
what all that means.

00:25:38.490 --> 00:25:42.510 align:middle line:84%
It is very confusing, but
essentially an attacker

00:25:42.510 --> 00:25:45.870 align:middle line:84%
who can control log messages
or log message parameters

00:25:45.870 --> 00:25:49.890 align:middle line:84%
can execute arbitrary code
loaded on LDAP servers

00:25:49.890 --> 00:25:52.380 align:middle line:84%
when message lookup
substitution is enabled.

00:25:52.380 --> 00:25:58.380 align:middle line:90%


00:25:58.380 --> 00:26:00.360 align:middle line:84%
I'll break that
down a little bit.

00:26:00.360 --> 00:26:04.560 align:middle line:84%
There's references to
white papers, explanations.

00:26:04.560 --> 00:26:08.320 align:middle line:84%
This is quite a big
reason of vulnerability.

00:26:08.320 --> 00:26:10.590 align:middle line:84%
So much of the world,
so much of gaming,

00:26:10.590 --> 00:26:19.050 align:middle line:84%
so many web apps run off of
Java that far-reaching impacts

00:26:19.050 --> 00:26:20.010 align:middle line:90%
or possible impacts.

00:26:20.010 --> 00:26:24.450 align:middle line:90%


00:26:24.450 --> 00:26:27.300 align:middle line:84%
We've already looked at this
National Vulnerability database

00:26:27.300 --> 00:26:30.360 align:middle line:90%
page in the past lesson.

00:26:30.360 --> 00:26:33.730 align:middle line:84%
There's a lot of information, a
lot of affected configurations,

00:26:33.730 --> 00:26:39.630 align:middle line:84%
and a very high criticality
at this point just because

00:26:39.630 --> 00:26:44.370 align:middle line:84%
without authenticating
only having access.

00:26:44.370 --> 00:26:47.790 align:middle line:84%
If the old version of
Log4J is being implemented,

00:26:47.790 --> 00:26:49.980 align:middle line:84%
all you have to do is
run a very simple command

00:26:49.980 --> 00:26:53.820 align:middle line:84%
and set up an LDAP server,
which isn't that hard,

00:26:53.820 --> 00:26:57.840 align:middle line:84%
and you could put malicious
code onto the server.

00:26:57.840 --> 00:27:02.190 align:middle line:84%
And depending on how the
Java service is being run,

00:27:02.190 --> 00:27:05.343 align:middle line:84%
you might have very
high privileges

00:27:05.343 --> 00:27:06.510 align:middle line:90%
when you exploit the system.

00:27:06.510 --> 00:27:10.170 align:middle line:90%


00:27:10.170 --> 00:27:15.210 align:middle line:84%
And there's not too many
ways to protect against it.

00:27:15.210 --> 00:27:19.830 align:middle line:84%
Since it is so new,
the Nmap script for it

00:27:19.830 --> 00:27:24.363 align:middle line:90%
is still being developed.

00:27:24.363 --> 00:27:26.280 align:middle line:84%
Many developers will
come up with these things

00:27:26.280 --> 00:27:30.390 align:middle line:84%
and then suggest them
or propose them to Nmap

00:27:30.390 --> 00:27:33.870 align:middle line:84%
in most cases or
Metasploit, often

00:27:33.870 --> 00:27:36.870 align:middle line:84%
put them up on Exploit DB,
which we'll take a look at,

00:27:36.870 --> 00:27:38.820 align:middle line:84%
though there isn't
much out there yet.

00:27:38.820 --> 00:27:42.120 align:middle line:90%


00:27:42.120 --> 00:27:43.950 align:middle line:84%
You've got to be wary
about using scripts

00:27:43.950 --> 00:27:45.810 align:middle line:90%
that you don't understand.

00:27:45.810 --> 00:27:47.940 align:middle line:84%
You could read through
some of this code

00:27:47.940 --> 00:27:49.200 align:middle line:90%
if it makes sense to you.

00:27:49.200 --> 00:27:53.170 align:middle line:84%
The NSE scripts are
fairly straightforward.

00:27:53.170 --> 00:27:57.850 align:middle line:84%
It's not that difficult
to understand.

00:27:57.850 --> 00:27:58.890 align:middle line:90%
Difficult to write.

00:27:58.890 --> 00:28:01.265 align:middle line:84%
Just like any programming
language, I can read through it

00:28:01.265 --> 00:28:02.940 align:middle line:84%
and know what a
lot of it is saying

00:28:02.940 --> 00:28:08.730 align:middle line:84%
if they made good variables
and explain, have good outputs.

00:28:08.730 --> 00:28:11.610 align:middle line:84%
Writing it, that's
another lesson

00:28:11.610 --> 00:28:16.360 align:middle line:84%
for another course, another
pathway, but in this situation

00:28:16.360 --> 00:28:18.690 align:middle line:90%
you can see the usage.

00:28:18.690 --> 00:28:21.120 align:middle line:84%
What it would return
in this situation--

00:28:21.120 --> 00:28:27.660 align:middle line:84%
it's doing the Log4J Log4Shell
dot NSC script, some arguments,

00:28:27.660 --> 00:28:29.100 align:middle line:90%
call back to a server--

00:28:29.100 --> 00:28:34.080 align:middle line:84%
a remote LDAP server
in this situation--

00:28:34.080 --> 00:28:34.790 align:middle line:90%
on that port.

00:28:34.790 --> 00:28:37.648 align:middle line:90%


00:28:37.648 --> 00:28:38.565 align:middle line:90%
So it's going to test.

00:28:38.565 --> 00:28:45.780 align:middle line:84%
It has this payload, this dollar
sign, curly brackets JNDI colon

00:28:45.780 --> 00:28:53.760 align:middle line:84%
LDAP colon, an IP address,
a port, and then a file.

00:28:53.760 --> 00:28:59.820 align:middle line:84%
In this situation, we had an
HTTP proxy service running

00:28:59.820 --> 00:29:04.980 align:middle line:84%
on port 8080, and it's going to
send some get requests and see

00:29:04.980 --> 00:29:06.030 align:middle line:90%
what it returns.

00:29:06.030 --> 00:29:08.550 align:middle line:90%


00:29:08.550 --> 00:29:10.540 align:middle line:84%
And you would have
to take a look back

00:29:10.540 --> 00:29:13.830 align:middle line:84%
at the callback server to see
if it was actually vulnerable,

00:29:13.830 --> 00:29:16.110 align:middle line:84%
but that's what it's
going to attempt to run.

00:29:16.110 --> 00:29:26.740 align:middle line:90%


00:29:26.740 --> 00:29:30.040 align:middle line:84%
Let's try to make sense
of this vulnerability

00:29:30.040 --> 00:29:35.410 align:middle line:84%
because if you don't know
Java, like me a week ago,

00:29:35.410 --> 00:29:39.900 align:middle line:84%
it could possibly
be very confusing.

00:29:39.900 --> 00:29:44.470 align:middle line:84%
84% of Java applications
use Log4J for logging.

00:29:44.470 --> 00:29:46.750 align:middle line:90%
You would log your application.

00:29:46.750 --> 00:29:48.040 align:middle line:90%
It could be messages.

00:29:48.040 --> 00:29:49.180 align:middle line:90%
It could be bugs.

00:29:49.180 --> 00:29:52.270 align:middle line:84%
It could be commands
that are input,

00:29:52.270 --> 00:29:54.670 align:middle line:84%
wanting to store those
for debugging later

00:29:54.670 --> 00:29:56.560 align:middle line:90%
if there is an issue.

00:29:56.560 --> 00:29:59.260 align:middle line:84%
If it's a web app, you might
want to gather information

00:29:59.260 --> 00:30:01.960 align:middle line:90%
to see usage data.

00:30:01.960 --> 00:30:04.300 align:middle line:84%
There's many, many
reasons to log.

00:30:04.300 --> 00:30:06.820 align:middle line:84%
It's a crucial thing
for developers,

00:30:06.820 --> 00:30:10.690 align:middle line:84%
and Log4J is the
library that you

00:30:10.690 --> 00:30:17.650 align:middle line:84%
utilize for doing that with
Java, and that's very common.

00:30:17.650 --> 00:30:20.990 align:middle line:90%


00:30:20.990 --> 00:30:23.840 align:middle line:84%
On the slide here,
we run our Nmap scan

00:30:23.840 --> 00:30:28.910 align:middle line:84%
and we get a door
service enumeration.

00:30:28.910 --> 00:30:32.510 align:middle line:90%
What you return back varies.

00:30:32.510 --> 00:30:33.830 align:middle line:90%
It varies so much.

00:30:33.830 --> 00:30:36.320 align:middle line:84%
There's so much software
that's utilizing Java

00:30:36.320 --> 00:30:38.690 align:middle line:84%
that there's no way of
honing down and saying

00:30:38.690 --> 00:30:43.070 align:middle line:84%
it is SMB version 1, it is
these operating systems.

00:30:43.070 --> 00:30:45.800 align:middle line:84%
Some things to look for
are vulnerable web apps.

00:30:45.800 --> 00:30:49.880 align:middle line:90%
It's Apache, so Apache Tomcat.

00:30:49.880 --> 00:30:52.370 align:middle line:84%
Web apps run frequently
on Apache Tomcat.

00:30:52.370 --> 00:30:54.470 align:middle line:84%
You would see that
in the service scan.

00:30:54.470 --> 00:30:56.810 align:middle line:90%
It would say Apache Tomcat.

00:30:56.810 --> 00:30:59.780 align:middle line:84%
There's also Jetty, Apache
TomEE, or GlassFish.

00:30:59.780 --> 00:31:04.775 align:middle line:84%
These are other services
used for web app serving.

00:31:04.775 --> 00:31:09.170 align:middle line:90%


00:31:09.170 --> 00:31:11.480 align:middle line:84%
The web app could
also utilize Java

00:31:11.480 --> 00:31:16.310 align:middle line:84%
and be configured on
standard PHP website that's

00:31:16.310 --> 00:31:20.535 align:middle line:90%
served up via Apache or Nginx.

00:31:20.535 --> 00:31:21.035 align:middle line:90%
Nginx.

00:31:21.035 --> 00:31:26.210 align:middle line:90%


00:31:26.210 --> 00:31:31.790 align:middle line:84%
So you find a vulnerable web
app or a vulnerable desktop

00:31:31.790 --> 00:31:34.370 align:middle line:90%
application, truthfully.

00:31:34.370 --> 00:31:38.390 align:middle line:84%
There's a lot of games
that run on Java.

00:31:38.390 --> 00:31:42.410 align:middle line:84%
There's a lot of desktop apps,
just normal everyday apps

00:31:42.410 --> 00:31:46.460 align:middle line:84%
that users use that
are created with Java,

00:31:46.460 --> 00:31:47.750 align:middle line:90%
and they have logging.

00:31:47.750 --> 00:31:51.200 align:middle line:84%
And depending on
how the system is

00:31:51.200 --> 00:31:57.620 align:middle line:84%
used, that logging
and usage of Log4J

00:31:57.620 --> 00:32:00.110 align:middle line:84%
could make the end
server where those logs

00:32:00.110 --> 00:32:01.880 align:middle line:90%
are being kept vulnerable.

00:32:01.880 --> 00:32:07.130 align:middle line:84%
It could make the machine
being used vulnerable

00:32:07.130 --> 00:32:10.585 align:middle line:84%
a little bit-- if
it is a desktop app,

00:32:10.585 --> 00:32:12.710 align:middle line:84%
then you would already have
to exploit that machine

00:32:12.710 --> 00:32:17.630 align:middle line:84%
to take advantage
of the Log4J exploit

00:32:17.630 --> 00:32:20.670 align:middle line:90%
and then exploit that system.

00:32:20.670 --> 00:32:22.800 align:middle line:84%
So that's something
to take into account,

00:32:22.800 --> 00:32:24.590 align:middle line:90%
but we find an input field.

00:32:24.590 --> 00:32:26.570 align:middle line:90%
This is how it works.

00:32:26.570 --> 00:32:30.710 align:middle line:84%
Java and Log4J takes
information from an input field.

00:32:30.710 --> 00:32:31.620 align:middle line:90%
It can be a name.

00:32:31.620 --> 00:32:35.300 align:middle line:90%
It could be username, password.

00:32:35.300 --> 00:32:37.400 align:middle line:84%
It can be information
that you send.

00:32:37.400 --> 00:32:42.410 align:middle line:84%
For Minecraft, it
was server chat.

00:32:42.410 --> 00:32:44.570 align:middle line:84%
Someone stands up
a Minecraft server,

00:32:44.570 --> 00:32:46.280 align:middle line:84%
and there's the
chat functionality.

00:32:46.280 --> 00:32:51.500 align:middle line:84%
What was sent in chat gets
logged onto the server hosting

00:32:51.500 --> 00:32:52.400 align:middle line:90%
the Minecraft server.

00:32:52.400 --> 00:32:55.140 align:middle line:90%


00:32:55.140 --> 00:32:59.210 align:middle line:84%
Now, this command
gets sent, and rather

00:32:59.210 --> 00:33:05.270 align:middle line:84%
than the server parsing it
as text and just logging it,

00:33:05.270 --> 00:33:07.290 align:middle line:90%
it actually evaluates the code.

00:33:07.290 --> 00:33:12.920 align:middle line:84%
And because of how this is
crafted, it's injection,

00:33:12.920 --> 00:33:14.570 align:middle line:90%
it's going to get evaluated.

00:33:14.570 --> 00:33:18.110 align:middle line:84%
Now, a dollar sign make
something a variable, and then

00:33:18.110 --> 00:33:20.180 align:middle line:84%
this dollar sign,
squiggly line, and then

00:33:20.180 --> 00:33:25.790 align:middle line:84%
JNDI, JNDI being the Java
Naming and Directory Interface.

00:33:25.790 --> 00:33:31.100 align:middle line:84%
It's going to then
reach out for more code.

00:33:31.100 --> 00:33:33.560 align:middle line:84%
This is useful for
Java developers

00:33:33.560 --> 00:33:36.200 align:middle line:84%
because you often want
to make your web app

00:33:36.200 --> 00:33:38.640 align:middle line:84%
or your desktop app
as small as possible.

00:33:38.640 --> 00:33:42.860 align:middle line:84%
Now, if you can keep code
elsewhere and then reference it

00:33:42.860 --> 00:33:48.320 align:middle line:84%
only if it's really needed,
it keeps your software

00:33:48.320 --> 00:33:52.070 align:middle line:84%
small, agile, and
less processor,

00:33:52.070 --> 00:33:55.550 align:middle line:84%
less things that need to
be loaded into memory,

00:33:55.550 --> 00:34:00.380 align:middle line:84%
less file storage space
for storing your program

00:34:00.380 --> 00:34:03.110 align:middle line:84%
because it's going to
utilize a server if it

00:34:03.110 --> 00:34:04.880 align:middle line:90%
needs additional functionality.

00:34:04.880 --> 00:34:07.940 align:middle line:90%
That's what JNDI and LDAP--

00:34:07.940 --> 00:34:14.420 align:middle line:84%
LDAP being the Lightweight
Directory Application Protocol.

00:34:14.420 --> 00:34:17.510 align:middle line:84%
That's the protocol
used for interacting

00:34:17.510 --> 00:34:19.738 align:middle line:90%
with a remote database.

00:34:19.738 --> 00:34:22.280 align:middle line:84%
In this situation, it's going
to tell it, hey, reach out to--

00:34:22.280 --> 00:34:25.280 align:middle line:90%


00:34:25.280 --> 00:34:29.510 align:middle line:84%
oh, this should have been like
malicious dot INE on port 1389.

00:34:29.510 --> 00:34:31.264 align:middle line:84%
That's going to be
our LDAP server.

00:34:31.264 --> 00:34:34.860 align:middle line:90%


00:34:34.860 --> 00:34:35.889 align:middle line:90%
It sees that variable.

00:34:35.889 --> 00:34:41.170 align:middle line:84%
It does the lookup that
says, hey, go look elsewhere.

00:34:41.170 --> 00:34:43.330 align:middle line:84%
So we've got demo
dot INE down there,

00:34:43.330 --> 00:34:48.360 align:middle line:84%
and it is an LDAP server
that's served up on port 1389.

00:34:48.360 --> 00:34:50.400 align:middle line:84%
Now when they
connect, they're going

00:34:50.400 --> 00:34:52.560 align:middle line:84%
to look for a file
called "mycode,"

00:34:52.560 --> 00:34:54.960 align:middle line:84%
and that's going to
have a Java class in it.

00:34:54.960 --> 00:35:01.380 align:middle line:84%
Java class is just Java code
that is in another file.

00:35:01.380 --> 00:35:04.450 align:middle line:84%
When it gets pulled over,
it's going to get executed.

00:35:04.450 --> 00:35:08.730 align:middle line:84%
So simple string
in an input field

00:35:08.730 --> 00:35:13.950 align:middle line:84%
made the server reach out
and find more Java code.

00:35:13.950 --> 00:35:25.860 align:middle line:90%
A good example of this is here.

00:35:25.860 --> 00:35:27.450 align:middle line:90%
It's Java.

00:35:27.450 --> 00:35:31.475 align:middle line:84%
There's a lot that
doesn't make sense to me.

00:35:31.475 --> 00:35:33.600 align:middle line:84%
I mean, you can try to
figure it out by reading it,

00:35:33.600 --> 00:35:35.860 align:middle line:90%
but I would not write it.

00:35:35.860 --> 00:35:38.865 align:middle line:84%
But if you get down in here,
there's string and a command.

00:35:38.865 --> 00:35:42.280 align:middle line:90%


00:35:42.280 --> 00:35:51.090 align:middle line:84%
This might be small to read, but
it says the command is bin/sh

00:35:51.090 --> 00:35:59.640 align:middle line:84%
[? -c ?] and then echo PWNED
redirected into /tmp/pwned.

00:35:59.640 --> 00:36:04.710 align:middle line:84%
So what this code is
doing-- it's fairly benign,

00:36:04.710 --> 00:36:07.650 align:middle line:84%
but it's going to
run in Bash execute

00:36:07.650 --> 00:36:11.880 align:middle line:84%
code of echo the word
"pwned" and put it

00:36:11.880 --> 00:36:15.570 align:middle line:90%
into a file temp pwned.

00:36:15.570 --> 00:36:19.800 align:middle line:84%
And temp is rolled
writable, so no matter

00:36:19.800 --> 00:36:21.900 align:middle line:84%
what service is
utilizing this, they'll

00:36:21.900 --> 00:36:26.340 align:middle line:84%
be able to write to that file or
create the file and write to it

00:36:26.340 --> 00:36:29.670 align:middle line:90%
if it doesn't already exist.

00:36:29.670 --> 00:36:32.190 align:middle line:90%
So Linux understanding that.

00:36:32.190 --> 00:36:34.350 align:middle line:84%
If that doesn't
make sense to you,

00:36:34.350 --> 00:36:38.160 align:middle line:84%
go back and watch the videos
and do the content on Linux.

00:36:38.160 --> 00:36:42.540 align:middle line:84%
But we don't really need to
understand too terribly much,

00:36:42.540 --> 00:36:47.970 align:middle line:84%
just seeing that this is going
to get pulled into the Java

00:36:47.970 --> 00:36:50.970 align:middle line:90%
application and get executed.

00:36:50.970 --> 00:36:52.200 align:middle line:90%
That's what this class is.

00:36:52.200 --> 00:36:56.280 align:middle line:84%
It's Java code that's
pulled from somewhere else.

00:36:56.280 --> 00:37:00.210 align:middle line:84%
Object-oriented programming
scripting utilizes classes

00:37:00.210 --> 00:37:02.760 align:middle line:90%
and instantiates them.

00:37:02.760 --> 00:37:07.080 align:middle line:84%
We'll get into that in a more
advanced class, I'm sure.

00:37:07.080 --> 00:37:11.700 align:middle line:84%
Actually, that understanding
of object-oriented programming

00:37:11.700 --> 00:37:14.200 align:middle line:84%
should be covered in
the fundamentals course,

00:37:14.200 --> 00:37:15.610 align:middle line:90%
so hopefully that makes sense.

00:37:15.610 --> 00:37:17.340 align:middle line:84%
If it doesn't, go
back and watch that.

00:37:17.340 --> 00:37:24.760 align:middle line:90%


00:37:24.760 --> 00:37:26.640 align:middle line:84%
So it gets executed,
and whatever

00:37:26.640 --> 00:37:31.860 align:middle line:84%
code is there is going
to be run by that server.

00:37:31.860 --> 00:37:33.840 align:middle line:90%
In this situation, it's benign--

00:37:33.840 --> 00:37:38.940 align:middle line:90%
copy something into a file--

00:37:38.940 --> 00:37:41.910 align:middle line:90%
but it could be a remote shell.

00:37:41.910 --> 00:37:44.640 align:middle line:90%
A reverse shell, if you will.

00:37:44.640 --> 00:37:51.390 align:middle line:84%
It could be almost anything,
so it's terribly, terribly

00:37:51.390 --> 00:37:54.810 align:middle line:84%
dangerous potentially to
run code on another system

00:37:54.810 --> 00:38:00.600 align:middle line:84%
unauthorized just from
inputting one simple command

00:38:00.600 --> 00:38:03.000 align:middle line:84%
into an input field and
then having something

00:38:03.000 --> 00:38:04.810 align:middle line:90%
ready on an LDAP server.

00:38:04.810 --> 00:38:07.330 align:middle line:84%
And after creating
some proof of concepts,

00:38:07.330 --> 00:38:11.340 align:middle line:84%
it's not difficult to make
a malicious LDAP server.

00:38:11.340 --> 00:38:16.020 align:middle line:84%
This is very simple exploit
that works really well.

00:38:16.020 --> 00:38:20.910 align:middle line:90%


00:38:20.910 --> 00:38:24.090 align:middle line:84%
Looking at the vulnerabilities
and understanding

00:38:24.090 --> 00:38:28.350 align:middle line:84%
what's behind them, how they
apply, and then trying to think

00:38:28.350 --> 00:38:31.290 align:middle line:84%
how would you
utilize this playing

00:38:31.290 --> 00:38:34.650 align:middle line:84%
the path of an attacker,
being a penetration tester,

00:38:34.650 --> 00:38:39.180 align:middle line:84%
being a red teamer, hopefully
this all made sense to you.

00:38:39.180 --> 00:38:41.130 align:middle line:84%
If you're taking
this course but you

00:38:41.130 --> 00:38:43.030 align:middle line:84%
don't see yourself
as a pen tester,

00:38:43.030 --> 00:38:45.580 align:middle line:84%
you don't see yourself
becoming a pen tester,

00:38:45.580 --> 00:38:47.580 align:middle line:84%
you just want an understanding
of cybersecurity,

00:38:47.580 --> 00:38:51.390 align:middle line:84%
I hope this helped understand
why these vulnerabilities are

00:38:51.390 --> 00:38:55.788 align:middle line:84%
important, and start thinking
about some of the mitigations.

00:38:55.788 --> 00:38:57.330 align:middle line:84%
Even as pen testers,
we need to think

00:38:57.330 --> 00:38:59.515 align:middle line:84%
about the mitigation for
these vulnerabilities

00:38:59.515 --> 00:39:01.140 align:middle line:84%
because that's going
to go in a report,

00:39:01.140 --> 00:39:04.320 align:middle line:84%
and that again is what
is valuable and useful

00:39:04.320 --> 00:39:05.520 align:middle line:90%
to the client.

00:39:05.520 --> 00:39:08.040 align:middle line:90%


00:39:08.040 --> 00:39:11.660 align:middle line:84%
With that, we're going
to get into some labs.

00:39:11.660 --> 00:39:13.000 align:middle line:90%