Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Important Password Update [TTv3]
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods Completed

2019-06-08 10:17:55
This is designed for fresh installs and should be added to the original v3, for live sites see 2nd post

This updates the out dated passhash/md5 to PASSWORD_BCRYPT or  PASSWORD_ARGON2I making passwords more secure
This code is BCRYPT but you can change in sql 7.3 to ARGON2I by replacing in edits

First in myphpadmin in user table stucture increase length from 40 to 255

[color=rgb(251, 160, 38)]backend/functions.php find[/color]
if (strlen($_COOKIE["pass"]) != 40 || !is_numeric($_COOKIE["uid"])) {


replace with
if (strlen($_COOKIE["pass"]) != 60 || !is_numeric($_COOKIE["uid"])) {


find
if (!$row || sha1($row["id"].$row["secret"].$row["password"].$ip.$row["secret"]) != $_COOKIE["pass"]) {


replace with
$hash = $row["id"].$row["secret"].$row["password"].$ip.$row["secret"];
   if (!$row || !password_verify($hash,$_COOKIE["pass"])){


find
$hash = sha1($id.$secret.$password.getip().$secret);


replace with
    $hash = $id.$secret.$password.getip().$secret;
   $hash = password_hash($hash, PASSWORD_BCRYPT);


[color=rgb(251, 160, 38)]account-recover.php find[/color]
        SQL_Query_exec("UPDATE `users` SET `password` = '".passhash($password)."', `secret` = $newsec WHERE `id`=".intval($_POST['id'])." AND MD5(`secret`) = ".sqlesc($_POST["secret"]));


replace with
$wantpassword = password_hash($password, PASSWORD_BCRYPT);
       SQL_Query_exec("UPDATE `users` SET `password` = '".$wantpassword."', `secret` = $newsec WHERE `id`=".intval($_POST['id'])." AND MD5(`secret`) = ".sqlesc($_POST["secret"]));


[color=rgb(251, 160, 38)]admin-modtasks.php find[/color]
$password = passhash($password);


replace with
$password = password_hash($password, PASSWORD_BCRYPT);


[color=rgb(251, 160, 38)]account.php find[/color]
$chpassword = passhash($chpassword);


replace with
$chpassword = password_hash($chpassword, PASSWORD_BCRYPT);


[color=rgb(251, 160, 38)]account-login.php[/color]
$password = passhash($_POST["password"]);


replace with
$password = $_POST["password"];


find
if ( ! $row || $row["password"] != $password )


replace with
if ( !$row || !password_verify($password,$row["password"]))


[color=rgb(251, 160, 38)]account-signup.php find[/color]
$password_maxlength = 40;


replace with
$password_maxlength = 60;


find
$res = SQL_Query_exec("SELECT id FROM users WHERE id = $_REQUEST[invite] AND MD5(secret) = ".sqlesc($_REQUEST["secret"]));


replace with
$res = SQL_Query_exec("SELECT id FROM users WHERE id = $_REQUEST[invite] AND secret = ".sqlesc($_REQUEST["secret"]));


find
$wantpassword = passhash($wantpassword);// hash the password


replace with
$wantpassword = password_hash($wantpassword, PASSWORD_BCRYPT); // hash the password
2019-06-11 16:37:58
Read this before installing on live sites
[color=rgb(251, 160, 38)]this mod is ready for live sites your members can recover there account on the login page or there is a link to account-login1.php so there can use old md5 passwords.
If you login with account-login1.php you are redirected to you account settings page so you can add a new password. [/color]
I was hoping it would be automatic but this is a step closer and all members will have access

1) Before making edits in first post make a copy of account-login.php and name it account-login1.php

in account-login1.php find
header("Refresh: 0; url=index.php");

replace with
header("Refresh: 0; url=account.php?action=edit_settings&do=edit");

find
<form method="post" action="account-login.php">

replace with
<form method="post" action="account-login1.php">


2) After making first post edits add this to account-login.php

in account-login.php find
<table border="0" cellpadding="3" align="center">

add after
<tr><td align="center"><b><font size="2" color="red">We have recently updated some security features including better encrypted passwords.<br/>If your password does not work please  <a href="account-login1.php">Login with old password</a> then update your password or you may click recover account to do it by email</font></b></td></tr>
Unknown User
2019-07-06 19:53:26
not being picky but
header("Refresh: 0; url=account.php?action=edit_settings&do=edit


should be

        header("Refresh: 0; url=account.php?action=edit_settings&do=edit");
2019-07-06 20:15:14
Thanks updated post
Unknown User
2019-07-06 20:20:46
ive added all the code but im getting password incorrect if i use login1 and change password still password incorrect and if i recover stlll access denied only thing  i didnt have was

if ( ! $row || $row["password"] != $password )


was

if (!$row)
           $message = T_("USERNAME_INCORRECT");
       elseif ($row["status"] == "pending")
           $message = T_("ACCOUNT_PENDING");
       elseif ( !$row || !password_verify($password,$row["password"]))
           $message = T_("PASSWORD_INCORRECT");
       elseif ($row["enabled"] == "no")
           $message = T_("ACCOUNT_DISABLED");
   } else
       $message = T_("NO_EMPTY_FIELDS");


and i also didnt have


$res = SQL_Query_exec("SELECT id FROM users WHERE id = $_REQUEST[invite] AND password_hash(secret) = ".sqlesc($_REQUEST["secret"]));


in any of my files im using tt2.08 everything else went without a hitch :|  edit:  ive attached the files just incase and ive check over it im sure i havent missed anything except what i posted
password.zip
Download
2019-07-07 04:27:49
my mistake mate when i moved to complete i forgot the database change first post updated
in myphpadmin in user table stucture increase length from 40 to 255, hopefully its the password been cut short, apart from the line above missing the login looks fine
Unknown User
2019-07-07 11:18:10
i updated the user coloum field password and changed from 40 to 60 since thats what the account-signup.php limit is


$password_maxlength = 60;


now its working fine thanks
for anyone else running into this issue run in phpmyadmin SQL

ALTER TABLE `users` CHANGE `password` `password` VARCHAR(60) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '';


Thanks [USER=20288]@m-jay[/USER]
Unknown User
2019-07-08 07:08:48
[USER=20288]@m-jay[/USER] I tried to change to argon2id and it works fine, but it doesn't login. Just refreshes page to login after successful input.

Those are some changes for php 7.3.6 I did to adapt from bcrypt to argon
$argon2id_cost = [
   'memory_cost' => 2048,
   'time_cost' => 4,
   'threads' => 2
];


[ICODE]password_hash($hash, PASSWORD_ARGON2ID, $argon2id_cost)[/ICODE]

[ICODE]VARCHAR(255)[/ICODE]

[ICODE]$password_maxlength = 96;[/ICODE]

    //Check The Cookie and get CURUSER details
   if (strlen($_COOKIE["pass"]) != 96 || !is_numeric($_COOKIE["uid"])) {
       logoutcookie();
       return;
   }


PS: The password looks fine and recognizes if the password is wrong, but doesn't login, while bcrypt works fine.

2019-07-08 13:29:08
It's not argon2id that's a hybrid of argon2i & argon2d.I haven't really tested on 7.3 until i finished working on the backend and tested some things its designed for just changing P ASSWORD_BCRYPT to PASSWORD_ARGON2I but this hasnt really been tested in the same depth as the bcrypt.
Unknown User
2019-07-08 13:43:40
"m-jay, post: 66874, member: 20288":

It's not argon2id that's a hybrid of argon2i & argon2d.I haven't really tested on 7.3 until i finished working on the backend and tested some things its designed for just changing P ASSWORD_BCRYPT to PASSWORD_ARGON2I but this hasnt really been tested in the same depth as the bcrypt.

I think the problem is cookies where it verifies if passowrd is not equal to 96 which I changed. It doesn't let login maybe because bcrypt has fixed 60 characters rule where argon2 doesn't
2019-07-08 14:02:41
have you tried changing equal to above 60  (!= 96 to >60) & also making a few passwords to see the new length
Unknown User
2019-07-09 08:42:43
"m-jay, post: 66876, member: 20288":

have you tried changing equal to above 60  (!= 96 to >60) & also making a few passwords to see the new length

Original length is always 96, not working with both argon2i and argon2id
Unknown User
2019-07-10 18:26:00
[USER=20288]@m-jay[/USER] have you tested email confirm feature? I just tested it and when veryfing account or changing password, it just doesn't log in. Everything is successful and the password gets updated in database, but it doesn't login just refreshes page.

Without email confirmation it works fine.
2019-07-10 19:04:36
email confirm is working for me and isnt causing any issues, had it up and running on live site for a while.
Theres a chance it might be a md5 function i removed these ages ago ill post my files on github at weekend so its easier to compare, ill have a quick test of argon as well  :)
Unknown User
2019-07-10 20:42:25
"m-jay, post: 66890, member: 20288":

email confirm is working for me and isnt causing any issues, had it up and running on live site for a while.
Theres a chance it might be a md5 function i removed these ages ago ill post my files on github at weekend so its easier to compare, ill have a quick test of argon as well  :)

Alright waiting for you codes :)

PS: When confirm mail is enabled if i have [ICODE]$psecret = md5($secret);[/ICODE] then this problem appears:
"There has been a problem with your activation link"
If I remove it to [ICODE]$psecret = $secret[/ICODE] it works with verification but users can't login.

So the problem on register.php and account-recover is 100% secret
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728