WEBVTT

00:00.690 --> 00:02.420
Everybody and welcome to the next video.

00:02.460 --> 00:08.430
So in last video we talked about the lost top 10 so in this video we're gonna be talking about using

00:09.480 --> 00:14.410
sequel map as well as manually attacking sequel injection.

00:14.430 --> 00:21.630
Now we've talked about sequel before in previous videos where in this case we're looking at the Structured

00:21.630 --> 00:24.780
Query Language so we're gonna be interfacing with the database.

00:24.780 --> 00:30.600
Now it's important I understand here is sequel injection is not a configuration on the database per

00:30.600 --> 00:39.080
say but it's on configuration on the web application that's actually causing an issue so what I want

00:39.080 --> 00:45.370
to do is first explain how sequel injection works and what it looks like behind the scenes right.

00:45.410 --> 00:50.560
So when we open up a text idea here let's say in we have our our script right we'll do this in Python

00:50.570 --> 00:53.930
just cause you guys are familiar with the syntax at this point.

00:54.870 --> 00:58.560
Now let's say we have a query right.

00:59.180 --> 01:17.930
So query so this query is set to select a first name last name from let's say users from the table users

01:17.960 --> 01:25.370
where I.D. is equal to user input.

01:25.510 --> 01:25.870
Right.

01:27.310 --> 01:35.060
So if we grab this we do user input so we can see here what we're doing is we're taking user input and

01:35.060 --> 01:39.050
directly adding it into this Ideas section.

01:39.050 --> 01:44.070
Now since this query is on its own you might not think anything of it.

01:44.490 --> 01:50.970
However because we're not taking this user input and removing any quotes or any type of query language

01:51.060 --> 01:58.880
like for example we're expecting a digit here a one two three but if we were to do if we did user input

01:58.880 --> 02:02.890
and let's assume that we got this from the user already.

02:02.980 --> 02:10.520
So from the web app if we put in a single quote or a one we'll give it our digits digit and then a single

02:10.520 --> 02:25.950
quote and then doing drop all not drop all let's do let's see order by one hashtag.

02:25.950 --> 02:26.610
Right.

02:26.640 --> 02:33.630
So what this is going to do is make the final query look like this this copy and paste actually

02:38.670 --> 02:41.350
this is what the final query looks like.

02:41.370 --> 02:46.080
Normally when someone actually presents the regular digit.

02:46.080 --> 02:51.680
However when we add this into the mix this is what the query looks like now.

02:54.130 --> 02:59.860
So you can see here we've with our query in our user input which is just this we've closed off the quote

03:00.100 --> 03:06.940
which completes the where idea goes to 1 ordering by so we're executing more sequel statements and because

03:06.940 --> 03:13.120
we've got a quote or maybe there's more to this query words maybe it's not just ideas one but and username

03:13.180 --> 03:15.670
is equal to know test.

03:15.670 --> 03:16.510
Right.

03:16.510 --> 03:25.340
So if that's the case this part right here would be single quotes but this part right here would come

03:25.340 --> 03:29.240
into play after this.

03:29.320 --> 03:30.660
I'm sorry not right there.

03:30.670 --> 03:31.300
It would be

03:34.050 --> 03:38.390
but you can see here because of this this is a this is a comment and sequel.

03:38.430 --> 03:41.570
So it basically means ignore all this.

03:41.600 --> 03:46.460
So what you're doing here is you're taking advantage of it just dumping the text into a query and then

03:46.460 --> 03:48.170
we can do whatever you want we can drop dead.

03:48.200 --> 03:50.000
We can drop the entire database.

03:50.000 --> 03:52.910
We can remove stuff modify stuff.

03:52.910 --> 03:54.350
Select users.

03:54.350 --> 03:55.810
We can do a lot of different things.

03:55.910 --> 04:00.200
But I want you to get an understanding of what this is and what's going on behind the scenes before

04:00.200 --> 04:02.140
we actually go into sequel injection.

04:02.150 --> 04:07.340
Now if this doesn't make too much sense I'll leave a few other different tutorial links above the videos

04:07.940 --> 04:12.110
so you can check out a few different ways that people have explained this.

04:12.110 --> 04:17.350
So for now we're gonna go in close that and we do not need to save it.

