Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nukeviet4.3 #2740

Merged
merged 3 commits into from Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
fix security error
Thank Zepto Team, hungnguyenmz
  • Loading branch information
VINADES.,JSC committed Nov 14, 2018
commit 05dfb9b4531f12944fe39556f58449b9a56241be
5 changes: 2 additions & 3 deletions includes/core/is_user.php
Expand Up @@ -50,11 +50,10 @@
if ($nv_Request->get_bool('nvloginhash', 'cookie', false)) {
$user = $nv_Request->get_string('nvloginhash', 'cookie', '');
if (!empty($user) and $global_config['allowuserlogin']) {
$user = unserialize($user);

$user = json_decode($user, true);
if (isset($user['userid']) and isset($user['checknum']) and isset($user['checkhash'])) {
$user['userid'] = intval($user['userid']);
if ($user['checkhash'] == md5($user['userid'] . $user['checknum'] . $global_config['sitekey'] . $client_info['browser']['key'])) {
if ($user['checkhash'] === md5($user['userid'] . $user['checknum'] . $global_config['sitekey'] . $client_info['browser']['key'])) {
$_sql = 'SELECT userid, group_id, username, email, first_name, last_name, gender, photo, birthday, regdate,
view_mail, remember, in_groups, active2step, checknum, last_agent AS current_agent, last_ip AS current_ip, last_login AS current_login,
last_openid AS current_openid, password, question, answer, safemode, email_verification_time
Expand Down
3 changes: 1 addition & 2 deletions modules/banners/funcs/click.php
Expand Up @@ -7,7 +7,6 @@
* @License GNU/GPL version 2 or any later version
* @Createdate 3-6-2010 0:19
*/

if (!defined('NV_IS_MOD_BANNERS')) {
die('Stop!!!');
}
Expand All @@ -29,7 +28,7 @@

$db->query('UPDATE ' . NV_BANNERS_GLOBALTABLE . '_rows SET hits_total=hits_total+1 WHERE id=' . $id);
$sql = "INSERT INTO " . NV_BANNERS_GLOBALTABLE . "_click (bid, click_time, click_day, click_ip, click_country, click_browse_key, click_browse_name, click_os_key, click_os_name, click_ref)
VALUES (" . $id . ", " . NV_CURRENTTIME . ", 0, '" . $client_info['ip'] . "', '" . $client_info['country'] . "', '', '" . $browser . "', '','" . $client_info['client_os']['name'] . "','" . $client_info['referer'] . "');";
VALUES (" . $id . ", " . NV_CURRENTTIME . ", 0, " . $db->quote($client_info['ip']) . ", " . $db->quote($client_info['country']) . ", '', " . $db->quote($browser) . ", '', " . $db->quote($client_info['client_os']['name']) . ", " . $db->quote($client_info['referer']) . ");";
$db->query($sql);
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/users/functions.php
Expand Up @@ -64,7 +64,7 @@ function validUserLog($array_user, $remember, $opid, $current_mode = 0)
$stmt->execute();
$live_cookie_time = ($remember) ? NV_LIVE_COOKIE_TIME : 0;

$nv_Request->set_Cookie('nvloginhash', serialize($user), $live_cookie_time);
$nv_Request->set_Cookie('nvloginhash', json_encode($user), $live_cookie_time);

if (!empty($global_users_config['active_user_logs'])) {
$log_message = $opid ? ($lang_module['userloginviaopt'] . ' ' . $opid) : $lang_module['st_login'];
Expand Down
45 changes: 6 additions & 39 deletions vendor/vinades/nukeviet/Core/Request.php
Expand Up @@ -765,28 +765,6 @@ private function parse_mode($mode)
return array_values($mode);
}

/**
* Request::base64Encode()
*
* @param mixed $input
* @return
*/
private function base64Encode($input)
{
return strtr(base64_encode($input), '+/=', '-_,');
}

/**
* Request::base64Decode()
*
* @param mixed $input
* @return
*/
private function base64Decode($input)
{
return base64_decode(strtr($input, '-_,', '+/='));
}

/**
* Request::encodeCookie()
*
Expand All @@ -795,14 +773,9 @@ private function base64Decode($input)
*/
private function encodeCookie($string)
{
$result = '';
$strlen = strlen($string);
for ($i = 0; $i < $strlen; ++$i) {
$char = substr($string, $i, 1);
$keychar = substr($this->cookie_key, ($i % 32) - 1, 1);
$result .= chr(ord($char) + ord($keychar));
}
return $this->base64Encode($result);
$iv = substr($this->cookie_key, 0, 16);
$string = openssl_encrypt($string, 'aes-256-cbc', $this->cookie_key, 0, $iv);
return strtr($string, '+/=', '-_,');
}

/**
Expand All @@ -813,15 +786,9 @@ private function encodeCookie($string)
*/
private function decodeCookie($string)
{
$result = '';
$string = $this->base64Decode($string);
$strlen = strlen($string);
for ($i = 0; $i < $strlen; ++$i) {
$char = substr($string, $i, 1);
$keychar = substr($this->cookie_key, ($i % 32) - 1, 1);
$result .= chr(ord($char) - ord($keychar));
}
return $result;
$string = strtr($string, '-_,', '+/=');
$iv = substr($this->cookie_key, 0, 16);
return openssl_decrypt($string, 'aes-256-cbc', $this->cookie_key, 0, $iv);
}

/**
Expand Down