Skip to content

Commit df9647b

Browse files
committed
Merge pull request hestiacp#288 from 0x0d/master
Security vulnerabilities fix
2 parents 4406e81 + 512283e commit df9647b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/v-check-user-password.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ int main (int argc, char** argv) {
4545
/* open log file */
4646
FILE* pFile = fopen ("/usr/local/vesta/log/auth.log","a+");
4747
if (NULL == pFile) {
48-
printf("Error: can not open file %s \n", argv[0]);
48+
printf("Error: can not open file /usr/local/vesta/log/auth.log \n");
4949
exit(12);
5050
}
5151

52+
int len = 0;
53+
if(strlen(argv[1]) >= 100) {
54+
printf("Too long username\n");
55+
exit(1);
56+
}
57+
5258
/* parse user argument */
5359
struct passwd* userinfo = getpwnam(argv[1]);
5460
if (NULL != userinfo) {

web/api/index.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
$v_user = escapeshellarg($_POST['user']);
1616
$v_password = escapeshellarg($_POST['password']);
17-
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$_SERVER["REMOTE_ADDR"]."'", $output, $auth_code);
17+
$v_ip_addr = escapeshellarg($_SERVER["REMOTE_ADDR"]);
18+
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$v_ip_addr."'", $output, $auth_code);
1819
} else {
1920
$key = '/usr/local/vesta/data/keys/' . basename($_POST['hash']);
20-
if (file_exists($key)) {
21+
if (file_exists($key) && is_file($key)) {
2122
$auth_code = '0';
2223
}
2324
}

0 commit comments

Comments
 (0)