04:18.020 --> 04:23.690
So what we're gonna be using for some of these test examples is something called DV W.A. or damn vulnerable

04:23.690 --> 04:24.640
web app.

04:24.710 --> 04:27.450
Now feel free to install this you can install us on.

04:27.450 --> 04:33.690
You can install this on Windows Linux doesn't matter it's just a web application that sits on top of

04:33.690 --> 04:41.150
the patchy with PSP and a my sequel back and I'll leave it to Oliva tutorial link to instruct to installing

04:41.150 --> 04:46.010
this on Cally about the video as well so you guys can play along with this and get familiar and go through

04:46.010 --> 04:47.220
the process.

04:47.450 --> 04:52.020
So looking at that we put in user I.D. one we can see here and we submit it.

04:52.280 --> 04:55.450
We can see our ideas one and we got her some some information right.

04:55.460 --> 05:00.470
So if we give it to we get some more information so it looks like it's interfacing with the database

05:00.890 --> 05:02.640
in some way shape or form.

05:02.660 --> 05:09.480
Now what's important here is that you are up you can see I.D. is equal to whatever so user I.D. I took

05:09.650 --> 05:11.060
equal to two right now.

05:11.060 --> 05:15.560
So if I go on changes to one and launch it we get our different answer.

05:15.560 --> 05:19.390
Now what happens if we do one and our karma like we did before.

05:19.400 --> 05:20.080
What happens then.

05:22.010 --> 05:22.820
So interesting.

05:22.850 --> 05:30.380
So we can see that because the query we finished the comma at the end or the quote at the end technically

05:30.380 --> 05:32.100
as far as if we looked at the.

05:32.480 --> 05:37.760
If you rewind back a little bit you'll see that our query that we made in the text document to showing

05:37.760 --> 05:42.890
you how it works there's still an extra comma in there or an extra quote in there.

05:42.890 --> 05:44.720
So what's gonna happen is it's going to fail.

05:44.720 --> 05:51.680
So you can see here we've got our original quote Our one the quote we added and then some random quote

05:51.680 --> 05:52.970
at the end.

05:53.000 --> 05:59.270
So because of that we can see that we now have an issue so that the syntax is no longer correct you

05:59.270 --> 06:01.330
can't have one quote without a closing one.

06:01.520 --> 06:04.540
So we can also take a second and see this as a Mario DV.

06:04.640 --> 06:07.440
So we can know how we can structure our secret queries accordingly.

06:07.490 --> 06:14.300
Some some sequel databases or databases in general don't use the same exact query language for each

06:14.300 --> 06:14.500
thing.

06:15.170 --> 06:19.600
So because of this we can see we get a syntax error a single syntax error.

06:19.610 --> 06:27.560
Now this is important because this tells us that we've injected some user input from us nuns it's not

06:27.560 --> 06:34.720
sanitized so it's not taking into account that we're removing dashes any special characters.

06:34.780 --> 06:39.920
It's not filtering that stuff out so this is unsanitary user input going into a query that's being sent

06:39.920 --> 06:44.450
to a database and this is very dangerous from web apps perspective.

06:44.450 --> 06:48.320
So just that simple comma at the end broke the web app.

06:48.590 --> 06:53.240
So we're now able to use this to our advantage and try to find out a little bit more information and

06:53.240 --> 06:59.000
maybe get some usernames passwords et cetera and maybe even compromised the server directly just from

06:59.000 --> 07:01.650
that simple this simple error message showing us.

07:01.700 --> 07:06.680
But what's interesting here is for us to be able to interface and grab information from the server we

07:06.680 --> 07:13.760
need to be able to find out what the structure of the table is that we're actually using.

07:13.760 --> 07:20.150
So we're we're actually pointing in the secret query to a certain table and that part's important because

07:20.150 --> 07:26.180
when sequel injection you have to let the first part of the query complete then you can go on with the

07:26.180 --> 07:31.520
rest which is why we leave a one here and we close it with us with a quote because that clue completes

07:31.520 --> 07:36.500
the whole query from the initial standpoint but we need to inject stuff after that that we want to actually

07:36.500 --> 07:37.400
use.

07:37.430 --> 07:43.910
So the quickest way for us to figure out first we need to know is how many columns are in this database

