Skip to content

Commit 95850df

Browse files
committed
Flatta's security fixes from PullRequest hestiacp#516
1 parent f8b39ec commit 95850df

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

web/add/web/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
$fp = fopen($v_ftp_password, "w");
273273
fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n");
274274
fclose($fp);
275-
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_username." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
275+
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
276276
check_return_code($return_var,$output);
277277
unset($output);
278278
unlink($v_ftp_password);

web/edit/cron/index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
}
5454

5555
$v_username = $user;
56+
$v_job = escapeshellarg($_GET['job']);
5657
$v_min = escapeshellarg($_POST['v_min']);
5758
$v_hour = escapeshellarg($_POST['v_hour']);
5859
$v_day = escapeshellarg($_POST['v_day']);

web/edit/mail/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
$result = array_diff($aliases, $valiases);
234234
foreach ($result as $alias) {
235235
if ((empty($_SESSION['error_msg'])) && (!empty($alias))) {
236-
exec (VESTA_CMD."v-add-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." '".$alias."'", $output, $return_var);
236+
exec (VESTA_CMD."v-add-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." ".escapeshellarg($alias), $output, $return_var);
237237
check_return_code($return_var,$output);
238238
unset($output);
239239
}
@@ -259,7 +259,7 @@
259259
$result = array_diff($fwd, $vfwd);
260260
foreach ($result as $forward) {
261261
if ((empty($_SESSION['error_msg'])) && (!empty($forward))) {
262-
exec (VESTA_CMD."v-add-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." '".$forward."'", $output, $return_var);
262+
exec (VESTA_CMD."v-add-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." ".escapeshellarg($forward), $output, $return_var);
263263
check_return_code($return_var,$output);
264264
unset($output);
265265
}

web/edit/web/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@
188188
$restart_web = 'yes';
189189
$restart_proxy = 'yes';
190190
$v_template = escapeshellarg($_POST['v_template']);
191-
exec (VESTA_CMD."v-add-web-domain-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
191+
exec (VESTA_CMD."v-add-web-domain-alias ".$v_username." ".$v_domain." ".escapeshellarg($alias)." 'no'", $output, $return_var);
192192
check_return_code($return_var,$output);
193193
unset($output);
194194
if (empty($_SESSION['error_msg'])) {
195195
exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
196196
unset($output);
197197
if ($return_var == 0) {
198-
exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$alias." ".$v_ip." no", $output, $return_var);
198+
exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".escapeshellarg($alias)." ".$v_ip." no", $output, $return_var);
199199
check_return_code($return_var,$output);
200200
unset($output);
201201
$restart_dns = 'yes';
@@ -520,7 +520,7 @@
520520
$fp = fopen($v_ftp_password, "w");
521521
fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n");
522522
fclose($fp);
523-
exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
523+
exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
524524
check_return_code($return_var,$output);
525525
if ((!empty($v_ftp_user_data['v_ftp_email'])) && (empty($_SESSION['error_msg']))) {
526526
$to = $v_ftp_user_data['v_ftp_email'];

web/login/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
fclose($fp);
4545

4646
// Check user & password
47-
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$_SERVER["REMOTE_ADDR"]."'", $output, $return_var);
47+
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." ".escapeshellarg($_SERVER['REMOTE_ADDR']), $output, $return_var);
4848
unset($output);
4949

5050
// Remove tmp file

web/search/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
//setlocale(LC_ALL, $lang);
2929

3030
// Data
31+
$q = escapeshellarg($q);
3132
if ($_SESSION['user'] == 'admin') {
32-
$q = escapeshellarg($q);
3333
exec (VESTA_CMD."v-search-object ".$q." json", $output, $return_var);
3434
$data = json_decode(implode('', $output), true);
3535
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_search.html');

0 commit comments

Comments
 (0)