summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_dump_states.php
diff options
context:
space:
mode:
authorErmal LUÇI <eri@pfsense.org>2014-11-27 21:43:41 +0100
committerErmal LUÇI <eri@pfsense.org>2014-11-27 21:44:01 +0100
commite6283dfd0c71862431862adf5a7aab9e90ab9239 (patch)
treefa619a74d2083afc98a2ecacd2ffea1df286676c /usr/local/www/diag_dump_states.php
parent7a63d5d095edf84850715af23c6e380542896a1d (diff)
downloadpfsense-e6283dfd0c71862431862adf5a7aab9e90ab9239.zip
pfsense-e6283dfd0c71862431862adf5a7aab9e90ab9239.tar.gz
Use the pfsense module functions rather than execing. Fixes also possible attack vectors.
Diffstat (limited to 'usr/local/www/diag_dump_states.php')
-rwxr-xr-xusr/local/www/diag_dump_states.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr/local/www/diag_dump_states.php b/usr/local/www/diag_dump_states.php
index 4e1891f..de11a90 100755
--- a/usr/local/www/diag_dump_states.php
+++ b/usr/local/www/diag_dump_states.php
@@ -46,8 +46,8 @@ require_once("interfaces.inc");
/* handle AJAX operations */
if(isset($_POST['action']) && $_POST['action'] == "remove") {
if (isset($_POST['srcip']) && isset($_POST['dstip']) && is_ipaddr($_POST['srcip']) && is_ipaddr($_POST['dstip'])) {
- $retval = mwexec("/sbin/pfctl -k " . escapeshellarg($_POST['srcip']) . " -k " . escapeshellarg($_POST['dstip']));
- echo htmlentities("|{$_POST['srcip']}|{$_POST['dstip']}|{$retval}|");
+ $retval = pfSense_kill_states($_POST['srcip'], $_POST['dstip']);
+ echo htmlentities("|{$_POST['srcip']}|{$_POST['dstip']}|0|");
} else {
echo gettext("invalid input");
}
@@ -56,16 +56,16 @@ if(isset($_POST['action']) && $_POST['action'] == "remove") {
if (isset($_POST['filter']) && isset($_POST['killfilter'])) {
if (is_ipaddr($_POST['filter'])) {
- $tokill = escapeshellarg($_POST['filter'] . "/32");
+ $tokill = $_POST['filter'] . "/32";
} elseif (is_subnet($_POST['filter'])) {
- $tokill = escapeshellarg($_POST['filter']);
+ $tokill = $_POST['filter'];
} else {
// Invalid filter
$tokill = "";
}
if (!empty($tokill)) {
- $retval = mwexec("/sbin/pfctl -k {$tokill} -k 0/0");
- $retval = mwexec("/sbin/pfctl -k 0.0.0.0/0 -k {$tokill}");
+ $retval = pfSense_kill_states($tokill);
+ $retval = pfSense_kill_states("0.0.0.0/0", $tokill);
}
}
OpenPOWER on IntegriCloud