07:44.810 --> 07:50.390
and are in this table that we're working with because we need to be able to provide it all columns when

07:50.390 --> 07:53.780
we're trying to pull data from it which will make more sense in a little bit.

07:53.780 --> 08:00.650
So if we keep the same structure in here and we do order by 1 and then we go ahead and cancel out the

08:00.650 --> 08:01.810
rest of the query.

08:02.090 --> 08:05.120
If we run this now we see that nothing happened.

08:05.240 --> 08:05.810
That's great.

08:05.810 --> 08:08.810
That means we have at least one column to work with.

08:08.810 --> 08:16.310
But based on our initial searches here we can see that there's at least at least two columns depending.

08:16.310 --> 08:18.140
This may or may not be a column.

08:18.140 --> 08:22.110
It probably is but let's say this is just showing us all of our columns.

08:22.120 --> 08:26.510
So we can assume that there's at least three columns.

08:26.510 --> 08:31.630
So if we do two columns and we get nothing.

08:31.670 --> 08:33.350
So that means it's correct.

08:33.350 --> 08:35.730
So if we get three nothing.

08:35.780 --> 08:36.250
Perfect.

08:36.650 --> 08:40.430
So my assumption is based on what it's showing us there's there's two things here.

08:40.430 --> 08:44.330
It's either going to show you all the information or they're going to show you specific parts in most

08:44.330 --> 08:48.500
web applications we're not going to show you the whole table information in this app.

08:48.500 --> 08:54.560
It is because it's for testing and checking for and using and testing for the vulnerability to show

08:54.560 --> 08:55.340
you how it works.

08:55.640 --> 08:58.490
But in a general sense it might only show you new the first name.

08:58.490 --> 08:58.760
Right.

08:59.600 --> 09:05.980
So if we go to four we see that we get a we get nothing here.

09:06.050 --> 09:07.010
Right.

09:07.040 --> 09:09.540
So if we go to five OK.

09:09.580 --> 09:15.110
So while we're at three we'll go ahead and use the actual thing here.

09:15.150 --> 09:17.900
That's going to convert some of the characters for us.

09:17.900 --> 09:20.680
So if we go to three OK.

09:20.930 --> 09:23.790
So we see we get a clause three.

09:23.960 --> 09:28.030
So let's go back to two just to make sure perfect.

09:28.370 --> 09:31.940
So we can see we have two but it fails on three.

09:31.940 --> 09:36.910
Right so that tells me that there are two columns in this database.

09:36.910 --> 09:42.820
There are first name and surname in this particular table.

09:42.860 --> 09:44.630
Not database table.

09:44.630 --> 09:47.050
So this is what this means we have to to work with.

09:47.040 --> 09:49.680
Right.

09:49.710 --> 09:54.700
So what we need to do here next is try to find out what the databases.

09:54.720 --> 09:57.740
So what what database are we currently working with.

09:58.320 --> 10:01.580
So we could try to find out a little bit more about it.

10:01.610 --> 10:04.280
So what we can do here is we can change this to

10:07.320 --> 10:18.230
a union select and then we can use the function database in sequel with no as the last parameter.

10:18.230 --> 10:20.260
And then we're gonna close the quote.

10:20.390 --> 10:27.180
So what's happening here is we're closing we're getting at the one in them or closing the quote just

10:27.180 --> 10:32.130
like normal and then union selects just a way for us to join information from.

10:32.160 --> 10:37.980
So we're actually executing another query and then we're using a union type join in sequel to be able

10:37.980 --> 10:39.690
to join it to the same output.

10:39.690 --> 10:41.490
So essentially it's tacking it onto the end.

10:41.490 --> 10:46.390
So it's we're running our first query which is here we ran our first query and we completed it.

10:46.440 --> 10:49.250
So we should get whatever our ideas go to one.

10:49.260 --> 10:54.910
So in this case admin admin then we're doing a separate join no issuing a search.

10:54.910 --> 10:59.820
So we're doing select database so whatever the current database is in the first column.

10:59.820 --> 11:05.190
So that's important we have two columns to work with based on our order by two was not failing the order

11:05.190 --> 11:06.680
by three was.

11:06.720 --> 11:08.280
So we need to use two columns.

