WEBVTT

00:01.370 --> 00:07.550
And the previous lecture, we seeing how we can write stuff to the server using an Ezekial injection,

00:07.670 --> 00:14.060
using the into outflux function, and if the server allow us to write to the Web directory to our place

00:14.060 --> 00:19.580
that we can browse, then we can just write our every show using the same code that we seen before using

00:19.580 --> 00:20.240
the pass through.

00:20.510 --> 00:26.440
And then we can browse it and we'll get a reverse shell exactly the same way that we did when we upload

00:26.450 --> 00:26.900
a file.

00:28.670 --> 00:34.730
The problem is we weren't able to write stuff to the Web directory, so we can't actually read the stuff

00:34.730 --> 00:35.660
using the URL.

00:36.050 --> 00:38.970
The only place that we could write to was the top.

00:39.170 --> 00:45.320
So you can't actually browse the top through the URL, therefore, you can't just browse that file.

00:45.890 --> 00:49.970
So what I'm going to do today is I'm going to show you a workaround for that problem.

00:50.210 --> 00:57.680
But for this workaround to work the same website or the same server has to have a local file inclusion.

00:59.120 --> 01:04.190
This is very important, the same Web server, not the same website, because we see and remember in

01:04.190 --> 01:09.040
the first section how we can discover all the websites that are within one server.

01:09.380 --> 01:15.380
So if one of them has an actual injection and the other has a local file inclusion, you can combine

01:15.380 --> 01:18.740
both of these and get a shell and I'll show you how to do that.

01:19.370 --> 01:21.840
So I'm actually going to be doing this on the TV.

01:22.400 --> 01:27.430
You can do it on Mattilda, but I'm just doing it here just for a change to show you just another example.

01:28.280 --> 01:32.120
So I'm going to the ESKIL injection and I'm going to put no one here.

01:34.650 --> 01:39.920
Submit it and then we're going to start doing our injection exactly the same way that we always did,

01:40.140 --> 01:43.020
so we closed the quote and we do unions select.

01:44.910 --> 01:45.540
One to.

01:47.000 --> 01:48.860
And our comment.

01:50.830 --> 01:57.460
And that'll work, as you can see now, what I'm going to do, I'm going to write my shell to top and

01:57.460 --> 02:01.210
then I'm going to browse that shelf through the local file inclusion.

02:01.720 --> 02:06.220
So my exploit is going to be under select one to.

02:07.080 --> 02:12.750
And in one, I'm actually going to write what I want to write to the file, so I'm going to write a

02:13.290 --> 02:18.270
code, the same page because that we've been using to get a reverse connection to my computer.

02:19.220 --> 02:21.440
And the code is going to be passed through.

02:23.100 --> 02:24.000
NCEA.

02:24.990 --> 02:27.180
Ben S.H., my IP.

02:28.350 --> 02:30.180
And the port, which is 880.

02:32.170 --> 02:36.100
And instead of number two, I'm going to put NUL so nothing will be written into the file.

02:39.060 --> 02:41.250
And then we're going to say into our file.

02:44.410 --> 02:46.600
And we've called this reverse that BHP.

02:48.160 --> 02:54.340
So let's just have another look on this exploit, so what we're doing, we're doing a normal union select

02:54.760 --> 03:00.910
and we're doing a normal into our file and we're saving this in the top exactly like we've seen in the

03:00.910 --> 03:01.750
previous lecture.

03:02.350 --> 03:08.740
But instead of writing just normal stuff, we're actually going to write code and we're going to do

03:08.740 --> 03:13.180
a pass through NCEA been S.H., my IP port.

03:13.570 --> 03:21.060
And what this is going to do, it's actually going to try to connect to this IP using that card.

03:22.030 --> 03:23.560
So let's exploit this.

03:26.280 --> 03:31.830
And I'm actually going to set the idea here to minus one so that no values come in for the admin and

03:31.830 --> 03:35.690
admin in here and the first name and the surname.

03:35.880 --> 03:37.470
So I just said that to minus one.

03:37.740 --> 03:40.860
And then I'm going to put my exploit here after the minus one.

03:42.330 --> 03:43.770
Same way that we always do it.

03:45.560 --> 03:46.190
And enter.

03:48.180 --> 03:52.700
And it tells us that the file already exists, but it actually doesn't this is just a normal error.

03:53.130 --> 03:56.100
So this file has been written now to the server.

03:57.240 --> 04:03.870
Now, the problem is if if we load this file to somewhere else other than top, so, for example, if

04:03.870 --> 04:14.820
we can actually write this file to say var w w w D.V. w a, then we'd be able to just go and browse

04:14.820 --> 04:15.450
this file.

04:16.630 --> 04:17.410
From here.

04:19.420 --> 04:27.340
So all we have to do is just go to the W to this and then right in reverse that and then would be able

04:27.340 --> 04:27.820
to see it.

04:28.030 --> 04:30.550
But again, we actually don't have permission to write in here.

