Skip to content

Commit 5cc0243

Browse files
authored
Encode passwords in emails send (hestiacp#3566)
1 parent c57708e commit 5cc0243

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

web/add/db/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@
182182
: $_SESSION["APP_NAME"];
183183

184184
$mailtext = translate_email($template, [
185-
"database" => $user_plain . "_" . $_POST["v_database"],
186-
"username" => $user_plain . "_" . $_POST["v_dbuser"],
187-
"password" => $_POST["v_password"],
185+
"database" => htmlentities($user_plain . "_" . $_POST["v_database"]),
186+
"username" => htmlentities($user_plain . "_" . $_POST["v_dbuser"]),
187+
"password" => htmlentities($_POST["v_password"]),
188188
"dbadmin" => $db_admin_link,
189189
"appname" => $_SESSION["APP_NAME"],
190190
]);

web/add/mail/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@
492492
$mailtext = translate_email($template, [
493493
"domain" => htmlentities($_POST["v_domain"]),
494494
"account" => htmlentities(strtolower($_POST["v_account"])),
495-
"password" => $_POST["v_password"],
495+
"password" => htmlentities($_POST["v_password"]),
496496
"webmail" => $webmail . "." . htmlentities($_POST["v_domain"]),
497497
"hostname" => "mail." . htmlentities($_POST["v_domain"]),
498498
"appname" => $_SESSION["APP_NAME"],

web/add/user/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@
209209
}
210210

211211
$mailtext = translate_email($template, [
212-
"name" => $name,
213-
"user" => $_POST["v_username"],
214-
"password" => $_POST["v_password"],
215-
"hostname" => $hostname,
212+
"name" => htmlentities($name),
213+
"user" => htmlentities($_POST["v_username"]),
214+
"password" => htmlentities($_POST["v_password"]),
215+
"hostname" => htmlentities($hostname),
216216
"appname" => $_SESSION["APP_NAME"],
217217
]);
218218

web/edit/mail/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,11 @@
10691069
}
10701070
}
10711071

1072+
$webmail = "http://" . $hostname . "/" . $v_webmail_alias . "/";
1073+
if (!empty($_SESSION["WEBMAIL_ALIAS"])) {
1074+
$webmail = $_SESSION["WEBMAIL_ALIAS"];
1075+
}
1076+
10721077
// Email login credentials
10731078
if (!empty($_POST["v_send_email"]) && empty($_SESSION["error_msg"])) {
10741079
$to = $_POST["v_send_email"];
@@ -1146,7 +1151,7 @@
11461151
$mailtext = translate_email($template, [
11471152
"domain" => htmlentities($_POST["v_domain"]),
11481153
"account" => htmlentities(strtolower($_POST["v_account"])),
1149-
"password" => $_POST["v_password"],
1154+
"password" => htmlentities($_POST["v_password"]),
11501155
"webmail" => $webmail . "." . htmlentities($_POST["v_domain"]),
11511156
"hostname" => "mail." . htmlentities($_POST["v_domain"]),
11521157
"appname" => $_SESSION["APP_NAME"],

web/edit/web/index.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,9 +1267,11 @@
12671267
}
12681268

12691269
$mailtext = translate_email($template, [
1270-
"domain" => $v_domain,
1271-
"username" => $user_plain . "_" . $v_ftp_username_for_emailing,
1272-
"password" => $v_ftp_user_data["v_ftp_password"],
1270+
"domain" => htmlentities($v_domain),
1271+
"username" => htmlentities(
1272+
$user_plain . "_" . $v_ftp_username_for_emailing,
1273+
),
1274+
"password" => htmlentities($v_ftp_user_data["v_ftp_password"]),
12731275
"appname" => $_SESSION["APP_NAME"],
12741276
]);
12751277

web/reset/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@
123123
$name = empty($data[$user]["NAME"]) ? $user : $data[$user]["NAME"];
124124

125125
$mailtext = translate_email($template, [
126-
"name" => $name,
127-
"hostname" => $hostname . $port,
128-
"user" => $user,
129-
"resetcode" => $rkey,
126+
"name" => htmlentities($name),
127+
"hostname" => htmlentities($hostname . $port),
128+
"user" => htmlentities($user),
129+
"resetcode" => htmlentities($rkey),
130130
"appname" => $_SESSION["APP_NAME"],
131131
]);
132132

0 commit comments

Comments
 (0)