11:08.280 --> 11:14.310
So we you're going to store the data in the first column and we're going to pass null for the rest but

11:14.310 --> 11:18.010
we still need to we still need to close the query and ignore everything after it.

11:18.480 --> 11:24.640
So if we go ahead and run this we can see here we've got our first answer right.

11:24.640 --> 11:26.910
We've got our first are ideas 1.

11:26.920 --> 11:34.950
However if you look down here in our first column where we did database databases we could see DV W.A.

11:35.440 --> 11:37.780
which is indeed the database that we're going to be working with.

11:38.440 --> 11:45.340
So right now we've enumerated the databases that are present so we can take this a step further once

11:45.340 --> 11:49.470
we have the database we need to be able to find out more about the tables.

11:50.320 --> 11:55.160
So we could do this using a very simple way as well.

11:55.660 --> 12:03.100
We can do we still need it when you still need to complete our query next we can do our union select

12:04.420 --> 12:12.220
now what we're gonna do is we're gonna select something specific we're gonna select table name and null

12:12.230 --> 12:15.410
as our second parameter but our query isn't done here.

12:16.230 --> 12:20.930
So if we what we want to do is we want to select this from a particular table.

12:20.940 --> 12:24.110
So we're selecting this data from a specific table.

12:24.120 --> 12:30.600
Now what's important here is in sequel or in a database there's information schema that provides information

12:30.600 --> 12:34.320
about the tables and columns for a database.

12:34.380 --> 12:51.460
So to do this we're going to do from information schema tables where table schema is equal to DV go

12:51.550 --> 12:52.470
away.

12:52.670 --> 12:54.020
And I'm going to go in and close it out.

12:54.810 --> 13:02.800
So I'm actually bringing this out and copy that all open up leaf pad so you guys can see exactly what

13:02.800 --> 13:06.740
I'm typing so closing it.

13:06.860 --> 13:15.010
Didn't select we're grabbing the table name from this particular table which holds the tables for a

13:15.010 --> 13:16.820
particular database.

13:16.840 --> 13:19.600
So where the table schema is from this database.

13:19.600 --> 13:22.000
Right so if we go ahead and run that

13:26.480 --> 13:27.620
we can see we get it quite a bit.

13:27.620 --> 13:32.750
We get our standard one which is our idea of one but then we get guestbook and users.

13:32.750 --> 13:37.570
So this tells me that we have a user's table which might contain passwords.

13:37.580 --> 13:41.520
So let's focus a little bit more on the user's table.

13:41.660 --> 13:42.800
Right.

13:42.860 --> 13:49.430
So if we take the same query that we were working with before we want to grab our column name.

13:49.430 --> 14:00.670
So to do that we have to do something very similar to that column name know from information schema

14:01.390 --> 14:13.680
columns this time where table name is equal to users.

14:13.870 --> 14:18.790
So all we're doing is we're using information schema again instead of tables we're using the columns

14:18.970 --> 14:21.820
and we're wanting to look at the table users.

14:21.820 --> 14:27.690
So this is going to provide us our columns so we can know what we need to search for even further.

14:27.730 --> 14:32.250
So if we take a look at this perfect we can see we get our idea of one just like normal.

14:32.350 --> 14:39.070
Then we get our user I.D. first name last name user password which is that's interesting we want to

14:39.070 --> 14:41.590
use that an avatar for an image.

14:41.710 --> 14:43.060
Last log in failed log in.

14:43.060 --> 14:46.300
How many connections total connections.

14:46.300 --> 14:46.590
OK.

14:46.600 --> 14:50.230
So we get to a little bit more information than we had before.

14:50.290 --> 14:51.290
Right.

14:51.340 --> 14:59.660
So what we're gonna want to do here is very simply select all the users and their password from the

14:59.660 --> 15:10.490
user's table which we've already done with union so again if we do unions select user name or user and

15:10.500 --> 15:17.740
password or grabbing user ID password from users that's it.

15:18.040 --> 15:20.490
That's as simple as it is.

15:20.650 --> 15:21.700
We go ahead and run that

15:25.720 --> 15:26.260
boom.

15:26.290 --> 15:27.370
Now we've got our admin.

15:27.400 --> 15:34.730
We've got our empty five hash it looks like got a user empty five leet empty five Pablo and five Smithy.

