Skip to content

Commit cd5d3c0

Browse files
author
Kristan Kenney
committed
Added additional verification of host domain in password reset.
Thanks to @FalzoMAD and @mmetince - this commit fixes hestiacp#748
1 parent 5ffb7ac commit cd5d3c0

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
66

77
### Bugfixes
88
- Fixed phpMyAdmin blowfish and tmp directory issues.
9+
- Added additional verification of host domain in password reset. Thanks to @FalzoMAD and @mmetince!
910

1011
## [1.1.0] - 2020-03-11 - Major Release (Feature / Quality Update)
1112
### Features

web/reset/index.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@
3030
} else {
3131
$mailtext = __('GREETINGS');
3232
}
33-
$mailtext .= __('PASSWORD_RESET_REQUEST',$_SERVER['HTTP_HOST'],$user,$rkey,$_SERVER['HTTP_HOST'],$user,$rkey);
34-
if (!empty($rkey)) send_email($to, $subject, $mailtext, $from);
33+
if (in_array(str_replace(':'.$_SERVER['SERVER_PORT'],'.conf',$_SERVER['HTTP_HOST']), array_merge(scandir('/etc/nginx/conf.d'),scandir('/etc/nginx/conf.d/domains'),scandir('/etc/apache2/conf.d/domains'),scandir('/etc/apache2/conf.d')))){
34+
$mailtext .= __('PASSWORD_RESET_REQUEST',$_SERVER['HTTP_HOST'],$user,$rkey,$_SERVER['HTTP_HOST'],$user,$rkey);
35+
if (!empty($rkey)) send_email($to, $subject, $mailtext, $from);
36+
header("Location: /reset/?action=code&user=".$_POST['user']);
37+
exit;
38+
} else {
39+
$ERROR = "<a class=\"error\">".__('Invalid host domain')."</a>";
40+
}
3541
unset($output);
3642
}
37-
38-
header("Location: /reset/?action=code&user=".$_POST['user']);
39-
exit;
4043
}
4144

4245
if ((!empty($_POST['user'])) && (!empty($_POST['code'])) && (!empty($_POST['password'])) ) {

0 commit comments

Comments
 (0)