WEBVTT

00:01.800 --> 00:08.750
And this lecture, I'd like to show you how we can use Eskil injections to read any file in the server,

00:08.910 --> 00:15.680
so even if the file exists outside the W-W route will be able to read it exactly like a file disclosure

00:15.700 --> 00:16.580
vulnerability.

00:16.950 --> 00:23.190
And we will also see how we can use it to write files and upload them to the system, just like a file

00:23.190 --> 00:24.430
upload vulnerability.

00:25.050 --> 00:31.830
So the first thing we're going to have a look at is the reason the file and I'm going to set everything

00:31.830 --> 00:32.480
to null here.

00:32.490 --> 00:36.090
So I have my statement here and I'm going to set select one.

00:36.090 --> 00:41.850
I'm going to need leave number two, because I'm going to do stuff in that and we're going to do another

00:41.850 --> 00:42.600
three nosier.

00:42.600 --> 00:44.340
So no.

00:46.110 --> 00:46.680
No.

00:47.700 --> 00:50.720
Now, so we have selected not something.

00:50.740 --> 00:57.600
No, no, not so five, because we have five records when we did the order by and instead of selecting

00:58.110 --> 01:02.310
something, remember in the third video, we did select database.

01:03.540 --> 01:08.310
For example, and it showed us the current database, what I want to do now is I want to do another

01:08.310 --> 01:11.420
function and that function is called L'Etoile.

01:15.220 --> 01:21.130
And in here, I'm going to set the file that I want to load and I'm going to use the same file that

01:21.130 --> 01:24.130
we had the look on in the file inclusion vulnerability.

01:24.340 --> 01:27.610
And it was etsi password.

01:28.850 --> 01:35.510
So we're trying to read that file and our statement is unions select that file and that's it.

01:35.690 --> 01:36.920
So I'm going to copy this.

01:38.200 --> 01:44.470
And I'm going to inject it here and I'm going to add my percentage 23, which is my comment.

01:47.750 --> 01:55.820
And as you can see, we managed to read all the information, all the content of ETEK password, even

01:55.820 --> 01:59.060
though it's not in the webroot, so it's stored in ETEK password.

01:59.060 --> 02:04.640
So we can read anything in the server from other websites, from other files, anywhere in the server.

02:04.650 --> 02:07.940
We can read it by specifying the full part of the file.

02:10.280 --> 02:11.930
The next thing I'd like to show you.

02:12.960 --> 02:19.440
His writing to the server, so we're actually going to write stuff to the server and this is very useful

02:19.440 --> 02:23.160
because you'd be able to write any code you want.

02:23.190 --> 02:26.700
So, for example, you can write the code for a script.

02:26.860 --> 02:33.330
You can write or write a code for a shell, a virus or a code to get a reverse connection to you.

02:33.570 --> 02:37.110
So it'll basically just act like a file, upload vulnerability.

02:37.860 --> 02:42.390
And to do that, I'm going to write the code that I want to do here, and I'm going to call that, for

02:42.390 --> 02:45.300
example, just an example.

02:45.300 --> 02:45.930
Example.

02:47.450 --> 02:53.210
And we're going to use a function called outfalls, so we're going to do into.

02:54.330 --> 03:01.230
I would file and then we're going to specify where we want to store that file now, in best case scenarios,

03:01.470 --> 03:07.140
you'd be able to write to your webroot and that would mean that you can access the file through the

03:07.140 --> 03:14.130
browser and execute it so you can upload a file and then connect to it and do stuff like that.

03:14.550 --> 03:15.990
So let's try to do that first.

03:16.120 --> 03:17.610
So we're going to do it inva.

03:18.700 --> 03:26.200
W w w and that's our webroot, so we'll be able to access things through it, or you can put it even

03:26.200 --> 03:32.230
via w w w and then put Mattilda after it to start in their.

03:34.190 --> 03:39.680
So the math is very simple again, union select, make sure you set everything to know also that nothing

03:39.680 --> 03:42.740
gets written into the file except what you put in here.

03:42.740 --> 03:50.450
And I, for example, example, and it's going to be stored into a file and via w w w mattilda and recall

03:50.450 --> 03:52.700
that example.

03:54.650 --> 03:56.180
The steep.

03:57.600 --> 03:59.630
Let's try to run this and see if it works.

04:12.620 --> 04:16.700
Now, this didn't work, and if you come down here, you'll see that.

04:18.310 --> 04:26.230
Askew or my Ezekial is not allowed to create or write to this directory, so the problem is, were not

04:26.620 --> 04:32.180
the permissions that we have, don't allow us to write to this particular location.

04:32.860 --> 04:39.880
So just to test this exploit, I'm going to change this location to Tempe, which is the temp, and

04:39.880 --> 04:42.220
you'll see that you can actually write to temp.

04:42.220 --> 04:44.930
So in real life scenarios, it depends.

04:44.950 --> 04:47.520
You can try it and see if you're able to write stuff or not.

04:48.040 --> 04:50.830
And this we're trying to write to temp now.

04:50.830 --> 04:52.120
And if we read in temp.

04:54.000 --> 04:58.620
If we clear that and then Ellas and.

05:01.440 --> 05:09.120
And you'll see that we have something called example, and if you try to read that, you'll see that

05:09.120 --> 05:14.730
it contains obviously it contains the content of what we did before, which was.

05:16.160 --> 05:23.620
The normal selection that you'd see, so what you see for putting the stuff for admin and then showed

05:23.630 --> 05:28.460
us what's in there, which is example, example, which is what we wanted to write to the file.

05:32.120 --> 05:37.640
Now, you can obviously get rid of the admin and the admin stuff by just putting around username and

05:37.640 --> 05:39.260
nothing is going to be displayed here.

05:39.410 --> 05:44.720
So the only thing that you'll see is the output, which is example, example.

05:45.320 --> 05:52.160
But again, this is only useful if you're able to write to your Web server so you can access it and

05:52.160 --> 05:56.840
then use your shell or use your payload and further exploit the system.
