WEBVTT

00:02.010 --> 00:08.490
Let's talk about how we can prevent these vulnerabilities now and these exploits, we were able to run

00:08.490 --> 00:11.200
any code we wanted on the target computer.

00:11.550 --> 00:13.950
Again, this functionality should be avoided.

00:13.950 --> 00:20.910
You should avoid allowing users to run any sort of code on your server, try to avoid all these functions,

00:20.910 --> 00:27.000
such as the Eveillard Pass through and all of these functions that allow a user to run operating system

00:27.000 --> 00:28.020
code on the server.

00:28.560 --> 00:35.350
If you absolutely had to use something like it, then make sure you analyze the input before you execute

00:35.350 --> 00:35.430
it.

00:35.850 --> 00:42.060
For example, in the example we where the code was doing typing and it will pick anything we put in

00:42.060 --> 00:42.690
the textbook.

00:42.710 --> 00:49.350
So I'm put in here, slash the text box just to show that this is the input that we put in the textbooks.

00:49.650 --> 00:52.960
This is what the program actually looks like if it looks too complicated.

00:52.980 --> 00:53.700
Forget about it.

00:53.700 --> 00:55.250
We're just talking about the concept here.

00:55.560 --> 00:57.240
So we're going to be talking about this year.

00:58.920 --> 01:03.570
So say, for example, you put what we did is we put a normal i.p.

01:05.440 --> 01:11.260
And then we put the semicolon and then we put a command that we wanted to do, so we did, for example,

01:11.650 --> 01:19.390
L.A. The problem with this is the Web application used to take this the way it is copied and run it

01:19.390 --> 01:26.830
in here, which will when you when you execute this command, it will do the pink first and then it

01:26.830 --> 01:29.870
will do the SLA, which is the command that we wanted.

01:30.520 --> 01:35.530
What you need to do is, for example, if you had to do it, what I advise is you just don't use these

01:35.710 --> 01:36.310
functions.

01:36.460 --> 01:42.760
If you had to use a function, a function like this, then what you should do is check that the input

01:42.760 --> 01:43.810
is what you're expecting.

01:43.810 --> 01:46.980
For example, you're expecting an IP address and nothing else.

01:47.230 --> 01:52.390
So you can use regex to make sure, no, I'm not going to talk about regex or what regex is.

01:52.600 --> 01:57.040
Regex is basically a rule that will make sure that the input looks on the following format.

01:57.040 --> 02:04.420
So it takes a digit digit, that digit digit digit digit that the digit which if I put anything else,

02:04.420 --> 02:06.520
then the Web application should refuse it.

02:08.440 --> 02:15.940
And this is exactly what the high security level does for the code, so I know we're talking about black

02:15.940 --> 02:20.480
box testing and everything, but I want to show you what a secure code should look like.

02:20.830 --> 02:27.640
So if we go to the security settings and I'm going to set this to high, this is actually called impossible

02:27.790 --> 02:30.910
and the new versions of DVDs.

02:31.780 --> 02:35.090
But we're using the one that comes with the floatable and it's just called high.

02:35.410 --> 02:38.750
So the reason why they call it impossible, because it's very secure.

02:39.430 --> 02:44.410
So if you go to the command execution again and I'm just going to give you the source to show you what

02:44.410 --> 02:44.920
they're doing.

02:45.220 --> 02:48.460
So they're implementing a way very similar to using rejects.

02:48.610 --> 02:55.540
I think user objects could be a bit nicer for in terms of like the look at the code, but they're using

02:55.540 --> 02:56.360
the same concept.

02:57.010 --> 03:00.940
So basically what they have is they have the target right here.

03:02.390 --> 03:09.080
So this is what you input, this is what we put in here, so whatever you type in here is going to come

03:09.080 --> 03:13.280
up as this variable right here, these last dollar target.

03:14.030 --> 03:18.800
So the first thing that they're doing is they're stripping the slashes from it.

03:20.100 --> 03:23.850
After they do that, they're dividing the IP using this function.

03:23.880 --> 03:28.450
So at this function, does it divides the IP based on the dot?

03:28.740 --> 03:32.840
So we have no, no, no, no, no, no, no, no.

03:33.180 --> 03:36.240
So they're dividing this dot into an array.

03:36.660 --> 03:39.390
So, for example, if you have an IP that say.

03:43.130 --> 03:49.610
So when we put our IP, which is 10, 20, 14 to 08.

03:51.590 --> 03:58.550
What this function does, what the explode function does right here, it will divide this into four

03:58.550 --> 04:00.740
into an array of four elements.

04:00.950 --> 04:03.310
So the array is going to be something like this.

04:03.750 --> 04:05.720
It will be 10.

04:06.980 --> 04:08.960
Twenty, fourteen.

04:09.910 --> 04:10.480
Toid.

04:12.110 --> 04:18.110
OK, and each one of these elements can be accessed based on its number right here.

04:18.500 --> 04:24.330
So what they do is they check if each one of these elements is a number.

04:24.350 --> 04:30.820
So it checks if it's numeric for the update, for the zero, for the one, for the two and for the three.

04:30.890 --> 04:35.530
And that checks for this element, this element, this element and this element.

04:35.690 --> 04:38.030
So they're making sure that we have a number.

04:38.080 --> 04:39.400
No, no, no.

04:39.830 --> 04:45.920
So when we try to inject our code right here, regardless of what characters we use a word, what tricks

04:45.920 --> 04:52.040
we use, as long as we're going to input characters in here, for example, the characters are going

04:52.040 --> 04:55.280
to go into here as well, into the last element.

04:55.820 --> 05:02.840
And when this last element gets checked and using this function, using these numeric function.

05:03.890 --> 05:10.550
It will give an error because obviously this is not a number two or eight semicolon, Pheidippides is

05:10.550 --> 05:16.240
not a number, and that would give us an error, saying that we have entered an invalid IP.

05:16.970 --> 05:23.060
So the best way to do this again is to make sure what the user inputted is what you're expecting.

05:23.060 --> 05:23.750
In this case.

05:23.840 --> 05:31.010
We're expecting a no, no, no, no, no, no, no, no, no, no, no, no, no.

05:31.160 --> 05:36.770
So dividing this into four elements and make sure each one of these elements is a number will help us

05:36.770 --> 05:41.570
to protect this input and validate the input that it is correct.

05:41.570 --> 05:46.460
And it won't be attackers won't be able to use it to hack into our server.