04:30.740 --> 04:34.510
You can try to write in images, for example, DPW images.

04:34.510 --> 04:39.720
So you can actually before you go through this method, you can go ahead and try to find a place or

04:39.730 --> 04:41.540
writable place on the server.

04:41.920 --> 04:47.230
A lot of the time you want, because if Web admins should actually know about this and show you, they

04:47.230 --> 04:49.000
shouldn't allow you to write stuff like that.

04:49.240 --> 04:50.530
But if you did, then you're lucky.

04:50.530 --> 04:52.540
You can just go ahead and browse it like this.

04:52.720 --> 04:56.680
If you didn't, then just continue this video and see how we're going to exploit it.

04:57.340 --> 05:00.580
So now I'm just going to listen for connections using net cut.

05:00.580 --> 05:03.730
So I'm going to do Essive VLP.

05:06.310 --> 05:06.720
Eighty.

05:08.290 --> 05:11.450
And that will listen for incoming connections in Port 880.

05:11.680 --> 05:16.770
So when we execute this code, it will try to connect back to us and we'll get the connection here.

05:17.930 --> 05:23.390
So now we have the file written and we're listening on connections, all we need is a way to browse

05:23.390 --> 05:24.940
this file to get it executed.

05:25.520 --> 05:29.720
So we see that we can't actually write anywhere, that we can browse it.

05:30.170 --> 05:35.810
And because we saw this in temp, if you managed to run it from anywhere on the Web server, then you'll

05:35.810 --> 05:38.650
have connections and you'll have access to this website.

05:38.780 --> 05:42.740
So it doesn't you don't have to find a local file inclusion in the same website.

05:42.890 --> 05:45.830
You can find it in any website, in the same server.

05:45.920 --> 05:48.980
And this is where the information gathering part comes in really handy.

05:49.850 --> 05:54.440
So I'm going to do what I'm going to do now is I'm actually just going to run from within DPW.

05:55.520 --> 05:59.500
But I just want you to know that you can do this since we started in the top.

05:59.780 --> 06:00.290
You can.

06:01.200 --> 06:06.660
Open it and browse it from within any website on the server, so all you have to do is just find a website

06:06.660 --> 06:09.240
on the same server that has a local file inclusion.

06:10.380 --> 06:13.730
Now, I'm going to go to the file inclusion, and we've used this before.

06:14.250 --> 06:18.360
So I'm going to do is I'm just going to browse to.

06:19.670 --> 06:21.110
It is password first.

06:22.640 --> 06:27.470
To make sure it works and it works now, we're going to browse through our file that we just uploaded,

06:27.470 --> 06:29.030
which is stored in Tempe.

06:31.760 --> 06:32.480
Reverse.

06:33.700 --> 06:34.720
That BHP.

06:37.240 --> 06:42.670
And as you can see now, we've got a connection and we can run any commands we want on the server.

06:44.280 --> 06:48.540
And pretty much we have a reverse shell and we can do whatever we want on it.

06:51.690 --> 06:58.080
Now, I'm going to listen on AT&amp;T again, and what I want to do is I want to show you how you can exploit

06:58.080 --> 06:59.930
this now from anywhere within the server.

06:59.940 --> 07:02.700
So I'm actually going to go to Mattilda instead of W8.

07:05.780 --> 07:09.200
And we're going to go to the local full inclusion vulnerability in here.

07:12.760 --> 07:17.470
So we'll try to exploit this now the same way, so it's five times back.

07:19.890 --> 07:26.010
XY password, and as you can see, we can read the password now, all we have to do is just reach the

07:26.010 --> 07:26.580
top.

07:26.760 --> 07:30.660
So this is a completely separate website from the way we found.

07:30.670 --> 07:33.580
Let's assume that we find an ESKIL injection in DPW.

07:34.080 --> 07:39.060
And then we found the local inclusion in this, combining the two because the two websites are installed

07:39.060 --> 07:43.730
on the same server, on the same computer, we can actually get a reverse shell on that server.

07:43.980 --> 07:48.320
And doing that, we're just going to go to Tampoe, reverse we.

07:49.930 --> 07:55.870
And again, as you can see, we have our shell here where we can do whatever we want on the target web

07:55.870 --> 07:56.200
server.

07:57.070 --> 08:02.350
So, again, the idea to take from here is using into out while you can write stuff anywhere.

08:02.560 --> 08:05.320
If you can write stuff within the Web directory, then you're lucky.

08:05.440 --> 08:09.820
You can write your reverse shell and just browsing through the URL as if you're browse in any file on

08:09.820 --> 08:10.500
the Web server.

08:10.960 --> 08:16.720
If you can't, then look for another website on the same server that has a local file inclusion.

08:16.990 --> 08:22.300
And if you do, then you can just write the file using the actual injection and then browse it using

08:22.300 --> 08:23.440
the local file inclusion.

08:23.590 --> 08:25.030
And you have your Warshel.
