WEBVTT

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


00:00:03.395 --> 00:00:06.305 align:middle line:90%
[MUSIC PLAYING]

00:00:06.305 --> 00:00:10.200 align:middle line:90%


00:00:10.200 --> 00:00:12.330 align:middle line:84%
In this lab, we're going
to do cross-site scripting

00:00:12.330 --> 00:00:14.250 align:middle line:84%
but authenticate
it this time, which

00:00:14.250 --> 00:00:18.690 align:middle line:84%
means we need the cookie for
the session after we log in.

00:00:18.690 --> 00:00:20.350 align:middle line:90%
Let's jump into the environment.

00:00:20.350 --> 00:00:22.142 align:middle line:84%
And I can show you
exactly what that means.

00:00:22.142 --> 00:00:25.640 align:middle line:90%


00:00:25.640 --> 00:00:29.850 align:middle line:84%
You can open up a terminal
and check our IP address.

00:00:29.850 --> 00:00:33.820 align:middle line:84%
And we see we are on
this subnet right here.

00:00:33.820 --> 00:00:37.950 align:middle line:84%
So I'm just going to run Nmap
scan against that network,

00:00:37.950 --> 00:00:41.700 align:middle line:90%
replacing the two with a 0.

00:00:41.700 --> 00:00:48.000 align:middle line:84%
While it's running, I know
that this is a web app lab,

00:00:48.000 --> 00:00:49.500 align:middle line:84%
so I'm going to
open up the browser.

00:00:49.500 --> 00:00:55.650 align:middle line:84%
And I know that it is this
network with a .3 machine.

00:00:55.650 --> 00:00:58.530 align:middle line:90%
And it brings up bWAPP.

00:00:58.530 --> 00:01:03.630 align:middle line:84%
And we see over here the .3
has port 80 and 3306 open.

00:01:03.630 --> 00:01:07.560 align:middle line:84%
That makes sense for bWAPP,
which is an OWASP tool.

00:01:07.560 --> 00:01:10.180 align:middle line:90%


00:01:10.180 --> 00:01:11.560 align:middle line:90%
bee and bug.

00:01:11.560 --> 00:01:13.825 align:middle line:90%
Authenticate, and let us in.

00:01:13.825 --> 00:01:15.580 align:middle line:90%
I don't need to save.

00:01:15.580 --> 00:01:17.680 align:middle line:84%
We can go to HTML
Injection down here

00:01:17.680 --> 00:01:22.630 align:middle line:84%
or from this dropdown,
HTML Injection Reflected

00:01:22.630 --> 00:01:24.160 align:middle line:90%
and hit Hack.

00:01:24.160 --> 00:01:26.540 align:middle line:84%
And it takes us to
this great page.

00:01:26.540 --> 00:01:29.850 align:middle line:84%
This is the page that
we know is vulnerable

00:01:29.850 --> 00:01:30.850 align:middle line:90%
to cross-site scripting.

00:01:30.850 --> 00:01:32.960 align:middle line:84%
But we're going to play
with it and learn it.

00:01:32.960 --> 00:01:35.650 align:middle line:90%
So say we have Joe Schmoe.

00:01:35.650 --> 00:01:37.480 align:middle line:90%
Joe Schmoe is a friendly guy.

00:01:37.480 --> 00:01:42.820 align:middle line:84%
We hit Enter, and
it goes, and it now

00:01:42.820 --> 00:01:45.820 align:middle line:90%
shows our input in the browser.

00:01:45.820 --> 00:01:48.940 align:middle line:84%
And it does that because
it sent this get request

00:01:48.940 --> 00:01:53.800 align:middle line:84%
with these variables to
take in from the form.

00:01:53.800 --> 00:01:55.270 align:middle line:84%
Let's look at the
form real fast.

00:01:55.270 --> 00:01:58.290 align:middle line:90%


00:01:58.290 --> 00:01:58.790 align:middle line:90%
Careful.

00:01:58.790 --> 00:02:00.207 align:middle line:84%
This might be
illegal in Missouri.

00:02:00.207 --> 00:02:02.640 align:middle line:90%


00:02:02.640 --> 00:02:05.130 align:middle line:84%
But we have a form on
that page, and it's

00:02:05.130 --> 00:02:11.039 align:middle line:84%
going to utilize a get
method to htmli_get, passing

00:02:11.039 --> 00:02:12.550 align:middle line:90%
these variables.