15:34.750 --> 15:41.780
So now we can take these launch these into a password cracker such as John the Ripper or anything else.

15:41.860 --> 15:48.040
And then from that we can actually go ahead and gain access if it cracks the password we can use that

15:48.040 --> 15:51.330
to log into this web app as admin.

15:51.370 --> 15:54.740
So this is a really interesting way to pull hashes.

15:54.760 --> 15:59.890
So in some cases this injection might not be in an authenticated way.

15:59.890 --> 16:05.580
So you might be using just a regular part of the web app and not actually logged in as a user.

16:05.680 --> 16:11.470
In this case we're logged in as admin because it's a it's a security testing tool and everything's built

16:11.470 --> 16:13.190
behind that first log in.

16:13.210 --> 16:15.010
So keep that in mind in this example.

16:15.010 --> 16:19.330
However for real examples in the real world you might not even need to log into a web app to be able

16:19.330 --> 16:21.040
to exploit something like this.

16:21.040 --> 16:27.070
So using this allows you to grab the admin hash and if you can crack it you can log in to admin on that

16:27.070 --> 16:34.580
specific whether but what I want to show you guys next in this video is something called school map

16:34.610 --> 16:38.870
which basically takes all of what we just did and completely automates it.

16:39.460 --> 16:43.610
But I wanted you guys to understand what happens behind the scenes and I definitely want you to spend

16:43.610 --> 16:50.130
time after you build a DB W.A. host and test this out and make sure you fully understand cause there's

16:50.130 --> 16:55.820
sometimes an automated tools not going to find everything like you talked about before but for our tool

16:55.880 --> 17:02.800
we're going to need the cookies in the log in information from the site because remember we're behind

17:02.800 --> 17:03.990
a log in.

17:04.090 --> 17:07.910
So in this particular case we need it.

17:07.960 --> 17:14.380
But in other cases we want so for us we're gonna go ahead and grab this.

17:14.380 --> 17:24.130
This session information right so let's go ahead and open this up so there's something called sequence.

17:28.400 --> 17:34.330
Dash age so school map provides a lot of information and a lot of different things we can work with.

17:34.370 --> 17:42.100
Right so we'll go ahead and run that one more time perfect so we can see if we can grab everything from

17:42.100 --> 17:50.020
the database the current user passwords columns we can spawn an interactive shell we can batch things

17:50.020 --> 17:55.430
out we can tamper with different things we can do different you or else be more verbose.

17:55.540 --> 17:59.590
So it's a very interesting tool and it's very useful.

17:59.590 --> 18:04.490
So give us an example of this we'll do the same attack that we just did.

18:04.600 --> 18:04.900
Right.

18:05.620 --> 18:14.040
So if you see a map dash you will grab you are all in a second but we need dash dash cookie.

18:14.370 --> 18:21.510
And the reason we need the cookie is because everything in you are all that we're working with is actually

18:22.380 --> 18:23.560
behind you.

18:23.730 --> 18:24.770
Or it's behind the log.

18:24.780 --> 18:27.120
And so we're going to pass the session ideas so we can work with it.

18:28.050 --> 18:34.860
So let's go ahead and grab the we'll do we'll just grab the one so we'll assume no injection has happened.

18:34.870 --> 18:35.110
Right.

18:36.160 --> 18:37.040
Gordon copy this.

18:39.320 --> 18:44.290
And we'll paste it so we can see here right now.

18:44.290 --> 18:49.490
If we ran this it would start to try to identify which parameters in the URL that we can inject in.

18:49.490 --> 18:54.220
In this case I.D. but we're not going to do that because that takes a little bit of time testing a whole

18:54.220 --> 18:56.790
bunch of different things and it tries to pull everything at once.

18:56.920 --> 18:59.560
But we want to do is find our current database that we're working with.

18:59.590 --> 19:02.540
So dash dash current dash.

19:03.670 --> 19:05.120
So if we go ahead run this.

19:05.190 --> 19:10.840
Oh no I misspelled that to our current what's gonna happen here.

19:10.840 --> 19:12.510
It's gonna go ahead and start em.

19:12.580 --> 19:16.370
If we look a little bit down here we see current databases DV way.

