]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - html/cgi-bin/vulnerabilities.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2020 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
32 my %VULNERABILITIES = (
33 "itlb_multihit" => "$Lang::tr{'itlb multihit'} (CVE-2018-12207)",
34 "l1tf" => "$Lang::tr{'foreshadow'} (CVE-2018-3620)",
35 "mds" => "$Lang::tr{'fallout zombieload ridl'} (CVE-2018-12126, CVE-2018-12130, CVE-2018-12127, CVE-2019-11091)",
36 "meltdown" => "$Lang::tr{'meltdown'} (CVE-2017-5754)",
37 "spec_store_bypass" => "$Lang::tr{'spectre variant 4'} (CVE-2018-3639)",
38 "spectre_v1" => "$Lang::tr{'spectre variant 1'} (CVE-2017-5753)",
39 "spectre_v2" => "$Lang::tr{'spectre variant 2'} (CVE-2017-5715)",
40 "srbds" => "$Lang::tr{'srbds'} (CVE-2020-0543)",
41 "tsx_async_abort" => "$Lang::tr{'taa zombieload2'} (CVE-2019-11135)",
44 my $errormessage = "";
47 my %mainsettings = ();
49 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
50 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
53 "ENABLE_SMT" => "auto",
55 &General
::readhash
("${General::swroot}/main/security", \
%settings);
57 &Header
::showhttpheaders
();
59 &Header
::getcgihash
(\
%settings);
61 if ($settings{'ACTION'} eq $Lang::tr
{'save'}) {
62 if ($settings{'ENABLE_SMT'} !~ /^(auto|on)$/) {
63 $errormessage = $Lang::tr
{'invalid input'};
66 unless ($errormessage) {
67 &General
::writehash
("${General::swroot}/main/security", \
%settings);
68 $notice = $Lang::tr
{'please reboot to apply your changes'};
73 $checked{'ENABLE_SMT'}{'auto'} = '';
74 $checked{'ENABLE_SMT'}{'on'} = '';
75 $checked{'ENABLE_SMT'}{$settings{'ENABLE_SMT'}} = "checked";
77 &Header
::openpage
($Lang::tr
{'processor vulnerability mitigations'}, 1, '');
79 &Header
::openbigbox
("100%", "left", "", $errormessage);
82 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
83 print "<font color='red'>$errormessage</font>";
88 &Header
::openbox
('100%', 'left', $Lang::tr
{'notice'});
89 print "<font color='red'>$notice</font>";
93 &Header
::openbox
('100%', 'center', $Lang::tr
{'processor vulnerability mitigations'});
96 <table class="tbl" width='100%'>
100 <strong>$Lang::tr{'vulnerability'}</strong>
103 <strong>$Lang::tr{'status'}</strong>
111 for my $vuln (sort keys %VULNERABILITIES) {
112 my ($status, $message) = &check_status
($vuln);
117 my $status_message = "";
120 if ($status eq "Not affected") {
121 $status_message = $Lang::tr
{'not affected'};
123 $bgcolour = ${Header
::colourgreen
};
126 } elsif ($status eq "Vulnerable") {
127 $status_message = $Lang::tr
{'vulnerable'};
129 $bgcolour = ${Header
::colourred
};
132 } elsif ($status eq "Mitigation") {
133 $status_message = $Lang::tr
{'mitigated'};
135 $bgcolour = ${Header
::colourblue
};
137 # Unknown report from kernel
139 $status_message = $status;
141 $bgcolour = ${Header
::colouryellow
};
144 my $table_colour = ($id++ % 2) ?
$color{'color22'} : $color{'color20'};
147 <tr bgcolor="$table_colour">
149 <strong>$VULNERABILITIES{$vuln}</strong>
152 <td bgcolor="$bgcolour" align="center">
153 <font color="$colour">
156 print "<strong>$status_message</strong> - $message";
158 print "<strong>$status_message</strong>";
175 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
177 &Header
::openbox
('100%', 'center', $Lang::tr
{'settings'});
179 my $smt_status = &smt_status
();
182 <table class="tbl" width="66%">
185 <th colspan="2" align="center">
186 <strong>$smt_status</strong>
191 <td width="50%" align="left">
192 $Lang::tr{'enable smt'}
195 <td width="50%" align="center">
197 <input type="radio" name="ENABLE_SMT"
198 value="auto" $checked{'ENABLE_SMT'}{'auto'}>
199 $Lang::tr{'automatic'}
202 <input type="radio" name="ENABLE_SMT"
203 value="on" $checked{'ENABLE_SMT'}{'on'}>
204 $Lang::tr{'force enable'} ($Lang::tr{'dangerous'})
210 <td colspan="2" align="right">
211 <input type="submit" name="ACTION" value="$Lang::tr{'save'}">
222 &Header
::closebigbox
();
224 &Header
::closepage
();
226 sub check_status
($) {
229 open(FILE
, "/sys/devices/system/cpu/vulnerabilities/$vuln") or return undef;
235 # Fix status when something has been mitigated, but not fully, yet
236 if ($status =~ /^(Mitigation): (.*vulnerable.*)$/) {
237 return ("Vulnerable", $status);
240 if ($status =~ /^(Vulnerable|Mitigation): (.*)$/) {
248 open(FILE
, "/sys/devices/system/cpu/smt/control");
254 if ($status eq "on") {
255 return $Lang::tr
{'smt enabled'};
256 } elsif (($status eq "off") || ($status eq "forceoff")) {
257 return $Lang::tr
{'smt disabled'};
258 } elsif ($status eq "notsupported") {
259 return $Lang::tr
{'smt not supported'};