Skip to content

Commit d30e3ed

Browse files
authored
Security patch for XSS in Edit server (hestiacp#3946)
* Add htmlenties to backup forms * Add some extra checks
1 parent f60bdd0 commit d30e3ed

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

web/templates/pages/edit_server.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ class="form-control js-password-input"
512512
class="form-control"
513513
name="v_mysql_url"
514514
id="v_mysql_url"
515-
value="<?= $_SESSION["DB_PMA_ALIAS"] ?>"
515+
value="<?= htmlentities($_SESSION["DB_PMA_ALIAS"]); ?>"
516516
>
517517
</div>
518518
<div class="u-mb10">
@@ -618,7 +618,7 @@ class="form-control"
618618
<label for="v_pgsql_url" class="form-label">
619619
<?= _("phpPgAdmin Alias") ?>
620620
</label>
621-
<input type="text" class="form-control" name="v_pgsql_url" id="v_pgsql_url" value="<?= $_SESSION["DB_PGA_ALIAS"] ?>">
621+
<input type="text" class="form-control" name="v_pgsql_url" id="v_pgsql_url" value="<?= htmlentities($_SESSION["DB_PGA_ALIAS"]) ?>">
622622
</div>
623623
<?php } ?>
624624
<?php if ($v_pgsql == "yes") {
@@ -727,7 +727,7 @@ class="u-ml5"
727727
class="form-control"
728728
name="v_backup_dir"
729729
id="v_backup_dir"
730-
value="<?= trim($v_backup_dir, "'") ?>"
730+
value="<?= htmlentities(trim($v_backup_dir, "'")) ?>"
731731
disabled
732732
>
733733
</div>
@@ -785,7 +785,7 @@ class="form-select"
785785
class="form-control"
786786
name="v_backup_host"
787787
id="v_backup_host"
788-
value="<?= trim($v_backup_host, "'") ?>"
788+
value="<?= htmlentities(trim($v_backup_host, "'")) ?>"
789789
>
790790
</div>
791791
<div class="u-mb20">
@@ -797,7 +797,7 @@ class="form-control"
797797
class="form-control"
798798
name="v_backup_port"
799799
id="v_backup_port"
800-
value="<?= trim($v_backup_port, "'") ?>"
800+
value="<?= htmlentities(trim($v_backup_port, "'")) ?>"
801801
>
802802
</div>
803803
<div class="u-mb10">
@@ -809,7 +809,7 @@ class="form-control"
809809
class="form-control"
810810
name="v_backup_username"
811811
id="v_backup_username"
812-
value="<?= trim($v_backup_username, "'") ?>"
812+
value="<?= htmlentities(trim($v_backup_username, "'")) ?>"
813813
>
814814
</div>
815815
<div class="u-mb20">
@@ -822,7 +822,7 @@ class="form-control"
822822
class="form-control js-password-input"
823823
name="v_backup_password"
824824
id="v_backup_password"
825-
value="<?= trim($v_backup_password, "'") ?>"
825+
value="<?= htmlentities(trim($v_backup_password, "'")) ?>"
826826
>
827827
</div>
828828
</div>
@@ -835,7 +835,7 @@ class="form-control js-password-input"
835835
class="form-control"
836836
name="v_backup_bpath"
837837
id="v_backup_bpath"
838-
value="<?= trim($v_backup_bpath, "'") ?>"
838+
value="<?= htmlentities(trim($v_backup_bpath, "'")) ?>"
839839
>
840840
</div>
841841
</div>
@@ -849,7 +849,7 @@ class="form-control"
849849
class="form-control"
850850
name="v_backup_bucket"
851851
id="v_backup_bucket"
852-
value="<?= trim($v_backup_bucket, "'") ?>"
852+
value="<?= htmlentities(trim($v_backup_bucket, "'")) ?>"
853853
>
854854
</div>
855855
<div class="u-mb10">
@@ -861,7 +861,7 @@ class="form-control"
861861
class="form-control"
862862
name="v_backup_application_id"
863863
id="v_backup_application_id"
864-
value="<?= trim($v_backup_application_id, "'") ?>"
864+
value="<?= htmlentities(trim($v_backup_application_id, "'")) ?>"
865865
>
866866
</div>
867867
<div class="u-mb10">
@@ -873,7 +873,7 @@ class="form-control"
873873
class="form-control"
874874
name="v_backup_application_key"
875875
id="v_backup_application_key"
876-
value="<?= trim($v_backup_application_key, "'") ?>"
876+
value="<?= htmlentities(trim($v_backup_application_key, "'")) ?>"
877877
>
878878
</div>
879879
</div>
@@ -887,7 +887,7 @@ class="form-control"
887887
class="form-control"
888888
name="v_rclone_host"
889889
id="v_rclone_host"
890-
value="<?= trim($v_rclone_host, "'") ?>"
890+
value="<?= htmlentities(trim($v_rclone_host, "'")) ?>"
891891
>
892892
</div>
893893
<div class="u-mb10">
@@ -899,7 +899,7 @@ class="form-control"
899899
class="form-control"
900900
name="v_rclone_path"
901901
id="v_rclone_path"
902-
value="<?= trim($v_rclone_path, "'") ?>"
902+
value="<?= htmlentities(trim($v_rclone_path, "'")) ?>"
903903
>
904904
</div>
905905
</div>
@@ -946,33 +946,33 @@ class="form-control u-min-height100 u-console"
946946
<ul class="values-list">
947947
<li class="values-list-item">
948948
<span class="values-list-label"><?= _("Issued To") ?></span>
949-
<span class="values-list-value"><?= $v_ssl_subject ?></span>
949+
<span class="values-list-value"><?= htmlentities($v_ssl_subject) ?></span>
950950
</li>
951951
<?php if ($v_ssl_aliases) { ?>
952952
<li class="values-list-item">
953953
<span class="values-list-label"><?= _("Alternate") ?></span>
954-
<span class="values-list-value"><?= $v_ssl_aliases ?></span>
954+
<span class="values-list-value"><?= htmlentities($v_ssl_aliases) ?></span>
955955
</li>
956956
<?php } ?>
957957
<li class="values-list-item">
958958
<span class="values-list-label"><?= _("Not Before") ?></span>
959-
<span class="values-list-value"><?= $v_ssl_not_before ?></span>
959+
<span class="values-list-value"><?= htmlentities($v_ssl_not_before) ?></span>
960960
</li>
961961
<li class="values-list-item">
962962
<span class="values-list-label"><?= _("Not After") ?></span>
963-
<span class="values-list-value"><?= $v_ssl_not_after ?></span>
963+
<span class="values-list-value"><?= htmlentities($v_ssl_not_after) ?></span>
964964
</li>
965965
<li class="values-list-item">
966966
<span class="values-list-label"><?= _("Signature") ?></span>
967-
<span class="values-list-value"><?= $v_ssl_signature ?></span>
967+
<span class="values-list-value"><?= htmlentities($v_ssl_signature) ?></span>
968968
</li>
969969
<li class="values-list-item">
970970
<span class="values-list-label"><?= _("Key Size") ?></span>
971-
<span class="values-list-value"><?= $v_ssl_pub_key ?></span>
971+
<span class="values-list-value"><?= htmlentities($v_ssl_pub_key) ?></span>
972972
</li>
973973
<li class="values-list-item">
974974
<span class="values-list-label"><?= _("Issued By") ?></span>
975-
<span class="values-list-value"><?= $v_ssl_issuer ?></span>
975+
<span class="values-list-value"><?= htmlentities($v_ssl_issuer) ?></span>
976976
</li>
977977
</ul>
978978
</div>

0 commit comments

Comments
 (0)