19:16.780 --> 19:17.530
That's perfect.

19:17.560 --> 19:19.060
That's what we want.

19:19.090 --> 19:20.770
So let's take a look at that.

19:20.770 --> 19:24.780
So if we do dash capital D that's mentioning what database we want to look at.

19:24.820 --> 19:30.310
So DV W like then we're going to grab we wanna grab the tables so dash dash tables

19:33.040 --> 19:40.930
and pump that guestbook in users which is exactly what we saw before so taking this a step further we

19:40.930 --> 19:48.140
can keep the tables and do dash T for the table that we want to work with and that's users then we're

19:48.140 --> 19:51.650
gonna dash dash you guessed it columns.

19:51.710 --> 19:56.280
So this is gonna give us all the columns that we have to work with so we can see we've got user avatar

19:56.280 --> 20:01.210
failed log in password user I.D. last long last name.

20:01.380 --> 20:08.990
So again we have the same thing but what we're gonna want to do now is do dash dash.

20:09.140 --> 20:14.620
So this is going to do is it's going to try to dump all of the password hashes so you can see it does

20:14.630 --> 20:19.430
everything from the table so we can see these hashes are exactly what we expected to see before.

20:20.090 --> 20:26.600
But what's interesting is SQL map actually tells us do you want to store the hashes to a temporary file

20:26.600 --> 20:27.730
for further processing.

20:27.740 --> 20:29.870
We're gonna say yes.

20:29.870 --> 20:31.130
Do you want to crack this.

20:31.130 --> 20:32.090
Hell yeah we do.

20:33.270 --> 20:34.520
And that's it.

20:34.560 --> 20:38.160
It goes ahead and launches a dictionary attack using empty Ford.

20:38.220 --> 20:41.050
And if it happens to be in a dictionary it goes ahead and cracks it.

20:41.400 --> 20:45.890
So we can see here that the admin password is password.

20:46.080 --> 20:46.550
Interesting.

20:46.560 --> 20:50.050
Gordon's password is ABC one two three lead is Charlie.

20:50.170 --> 20:56.190
Pablo is let me in and Smith is password so you can see now we've got our passwords to log into the

20:56.190 --> 20:56.560
web.

20:56.580 --> 21:02.660
So if we logged out of admin and logged in as 1 3 3 7 with password Charlie it would let us in.

21:02.670 --> 21:04.200
So this is really good information.

21:04.200 --> 21:05.430
It works pretty well.

21:05.430 --> 21:09.990
It gave us the same information with a quarter of the time but it's also important to understand how

21:09.990 --> 21:11.020
it works.

21:11.190 --> 21:15.900
But what I want to do is take this one step further so you can understand the full length of what sequel

21:15.900 --> 21:18.460
injection is actually capable of.

21:18.540 --> 21:23.790
Now we're going to clear this out and we're going to clear out all of this.

21:24.480 --> 21:31.930
So what I want you guys to do is do dash dash a less dash shell.

21:32.190 --> 21:38.330
Now this is going to do is it's going to launch and try to upload something so we can launch it as ASPCA

21:38.490 --> 21:40.050
GSP or HP.

21:40.050 --> 21:43.450
In this case the web application is HP so we're gonna leave at default.

21:43.450 --> 21:48.090
So we're just gonna hit for do you want to provide full path disclosure.

21:48.090 --> 21:51.620
Not at the moment cause then that requires a lot more transactions back and forth.

21:52.740 --> 21:59.300
And for what readable directory do we want to use it looks like the common directory should be fine

21:59.310 --> 22:03.660
so we'll use one if that's not the case you can use brute force it or you can try a custom location

22:03.660 --> 22:06.450
like Slash temp whatever kind of works for you.

22:06.480 --> 22:13.200
Normally the unless you know the exact path for the web directory then you need to work with it depending

22:13.200 --> 22:14.090
on how it goes.

22:14.100 --> 22:17.560
So we'll use common locations.

22:18.710 --> 22:18.920
All right.

22:18.920 --> 22:19.340
Interesting.

22:19.880 --> 22:25.110
So looks like we got a few warnings but it's is backdoor has been successfully uploaded.

22:25.970 --> 22:30.450
So if we go ahead and do I.T. we'll say a for all.

