WEBVTT

00:00.700 --> 00:04.080
Chapter 18 improving security with patches

00:08.220 --> 00:14.490
the unauthorized reproduction in whole or in part of this publication in any form is prohibited

00:25.310 --> 00:32.770
in this lesson we will get to know the core and compiler patches that improve the level of system security.

00:32.890 --> 00:58.440
Let's copy the necessary files onto the computer hard disk.

00:58.460 --> 01:04.630
We will start by unpacking the core sources and putting the security patch ph X in place.

02:33.580 --> 02:46.860
To install the patch we will use the patch command.

02:46.910 --> 02:50.480
We can therefore proceed with the most important task.

02:50.480 --> 02:53.220
The configuration of the P.A. X system

02:59.290 --> 03:08.010
to make the task slightly simpler we will upload the alternative G.R. security configuration file.

03:08.200 --> 03:14.170
We can finally proceed with the patch configuration a description of all available options is included

03:14.170 --> 03:14.860
in the handbook

04:22.420 --> 04:30.960
after terminating the configuration we save our settings and leave the configurator.

04:31.030 --> 04:36.030
The next step is the compilation of the new core and all modules.

04:36.130 --> 05:14.180
We will therefore perform a series of make commands.

05:14.340 --> 05:19.920
After a couple of minutes depending on the hardware resources of the computer the new kernel is ready

05:19.920 --> 05:21.160
for installation.

05:38.010 --> 05:43.200
Let's make the appropriate entry in the lilo configuration file to make the new kernel visible during

05:43.200 --> 05:43.760
the start

06:06.620 --> 06:08.240
after reloading the boot manager.

06:08.240 --> 06:11.230
We have to restart the system using the reboot command.

06:20.750 --> 06:22.680
After the new startup of the computer.

06:22.700 --> 06:25.370
It's time to test the functioning of the patch.

06:25.520 --> 06:28.700
We will use the pack's test tool set for this purpose

06:51.700 --> 06:54.440
as we can see by using G.R. security.

06:54.460 --> 06:57.690
The majority of attacks has been detected.

06:57.700 --> 06:59.880
Now let's look at another patch.

06:59.890 --> 07:08.780
It's time for the gcc compiler.

07:08.880 --> 07:14.900
We will now unpack the compiler sources that we copied earlier and install the stack smashing protector

07:14.910 --> 07:15.270
patch

07:39.810 --> 07:47.700
we have now to configure and compile GCC a new version of the compiler will be available in the U.S.

07:47.700 --> 08:51.340
are slash Peepy directory.

08:51.480 --> 10:06.780
After compiling it's time to install the new compiler in the system.

10:06.830 --> 10:10.360
Now we will test stack smashing protector on an example.

10:44.360 --> 10:50.420
As we can see after compiling the program using the old version of gcc it was possible to overwrite

10:50.420 --> 10:57.230
the stack frame.

10:57.240 --> 11:02.790
Let's now check how our program will behave after compiling with the modified gcc version.

11:19.940 --> 11:25.190
As we can see the attack attempt has been noted in the program and has been terminated before the stack

11:25.190 --> 11:26.670
frame could be overwritten.

11:27.530 --> 11:31.860
By default the patch secures only the character table's.

11:31.990 --> 11:34.320
Let's check this on our next example.

12:10.140 --> 12:16.290
To make possible the protection of other types of data as well we must use the stack protector all option

12:16.290 --> 12:17.270
during compilation

12:27.630 --> 12:33.390
as we can see the attack to temp has been detected to check how stack smashing protector works we will

12:33.390 --> 12:35.280
analyze our program with gdb

12:41.290 --> 12:42.430
control a variable.

12:42.430 --> 12:45.690
Overwriting is possible thanks to the application of guards.

12:45.740 --> 12:49.720
We can certain this by following the program execution step by step

13:25.530 --> 13:28.020
in the case of normal program performance.

13:28.020 --> 13:30.300
The guard variable is not overwritten

13:52.030 --> 13:54.700
after an argument that is too long has been transferred.

13:54.760 --> 14:00.280
The guard variable is overwritten and the comparison occurring in the program body indicates the occurrence

14:00.280 --> 14:02.490
of the attack.

14:02.490 --> 14:05.760
Now let's look at the safe library.

14:05.760 --> 14:09.170
It is a safe equivalent of the standard IBC library

14:37.230 --> 14:43.230
as we can see the next example uses the dangerous gets function which is also signaled by the compiler

14:53.150 --> 14:59.870
to add the IB safe library to each program being started it is necessary to modify the L.D. underscore

14:59.870 --> 15:01.330
pre-load system variable

15:21.280 --> 15:22.320
as we can see.

15:22.330 --> 15:26.070
Our program ended without errors despite using the dangerous gets function.