00:02:12.550 --> 00:02:17.190 align:middle line:84%
And if they are passed, then
it's going to display welcome

00:02:17.190 --> 00:02:20.160 align:middle line:90%
and then whatever is passed.

00:02:20.160 --> 00:02:24.030 align:middle line:84%
Well, it just throws it in
here into the HTML document.

00:02:24.030 --> 00:02:28.040 align:middle line:84%
So we know that we
passed a string,

00:02:28.040 --> 00:02:30.440 align:middle line:84%
and now it shows
up in the document.

00:02:30.440 --> 00:02:33.690 align:middle line:84%
Well, what if we
pass something else?

00:02:33.690 --> 00:02:54.000 align:middle line:84%
What if we passed something like
script alert 1 backslash script

00:02:54.000 --> 00:02:56.310 align:middle line:90%
like that?

00:02:56.310 --> 00:02:57.300 align:middle line:90%
What happens there?

00:02:57.300 --> 00:03:01.960 align:middle line:90%


00:03:01.960 --> 00:03:07.370 align:middle line:84%
Well, it puts it
right on the page.

00:03:07.370 --> 00:03:10.130 align:middle line:84%
Maybe-- wow, it puts
it right on the page.

00:03:10.130 --> 00:03:11.480 align:middle line:90%
Maybe it will interpret it.

00:03:11.480 --> 00:03:14.360 align:middle line:90%


00:03:14.360 --> 00:03:17.060 align:middle line:90%
Let's play with it a little bit.

00:03:17.060 --> 00:03:19.130 align:middle line:90%
Let's pop Burp Suite.

00:03:19.130 --> 00:03:20.570 align:middle line:90%
Turn on our intercept.

00:03:20.570 --> 00:03:25.450 align:middle line:90%


00:03:25.450 --> 00:03:30.640 align:middle line:84%
And let's look at the actual
get request that goes with this.

00:03:30.640 --> 00:03:33.600 align:middle line:84%
So we've got our cookie
here for our session

00:03:33.600 --> 00:03:35.310 align:middle line:90%
from being logged in.

00:03:35.310 --> 00:03:37.080 align:middle line:90%
And we've got our variables.

00:03:37.080 --> 00:03:39.510 align:middle line:84%
Let's send this over
to repeater and see

00:03:39.510 --> 00:03:43.660 align:middle line:90%
what our responses look like.

00:03:43.660 --> 00:03:45.040 align:middle line:90%
So here's the normal response.

00:03:45.040 --> 00:03:47.400 align:middle line:84%
This is very similar to
the page we just had up.

00:03:47.400 --> 00:03:50.290 align:middle line:90%


00:03:50.290 --> 00:03:51.550 align:middle line:90%
Went too far.

00:03:51.550 --> 00:03:53.490 align:middle line:90%
There it is.

00:03:53.490 --> 00:03:59.460 align:middle line:84%
82 it says welcome Joe
Schmoe for Joe Schmoe.

00:03:59.460 --> 00:04:12.535 align:middle line:84%
And if I did script alert 1
close script and send that.

00:04:12.535 --> 00:04:16.790 align:middle line:90%


00:04:16.790 --> 00:04:22.500 align:middle line:90%
[INAUDIBLE] Keep going.

00:04:22.500 --> 00:04:23.850 align:middle line:90%
There, too far.

00:04:23.850 --> 00:04:24.720 align:middle line:90%
Right there.

00:04:24.720 --> 00:04:27.900 align:middle line:84%
I messed it up, so it's
not showing it properly.

00:04:27.900 --> 00:04:31.940 align:middle line:84%
Well, let's do it
the right way, then.

00:04:31.940 --> 00:04:34.206 align:middle line:90%
Forward slash.

00:04:34.206 --> 00:04:39.480 align:middle line:84%
Scroll down, and Burp
is interpreting it

00:04:39.480 --> 00:04:42.890 align:middle line:90%
as a script block.

00:04:42.890 --> 00:04:46.040 align:middle line:84%
I wonder what the browser
is actually doing.

00:04:46.040 --> 00:04:47.570 align:middle line:90%
This is bad.

00:04:47.570 --> 00:04:49.220 align:middle line:84%
You would want--
if you had a form,

00:04:49.220 --> 00:04:54.680 align:middle line:84%
you would want some
standardization between your

00:04:54.680 --> 00:04:56.570 align:middle line:90%
get request and your response.