22:30.450 --> 22:35.960
So we want to retrieve the output every time we type a command and not have to ask for it we can see.

22:35.990 --> 22:37.300
OK we're running as W data.

22:37.320 --> 22:40.240
So we'll see what directory we're in.

22:40.620 --> 22:41.530
Perfect.

22:41.530 --> 22:43.760
So code name.

22:43.790 --> 22:46.610
So it is true that it is on a killing machine.

22:46.750 --> 22:54.420
So if we do if config we can see boom we're on one dot 22 which is indeed our weather that are weather.

22:55.150 --> 23:01.880
So we've got a shell essentially what it's doing is it's really executing a command and then it's actually

23:01.960 --> 23:02.210
it.

23:02.250 --> 23:08.110
The sequel injection based on a file that it uploaded then it's giving you a result.

23:08.110 --> 23:12.580
But this isn't very interactive because if we wanted to do like the eye or anything else like that it

23:12.580 --> 23:15.980
would just block it we can't really do anything.

23:16.030 --> 23:18.490
So how do we take this a step further.

23:18.490 --> 23:26.140
Well what we can do is we can open up a new new command line or new terminal and what we'll do is we'll

23:26.140 --> 23:29.140
do a Let's do it.

23:29.160 --> 23:30.020
These matters.

23:30.230 --> 23:35.990
So if we do M.S. Benham we're going to generate a payload

23:41.840 --> 23:42.440
perfect.

23:42.640 --> 23:46.030
So we're gonna go ahead and generate a payload or an ESF binary.

23:46.120 --> 23:52.350
So something that can run on Linux and we're going to hit we're gonna go ahead and upload this to the

23:52.350 --> 23:58.530
web server via our shell that we already did and then launch the maternity session from our shell and

23:58.530 --> 24:04.960
gain us back a mere typewriter shell in return instead of working with some you know very basic shell.

24:04.980 --> 24:09.350
So this gives us from basic commands to full control of the system as that user.

24:09.570 --> 24:14.460
And we can upload different post modules and run reconnaissance based on that and or even use it as

24:14.460 --> 24:19.930
a pivot point without even needing to escalate yourself to route or admin or route in this example the

24:19.950 --> 24:21.600
admin and windows.

24:21.670 --> 24:22.440
Let's go ahead and do this.

24:22.470 --> 24:33.900
So I'll host is set to 1 2 6 8 1 twenty three and we'll do a port is equal to footfall for four dash

24:33.930 --> 24:40.230
F is gonna be an F binary and dash Oh we're gonna do Shell we'll just call Shell and we'll go ahead

24:40.250 --> 24:40.870
let that run

24:46.550 --> 24:50.350
well I definitely misspelled that misspelled interpreter.

24:50.350 --> 24:51.540
Sorry about that guys.

24:51.730 --> 24:52.600
Let's go ahead and fix that

25:02.360 --> 25:08.710
we go on let that run and we'll go ahead and build out a left binary named shell and what we're gonna

25:08.710 --> 25:14.020
do is I'm gonna show you guys a way for us to actually go ahead and execute this so we go ahead and

25:14.170 --> 25:20.620
look at what we've got here we can see Shell perfect now there's a simple trick Python already has a

25:20.620 --> 25:24.340
built in web service that you can just quickly run from any directory you want.

25:24.520 --> 25:31.300
So Python dash M simple HDP server and then whatever port you want.

25:31.300 --> 25:34.110
So in this case we'll do 80.

25:34.170 --> 25:34.500
Perfect.

25:34.560 --> 25:37.400
So now we've got a port running or we got a web service running.

25:37.410 --> 25:48.590
So we go over to our target which we again we are as WW data we're going to do w get a GDP 1 2 1 6 8

25:48.690 --> 25:54.770
1 twenty three and we're gonna grab slash or actually we need to do port 80 and then we're going to

25:54.770 --> 25:56.270
go slash shell.

25:56.430 --> 26:01.010
So if we go ahead and do a W get on that and add a way to second

26:04.700 --> 26:18.130
failed it's 1 2 1 6 8 1 twenty three and stop this if config Oh we are 20 for my mistake.

26:18.130 --> 26:25.550
Let's go ahead and go back and change our reverse shell to twenty four we'll recompile that always make

