]>
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-2019 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 "tsx_async_abort" => "$Lang::tr{'taa zombieload2'} (CVE-2019-11135)",
43 my $errormessage = "";
46 my %mainsettings = ();
48 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
49 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
52 "ENABLE_SMT" => "auto",
54 &General
::readhash
("${General::swroot}/main/security", \
%settings);
56 &Header
::showhttpheaders
();
58 &Header
::getcgihash
(\
%settings);
60 if ($settings{'ACTION'} eq $Lang::tr
{'save'}) {
61 if ($settings{'ENABLE_SMT'} !~ /^(auto|on)$/) {
62 $errormessage = $Lang::tr
{'invalid input'};
65 unless ($errormessage) {
66 &General
::writehash
("${General::swroot}/main/security", \
%settings);
67 $notice = $Lang::tr
{'please reboot to apply your changes'};
72 $checked{'ENABLE_SMT'}{'auto'} = '';
73 $checked{'ENABLE_SMT'}{'on'} = '';
74 $checked{'ENABLE_SMT'}{$settings{'ENABLE_SMT'}} = "checked";
76 &Header
::openpage
($Lang::tr
{'processor vulnerability mitigations'}, 1, '');
78 &Header
::openbigbox
("100%", "left", "", $errormessage);
81 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
82 print "<font color='red'>$errormessage</font>";
87 &Header
::openbox
('100%', 'left', $Lang::tr
{'notice'});
88 print "<font color='red'>$notice</font>";
92 &Header
::openbox
('100%', 'center', $Lang::tr
{'processor vulnerability mitigations'});
95 <table class="tbl" width='100%'>
99 <strong>$Lang::tr{'vulnerability'}</strong>
102 <strong>$Lang::tr{'status'}</strong>
110 for my $vuln (sort keys %VULNERABILITIES) {
111 my ($status, $message) = &check_status
($vuln);
116 my $status_message = "";
119 if ($status eq "Not affected") {
120 $status_message = $Lang::tr
{'not affected'};
122 $bgcolour = ${Header
::colourgreen
};
125 } elsif ($status eq "Vulnerable") {
126 $status_message = $Lang::tr
{'vulnerable'};
128 $bgcolour = ${Header
::colourred
};
131 } elsif ($status eq "Mitigation") {
132 $status_message = $Lang::tr
{'mitigated'};
134 $bgcolour = ${Header
::colourblue
};
136 # Unknown report from kernel
138 $status_message = $status;
140 $bgcolour = ${Header
::colouryellow
};
143 my $table_colour = ($id++ % 2) ?
$color{'color22'} : $color{'color20'};
146 <tr bgcolor="$table_colour">
148 <strong>$VULNERABILITIES{$vuln}</strong>
151 <td bgcolor="$bgcolour" align="center">
152 <font color="$colour">
155 print "<strong>$status_message</strong> - $message";
157 print "<strong>$status_message</strong>";
174 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
176 &Header
::openbox
('100%', 'center', $Lang::tr
{'settings'});
178 my $smt_status = &smt_status
();
181 <table class="tbl" width="66%">
184 <th colspan="2" align="center">
185 <strong>$smt_status</strong>
190 <td width="50%" align="left">
191 $Lang::tr{'enable smt'}
194 <td width="50%" align="center">
196 <input type="radio" name="ENABLE_SMT"
197 value="auto" $checked{'ENABLE_SMT'}{'auto'}>
198 $Lang::tr{'automatic'}
201 <input type="radio" name="ENABLE_SMT"
202 value="on" $checked{'ENABLE_SMT'}{'on'}>
203 $Lang::tr{'force enable'} ($Lang::tr{'dangerous'})
209 <td colspan="2" align="right">
210 <input type="submit" name="ACTION" value="$Lang::tr{'save'}">
221 &Header
::closebigbox
();
223 &Header
::closepage
();
225 sub check_status
($) {
228 open(FILE
, "/sys/devices/system/cpu/vulnerabilities/$vuln") or return undef;
234 # Fix status when something has been mitigated, but not fully, yet
235 if ($status =~ /^(Mitigation): (.*vulnerable.*)$/) {
236 return ("Vulnerable", $status);
239 if ($status =~ /^(Vulnerable|Mitigation): (.*)$/) {
247 open(FILE
, "/sys/devices/system/cpu/smt/control");
253 if ($status eq "on") {
254 return $Lang::tr
{'smt enabled'};
255 } elsif (($status eq "off") || ($status eq "forceoff")) {
256 return $Lang::tr
{'smt disabled'};
257 } elsif ($status eq "notsupported") {
258 return $Lang::tr
{'smt not supported'};