00:04:56.570 --> 00:04:59.570 align:middle line:84%
That way, whatever
they're passing in here

00:04:59.570 --> 00:05:03.740 align:middle line:84%
doesn't actually
get interpreted.

00:05:03.740 --> 00:05:07.550 align:middle line:90%
This is cross-site scripting.

00:05:07.550 --> 00:05:14.660 align:middle line:84%
So let's run it with a
tool cross-site scripter.

00:05:14.660 --> 00:05:17.150 align:middle line:84%
Automatic framework to
detect, exploit, and report

00:05:17.150 --> 00:05:18.740 align:middle line:84%
cross-site scripting
vulnerabilities

00:05:18.740 --> 00:05:22.490 align:middle line:90%
and web-based applications.

00:05:22.490 --> 00:05:28.200 align:middle line:84%
Now, we want to use
this with our machine.

00:05:28.200 --> 00:05:35.570 align:middle line:84%
So we've got cross-site
scripter to attack URL

00:05:35.570 --> 00:05:40.130 align:middle line:90%
and our 212.191.3.

00:05:40.130 --> 00:05:42.080 align:middle line:90%
That is accurate.

00:05:42.080 --> 00:05:46.970 align:middle line:84%
The htmli_get, and
then we need to replace

00:05:46.970 --> 00:05:48.770 align:middle line:84%
our first variable
or the variable

00:05:48.770 --> 00:05:52.130 align:middle line:84%
we want to test with
this capital XSS.

00:05:52.130 --> 00:05:54.170 align:middle line:84%
Then we're going to
use this cookie which

00:05:54.170 --> 00:05:58.730 align:middle line:90%
is right out of Burp.

00:05:58.730 --> 00:06:02.340 align:middle line:90%


00:06:02.340 --> 00:06:05.490 align:middle line:90%
mpi6 is what this one is saying.

00:06:05.490 --> 00:06:12.480 align:middle line:84%
So let's grab that and make
sure that this is accurate.

00:06:12.480 --> 00:06:20.430 align:middle line:90%


00:06:20.430 --> 00:06:22.110 align:middle line:90%
Security level 0 mpi6.

00:06:22.110 --> 00:06:24.810 align:middle line:90%


00:06:24.810 --> 00:06:26.610 align:middle line:84%
Checking this is
a very important.

00:06:26.610 --> 00:06:29.700 align:middle line:90%


00:06:29.700 --> 00:06:31.630 align:middle line:84%
Different than what
I had in my notes,

00:06:31.630 --> 00:06:34.110 align:middle line:84%
that's why you got
to double-check.

00:06:34.110 --> 00:06:36.690 align:middle line:84%
And it looks like
it is vulnerable

00:06:36.690 --> 00:06:38.520 align:middle line:90%
to cross-site scripting.

00:06:38.520 --> 00:06:41.820 align:middle line:84%
Well, is it vulnerable
to the type of attack

00:06:41.820 --> 00:06:43.170 align:middle line:90%
we are interested in?

00:06:43.170 --> 00:06:45.330 align:middle line:84%
Let's throw a proof
of concept in there.

00:06:45.330 --> 00:06:48.240 align:middle line:90%


00:06:48.240 --> 00:06:49.815 align:middle line:90%
Let's do dot script.

00:06:49.815 --> 00:06:52.480 align:middle line:90%


00:06:52.480 --> 00:06:57.300 align:middle line:84%
This is just HTML
code, and then alert 1

00:06:57.300 --> 00:07:06.050 align:middle line:90%
is a built-in function for HTML.

00:07:06.050 --> 00:07:11.510 align:middle line:90%


00:07:11.510 --> 00:07:13.940 align:middle line:84%
And it looks like
it's vulnerable.

00:07:13.940 --> 00:07:15.620 align:middle line:90%
We have this final attack.

00:07:15.620 --> 00:07:17.540 align:middle line:90%
It is the URL.

00:07:17.540 --> 00:07:20.210 align:middle line:84%
And then, right here,
we've got %3Cscript%3E.

00:07:20.210 --> 00:07:26.780 align:middle line:90%


00:07:26.780 --> 00:07:29.480 align:middle line:90%
So that's hex.

00:07:29.480 --> 00:07:33.620 align:middle line:84%
It's URL encoding in
hex what we passed in.

00:07:33.620 --> 00:07:41.690 align:middle line:84%
That's a triangular bracket
left, triangular bracket right,

