From d62015df1cdb0c0711b488bd66ced631b9a4f37b Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 10 May 2019 20:45:30 +0200 Subject: [PATCH] security, better guard free text inputs, only allow admin groups and signal the user about its likely disappearance in the future. In some cases users would be able to execute arbitrary commands, which is impossible to protect against. --- src/www/services_dnsmasq.php | 7 ++++++- src/www/services_ntpd.php | 5 +++++ src/www/services_unbound.php | 5 +++++ src/www/vpn_openvpn_client.php | 5 +++++ src/www/vpn_openvpn_csc.php | 6 ++++++ src/www/vpn_openvpn_server.php | 5 +++++ 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/www/services_dnsmasq.php b/src/www/services_dnsmasq.php index 0d8a51ff9..a833c57de 100644 --- a/src/www/services_dnsmasq.php +++ b/src/www/services_dnsmasq.php @@ -70,7 +70,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $input_errors[] = gettext('Unbound is still active on the same port. Disable it before enabling Dnsmasq.'); } - if (!empty($pconfig['custom_options'])) { + $prev_opt = !empty($config['dnsmasq']['custom_options']) ? $config['dnsmasq']['custom_options'] : ""; + if ($prev_opt != str_replace("\r\n", "\n", $pconfig['custom_options']) && !userIsAdmin($_SESSION['Username'])) { + $input_errors[] = gettext("Advanced options may only be edited by admins (role page-all), due to the increased possibility of privilege escalation."); + } + if (!empty($pconfig['custom_options']) && userIsAdmin($_SESSION['Username'])) { $args = ''; foreach (preg_split('/\s+/', str_replace("\r\n", "\n", $pconfig['custom_options'])) as $c) { if (!empty($c)) { @@ -386,6 +390,7 @@ $( document ).ready(function() {
> +