26:25.550 --> 26:28.070
sure you check your IP and make sure it didn't change on you.

26:28.550 --> 26:28.970
It's not.

26:28.970 --> 26:30.680
It does happen during engagements.

26:31.460 --> 26:32.430
So just keep that in mind.

26:32.450 --> 26:37.150
So we'll go ahead and run our thing again and we'll go ahead and rerun this.

26:37.160 --> 26:41.780
But as 24 instead so we should go ahead and there we go.

26:41.810 --> 26:43.140
Perfect.

26:43.270 --> 26:47.660
Ellis dash L so we can see we've got our show right there now.

26:47.700 --> 26:53.900
Now we're gonna want to do is we're gonna go and close out this and do MSF console and we're gonna go

26:53.900 --> 27:00.800
ahead and start up a maternal critter listener for the exploit that we just used.

27:00.800 --> 27:06.710
So this allows us to catch that maternity recession and just as a recap interpreter works in two stages.

27:06.890 --> 27:14.390
It launches the initial initial bit to connect back to the listener the maternity listener and once

27:14.390 --> 27:19.820
it connects back the listener will then send back the rest of the payload for the mature bitter shell

27:19.820 --> 27:20.690
itself.

27:20.690 --> 27:26.450
So keep that in mind because if you try to catch a mature spirit or shell with a with net cat or something

27:26.450 --> 27:28.250
it's going to fail every single time.

27:28.250 --> 27:36.150
So keep that in mind so we're gonna go ahead and use exploit mole Ty handler.

27:36.500 --> 27:37.150
Perfect.

27:37.300 --> 27:39.800
We'll set our payload to the same one that we were working with

27:46.860 --> 27:50.040
perfect onshore options.

27:50.070 --> 28:01.710
We'll set I'll host to 1 2 1 6 8 1 24 0 port 2 4 4 4 4.

28:01.760 --> 28:03.290
Go ahead and run this.

28:03.290 --> 28:13.310
So we got our handler and all we need to do is change mod plus XT for executable our shell and we will

28:13.310 --> 28:20.000
do Shell and we'll throw it in the background just in case we don't want this particular prompt to fail

28:20.000 --> 28:25.730
for whatever reason or hang it's going to do that so we come back over here we'll just give this a second

28:28.280 --> 28:28.970
and there we go.

28:29.210 --> 28:30.630
We've go ahead and got armor trooper.

28:30.710 --> 28:35.980
So this looks like it's hang for a second so go and close that out and do session's dash l.

28:36.580 --> 28:45.470
Perfect and we'll do sessions that shot dash high one cool and take a look here.

28:45.590 --> 28:46.910
Looks like we've got quite a bit

28:51.950 --> 28:58.070
looks like our shell died there for a second so we'll go ahead and rerun this sometimes this does happen

29:00.550 --> 29:03.310
without putting in the background this time.

29:03.370 --> 29:04.170
There we go.

29:04.180 --> 29:06.580
So no background didn't like that.

29:06.580 --> 29:12.390
So if we do shell here Shell perfect.

29:12.870 --> 29:15.310
There we go.

29:15.370 --> 29:16.240
Perfect.

29:16.270 --> 29:17.600
We can close out of this.

29:17.740 --> 29:23.870
And then again we have all of our post exploits or post modules that we could ever work with.

29:24.010 --> 29:28.510
And again we've got all the same information at play here.

29:28.570 --> 29:35.920
So go ahead and take some time follow the link above the video download and get installed and running

29:36.220 --> 29:43.540
the DV w a node and play around with it you can use it on the same calling machine as the one you're

29:43.540 --> 29:44.620
locally on.

29:44.650 --> 29:46.530
It works perfectly fine.

29:46.690 --> 29:51.180
Just note that when you launch that you'll be running it on it'll be launching on port 80.

29:51.370 --> 29:55.910
So you need make sure you don't have anything else running but that's how you take something from symbol

29:55.910 --> 30:03.490
sequel injection to dumping data from the sequel from the database itself which does provide a different

30:03.490 --> 30:08.560
leverage but then we can take that a step further with this and actually gain full access to the machine

30:08.640 --> 30:13.330
and from here we can do prevent escalation to gain more privileges.