00:07:41.690 --> 00:07:44.420 align:middle line:84%
some more encoding, and
the rest of the form.

00:07:44.420 --> 00:07:47.070 align:middle line:90%


00:07:47.070 --> 00:07:52.460 align:middle line:84%
But you can see in there
there's alert 1 and the scripts.

00:07:52.460 --> 00:07:56.672 align:middle line:84%
And then, this is
hex URL encoding.

00:07:56.672 --> 00:07:57.880 align:middle line:90%
Let's go over to the browser.

00:07:57.880 --> 00:08:03.580 align:middle line:84%
If we take that, and we
throw it in the browser--

00:08:03.580 --> 00:08:12.680 align:middle line:84%
turn off FoxyProxy-- we
know what gets passed

00:08:12.680 --> 00:08:14.150 align:middle line:90%
is going to get interpreted.

00:08:14.150 --> 00:08:15.800 align:middle line:90%
So let's see what it passes.

00:08:15.800 --> 00:08:18.960 align:middle line:90%


00:08:18.960 --> 00:08:22.830 align:middle line:84%
It obviously popped up the box
of the 1, so that's something.

00:08:22.830 --> 00:08:26.780 align:middle line:84%
But you can see here in
the URL that it interpreted

00:08:26.780 --> 00:08:29.450 align:middle line:90%
it to be script alert 1.

00:08:29.450 --> 00:08:38.769 align:middle line:84%
And then, it looks like this is
the-- that %2F, your backslash,

00:08:38.769 --> 00:08:42.610 align:middle line:90%
your forward slash, and script.

00:08:42.610 --> 00:08:45.130 align:middle line:90%
And that worked.

00:08:45.130 --> 00:08:47.410 align:middle line:84%
Welcome-- and it says
nobody down there.

00:08:47.410 --> 00:08:51.740 align:middle line:84%
We've got this box, alert
box that popped up with 1.

00:08:51.740 --> 00:08:55.480 align:middle line:84%
You can hit OK, and
it still says Schmoe.

00:08:55.480 --> 00:08:58.720 align:middle line:84%
So it has all that, and
it still says Schmoe.

00:08:58.720 --> 00:08:59.890 align:middle line:90%
Well, let's take a look.

00:08:59.890 --> 00:09:03.340 align:middle line:84%
I want to inspect this
page source in here

00:09:03.340 --> 00:09:06.260 align:middle line:90%
and see what it got passed.

00:09:06.260 --> 00:09:07.010 align:middle line:90%
Oh, OK.

00:09:07.010 --> 00:09:11.630 align:middle line:84%
So welcome, and then that
script, and then Schmoe.

00:09:11.630 --> 00:09:13.310 align:middle line:90%
So this got interpreted.

00:09:13.310 --> 00:09:17.850 align:middle line:84%
That's why it popped up the
box, and it still showed Schmoe.

00:09:17.850 --> 00:09:20.660 align:middle line:90%


00:09:20.660 --> 00:09:23.690 align:middle line:84%
And that is authenticated
cross-site scripting.

00:09:23.690 --> 00:09:28.520 align:middle line:84%
It's very basic what we did
here because this is not

00:09:28.520 --> 00:09:30.470 align:middle line:84%
a full course on
what then you could

00:09:30.470 --> 00:09:32.150 align:middle line:90%
do with cross-site scripting.

00:09:32.150 --> 00:09:34.070 align:middle line:84%
That's going to be in
the web app pen testing

00:09:34.070 --> 00:09:38.180 align:middle line:84%
course that stand-alone, not
part of the pen testing student

00:09:38.180 --> 00:09:39.020 align:middle line:90%
pathway.

00:09:39.020 --> 00:09:41.990 align:middle line:84%
But for here, now you can
see at least the difference

00:09:41.990 --> 00:09:45.770 align:middle line:84%
of what happens if
the vulnerability is

00:09:45.770 --> 00:09:47.180 align:middle line:90%
behind a login.

00:09:47.180 --> 00:09:49.910 align:middle line:84%
If you need to be
authenticated as a user,

00:09:49.910 --> 00:09:54.410 align:middle line:84%
this is how you do it
with a session cookie.

00:09:54.410 --> 00:09:58.070 align:middle line:84%
And with that, we will move
on to the rest of the course

00:09:58.070 --> 00:10:00.250 align:middle line:90%
and the other labs.

00:10:00.250 --> 00:10:01.235 align:middle line:90%