From 6102c368c2c11f75b667165e86c85996ae2b0008 Mon Sep 17 00:00:00 2001 From: NewEraCracker Date: Tue, 3 May 2016 11:01:35 +0100 Subject: Fix form submission fields Submitting one form may lead to any other filled forms to be also submitted. This commit fixes this flaw (cherry picked from commit 592557140156767944d848ebb3ae4baab84464ec) --- src/usr/local/www/diag_command.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/usr/local/www/diag_command.php') diff --git a/src/usr/local/www/diag_command.php b/src/usr/local/www/diag_command.php index 660fab6..2562e9c 100644 --- a/src/usr/local/www/diag_command.php +++ b/src/usr/local/www/diag_command.php @@ -71,7 +71,7 @@ $allowautocomplete = true; require("guiconfig.inc"); -if (($_POST['submit'] == "DOWNLOAD") && file_exists($_POST['dlPath'])) { +if ($_POST['submit'] == "DOWNLOAD" && file_exists($_POST['dlPath'])) { session_cache_limiter('public'); $fd = fopen($_POST['dlPath'], "rb"); header("Content-Type: application/octet-stream"); @@ -88,10 +88,9 @@ if (($_POST['submit'] == "DOWNLOAD") && file_exists($_POST['dlPath'])) { fpassthru($fd); exit; -} else if (($_POST['submit'] == "UPLOAD") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { +} else if ($_POST['submit'] == "UPLOAD" && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tmp/" . $_FILES['ulfile']['name']); $ulmsg = sprintf(gettext('Uploaded file to /tmp/%s.'), htmlentities($_FILES['ulfile']['name'])); - unset($_POST['txtCommand']); } if ($_POST) { @@ -221,7 +220,7 @@ if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank print_callout(gettext("The capabilities offered here can be dangerous. No support is available. Use them at your own risk!"), 'danger', gettext('Advanced Users Only')); } -if (!isBlank($_POST['txtCommand'])):?> +if ($_POST['submit'] == "EXEC" && !isBlank($_POST['txtCommand'])):?>

@@ -253,7 +252,7 @@ if (!isBlank($_POST['txtCommand'])):?> - @@ -304,7 +303,7 @@ if (!isBlank($_POST['txtCommand'])):?>

PHP Response

"); $tmpname = tempnam("/tmp", ""); @@ -344,7 +343,7 @@ if (!isBlank($_POST['txtCommand'])):?>

- -- cgit v1.1