From 622caf8fee84e0744da2b4cd9ea5d1fc4c499388 Mon Sep 17 00:00:00 2001 From: Darren Embry Date: Thu, 14 Jun 2012 13:04:36 -0400 Subject: validate dropdowns for security reasons *really* fixes #2494 :-) --- usr/local/www/diag_packet_capture.php | 47 +++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'usr/local/www/diag_packet_capture.php') diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php index 998a2ab..bb7ea91 100644 --- a/usr/local/www/diag_packet_capture.php +++ b/usr/local/www/diag_packet_capture.php @@ -77,6 +77,23 @@ if ($_POST) { $fam = $_POST['fam']; $proto = $_POST['proto']; + if (!array_key_exists($interface, $interfaces)) { + $input_errors[] = gettext("Invalid interface."); + } + if ($fam !== "" && $fam !== "ip" && $fam !== "ip6") { + $input_errors[] = gettext("Invalid address family."); + } + if ($proto !== "" && + $proto !== "icmp" && + $proto !== "icmp6" && + $proto !== "tcp" && + $proto !== "udp" && + $proto !== "arp" && + $proto !== "carp" && + $proto !== "esp") { + $input_errors[] = gettext("Invalid protocol."); + } + if ($host != "") { if (!is_subnet($host) && !is_ipaddr($host)) { $input_errors[] = sprintf(gettext("A valid IP address or CIDR block must be specified. [%s]"), $host); @@ -178,6 +195,7 @@ include("fbegin.inc"); +
@@ -243,10 +261,10 @@ include("fbegin.inc");
" . gettext("Note:") . " " . @@ -294,7 +312,7 @@ include("fbegin.inc"); "; if ($processisrunning == true) - echo("" . gettext("Packet Capture is running.") . "
"); + echo("" . gettext("Packet Capture is running.") . "
"); if ($do_tcpdump) { $matches = array(); @@ -332,14 +350,29 @@ include("fbegin.inc"); $matchstr = implode($matches, " and "); echo("" . gettext("Packet Capture is running.") . "
"); mwexec_bg ("/usr/sbin/tcpdump -i $selectedif $searchcount -s $snaplen -w $fp$fn $matchstr"); - // echo "/usr/sbin/tcpdump -i $selectedif $searchcount -s $snaplen -w $fp$fn $matchstr"; } else { //action = stop echo("" . gettext("Packet Capture stopped.") . "

" . gettext("Packets Captured:") . "

"); ?>