Bitcoin Forum
December 06, 2016, 08:29:27 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: SMF modification needed -- upgrade password hash security -- 40 BTC  (Read 12155 times)
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 03, 2012, 06:01:26 AM
 #1

The forum will pay 40 BTC for a patch to SMF version 1.1.16 upgrading password hash security.

You should use these PHP functions I've written for doing the actual hashing:

Code:
//salted SHA-256 with 7500 rounds
define('CRYPT_PARAMS', '$5$rounds=7500$');

//get $bytes bytes of secure random binary data
function urandom($bytes)
{
$file = fopen('/dev/urandom', 'rb');
$result = fread($file, $bytes);
fclose($file);
if(strlen($result) < $bytes)
die('urandom byte length mismatch');
return $result;
}

//hash and salt a new password for insertion into the database
function newpass($pass)
{
return crypt($pass, CRYPT_PARAMS . base64_encode(urandom(12)) . '$');
}

//compare a provided password with the hash in the database
function password_is_valid($entered_password, $db_hash)
{
return crypt($entered_password, $db_hash) === $db_hash;
}

//old password comparison:
//sha1(strtolower($user) . $entered_password) == $db_hash
//new password comparison:
//password_is_valid($entered_password, $db_hash)

You need to do this:
- In LogInOut.php, upgrade SMF SHA-1 hashes to these new hashes automatically. Also, update any passwords that pass password_is_valid() but have a different CRYPT_PARAMS prefix than is being used currently.
- Change all old password comparisons to the new method.
- Wherever passwords are updated, use newpass() instead of SMF's method.
- Thoroughly test all aspects of this modification. I am mostly paying someone to do this change instead of doing it myself because bugs in this would create a huge mess and I therefore want someone more experienced in software testing to do it.

Hint: SMF has a "salt" column in the database and a "passwordSalt" variable, but these aren't actually used for password hashing. You only need to deal with the "passwd" column/variable.

PM me or post here if you're interested. I will pick the best candidate in a week or two. You should only apply if you're already pretty well-trusted in the community.

(Do not post in this thread about how you prefer another hashing method.)

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
1481012967
Hero Member
*
Offline Offline

Posts: 1481012967

View Profile Personal Message (Offline)

Ignore
1481012967
Reply with quote  #2

1481012967
Report to moderator
1481012967
Hero Member
*
Offline Offline

Posts: 1481012967

View Profile Personal Message (Offline)

Ignore
1481012967
Reply with quote  #2

1481012967
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481012967
Hero Member
*
Offline Offline

Posts: 1481012967

View Profile Personal Message (Offline)

Ignore
1481012967
Reply with quote  #2

1481012967
Report to moderator
1481012967
Hero Member
*
Offline Offline

Posts: 1481012967

View Profile Personal Message (Offline)

Ignore
1481012967
Reply with quote  #2

1481012967
Report to moderator
1481012967
Hero Member
*
Offline Offline

Posts: 1481012967

View Profile Personal Message (Offline)

Ignore
1481012967
Reply with quote  #2

1481012967
Report to moderator
M4v3R
Hero Member
*****
Offline Offline

Activity: 607



View Profile
June 07, 2012, 11:42:34 AM
 #2

I have some experience with SMF v1.1 mods, and I run a Bitcoin exchange (built with PHP) which already uses proper password security. So I can provide the extension you need.
publio
Member
**
Offline Offline

Activity: 64


View Profile
June 07, 2012, 08:01:45 PM
 #3

If you're creating salts, you may want to use a CSPRNG.  So, you want /dev/random instead of urandom.

theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 07, 2012, 08:24:42 PM
 #4

If you're creating salts, you may want to use a CSPRNG.  So, you want /dev/random instead of urandom.

/dev/urandom is more than sufficient. It's not very important for the salt to be unpredictable.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
publio
Member
**
Offline Offline

Activity: 64


View Profile
June 08, 2012, 12:08:47 AM
 #5

It's considered best practice to use CSPRNGs for any cryptography, including salts.  Predictable salts may offer protection against rainbow tables..  Maybe it protects against "theoretical attacks"?

Take a look at this page:
http://books.google.com/books?id=QJNoykS0Tv4C&lpg=PT199&ots=JN9mj5AsnT&dq=salt+csprng&pg=PT199&redir_esc=y#v=onepage&q&f=false

It turns out that urandom is also cryptographically secure. Cheesy The php function, mt_rand(), for example, is not.

live627
Hero Member
*****
Offline Offline

Activity: 574


View Profile
June 12, 2012, 08:51:36 PM
 #6

Do you want a direct file edit or a modification format that the package manager can use? I'm comfortable with both; however, the latter could be a no-go for you for obvious security reasons.
AndyRossy
Sr. Member
****
Offline Offline

Activity: 448


View Profile
June 13, 2012, 12:33:40 AM
 #7

has the candidate for this been chosen yet theymos?
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 13, 2012, 01:02:32 AM
 #8

has the candidate for this been chosen yet theymos?

No.

Do you want a direct file edit or a modification format that the package manager can use? I'm comfortable with both; however, the latter could be a no-go for you for obvious security reasons.

Either is fine. I was thinking a non-modification patch, since that seems much easier to write.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
live627
Hero Member
*****
Offline Offline

Activity: 574


View Profile
June 13, 2012, 03:37:09 AM
 #9

I'm willing to do this.
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
June 16, 2012, 03:09:26 PM
 #10

Just saw this post. I've taken a quick look and I believe I can do this as an SMF mod. Among my other qualifications I help run another SMF forum you may have heard of.

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 18, 2012, 04:10:40 AM
 #11

I've offered the job to error.

Thanks to all applicants for your interest!

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
error
Hero Member
*****
Offline Offline

Activity: 574



View Profile
July 11, 2012, 12:42:39 AM
 #12

This probably doesn't even need to be said, but theymos paid on time and in full. Not to mention it was a pleasure to work with him on this little project. I'm happy, and I am standing by in case there are any unforeseen issues.

15UFyv6kfWgq83Pp3yhXPr8rknv9m6581W
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
July 11, 2012, 12:53:27 AM
 #13

This probably doesn't even need to be said, but theymos paid on time and in full. Not to mention it was a pleasure to work with him on this little project. I'm happy, and I am standing by in case there are any unforeseen issues.

Thank you for your nice work on this.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Maged
Legendary
*
Offline Offline

Activity: 1260


View Profile
July 11, 2012, 07:31:42 AM
 #14

Fantastic job on this, both of you!

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!