WEBVTT

00:02.520 --> 00:07.830
So we already seen in previous lectures how we can run Linux commands on the target server or you have

00:07.830 --> 00:10.020
to do is just literally typing the commands.

00:10.020 --> 00:13.250
For example, we can type the ability to see where we are.

00:13.560 --> 00:21.420
We can navigate back the door, that we can list what we have and we can do anything we want on the

00:21.420 --> 00:22.170
target server.

00:23.620 --> 00:29.680
Unfortunately, this isn't always the case, in many cases, you might gain access, upload your shell

00:29.680 --> 00:35.080
and have WiFi working, but every time you're on a command, you want see the result or you might get

00:35.080 --> 00:35.970
permission denied.

00:36.340 --> 00:42.220
And this will happen because the server is configured in a way to prevent you from running commands

00:42.220 --> 00:43.000
on that server.

00:43.810 --> 00:48.510
So what we're going to do is we're going to use a function that comes in with wavelet.

00:48.760 --> 00:51.130
So let's first type in help to see all the functions.

00:51.130 --> 00:57.280
Are the commands that we can use and the functions that we're going to use is called Shell S.H. And

00:57.280 --> 01:01.240
as you can see in the description, it says it allows us to execute shell commands.

01:02.290 --> 01:05.860
So using the function is very simple, all they have to do is type in shell.

01:06.950 --> 01:13.910
S.H. and then taps the command that you are on so you can type in again and you'll see the current working

01:13.910 --> 01:14.460
directory.

01:15.250 --> 01:19.820
Now, this will just use the default way that we've been using so far anyway.

01:20.060 --> 01:24.500
So if the default way doesn't really work, this will probably not work for you either.

01:25.550 --> 01:31.490
What I want to show you here is what this function allow you to do, so it actually allows us to run

01:31.490 --> 01:34.340
Linux commands using a number of methods.

01:34.820 --> 01:39.050
So it's very similar to the idea of the password when we were reading it.

01:39.920 --> 01:46.490
In this case, if you can't run commands on the target server, then it's probably because your user

01:46.490 --> 01:49.850
is configured in a way that's not allowed to run by commands.

01:50.360 --> 01:57.590
So what this function allow us to do is run the command through a function or through a python function

01:57.710 --> 01:59.190
or through a Perl function.

01:59.600 --> 02:02.630
So this way you're actually not running the command directly.

02:02.720 --> 02:08.020
You're running a function and then the function itself runs the command.

02:08.780 --> 02:13.850
Therefore, if you don't have permission to run commands directly, you'll be able to bypass this by

02:13.850 --> 02:16.520
running the command through a function.

02:17.850 --> 02:23.130
So to see all the vectors or all the methods that we can use to run the command, we're going to do

02:23.310 --> 02:25.380
LSH followed by minus.

02:27.360 --> 02:32.430
And as you can see, the first thing you see is the general way of using the commands, so you type

02:32.430 --> 02:36.360
in LSH and then you type where you want the command to be displayed.

02:36.370 --> 02:40.410
This is the right direction and we're not going to mess with that because we want it to be displayed

02:40.410 --> 02:40.950
on screen.

02:41.930 --> 02:44.480
After that, you specify the vector.

02:44.510 --> 02:50.000
So this is what we're talking about, this is the methods that you can use to run the shell commands

02:50.420 --> 02:52.460
and you can see that you can run it using system.

02:52.490 --> 02:54.750
So this is the default way of running the commands.

02:55.190 --> 02:58.500
You can also use a pass, a pass through function.

02:58.670 --> 03:04.700
So this is the one that we used to use when we were executing commands, using, remember, and the

03:04.700 --> 03:06.430
code execution vulnerabilities.

03:07.220 --> 03:09.490
Again, you have a number of functions.

03:09.500 --> 03:12.740
So if one of the functions is disabled, you can use the other one.

03:13.340 --> 03:19.760
You can also run commands using Python through the Python interpreter and you can run functions using

03:19.760 --> 03:20.930
the Perl interpreter.

03:21.980 --> 03:28.700
So to use this, we're going to use the same command LSH followed by minus V, just like we see here

03:28.700 --> 03:29.570
in the template.

03:29.570 --> 03:35.930
So selling us first thing you type in is the command followed by the vector, and we're going to choose

03:35.930 --> 03:36.950
a vector to use.

03:37.280 --> 03:41.210
And for the first one, let's try the Perl system.

03:41.510 --> 03:42.620
So we're going to use Perl.

03:44.160 --> 03:44.740
System.

03:44.970 --> 03:50.670
So this is the actual function that will execute the command that we specified.

03:51.860 --> 03:57.320
And you can see here in the template, so it's show S.H., followed by the victor, followed by the

03:57.320 --> 04:01.220
command that we want to run and let's run this time we're going to try to run.

04:01.250 --> 04:01.780
Who am I?

04:03.500 --> 04:04.100
Hit enter.

04:05.810 --> 04:10.670
As you can see, this doesn't work, so we're going to go back and we're going to change the vector

04:10.760 --> 04:15.890
and let's try to use passthrough and we know passthrough works because we used it before.

04:16.610 --> 04:20.610
So, again, we were using passthrough as a vector and we're running the command.

04:20.630 --> 04:22.210
Who am I hit enter.

04:22.880 --> 04:26.150
And as you can see now, the command got executed on the server.

04:27.130 --> 04:32.410
So, again, in our particular case here, this doesn't seem very useful because around anchorman's

04:32.410 --> 04:34.530
normally just we can just type in who am I?

04:35.740 --> 04:41.890
Well, in a lot of real scenarios, you won't be able to run commands directly like this and using this

04:41.890 --> 04:44.520
function with the vector could be very useful.

04:44.740 --> 04:50.800
So all you have to do is just use the shell stage and experiment with all the available vectors until

04:50.800 --> 04:51.780
one of them works for you.
