This is a old thread but latest news made it relevant.
Last September I decided to drop it because people seems a little too
opinionated and willing not listening.
I hope that after the Linkedin's leak of 6.5M hashs and crack of a few of
the associated passwords (see http://shiflett.org/blog/2012/jun/leakedin )
people became more sensitive (BTW, my password was one of those leaked and
cracked).

Markstory wrote this article:
http://mark-story.com/posts/view/using-bcrypt-for-passwords-in-cakephp

However for how bcrypt is implemented in the article (fixed salt), the
security is diminished.
bcrypt can be far more secure, when it uses variable salts that as far as
we know today, make the rainbow tables approach impossible to be used to
crack a large DB of password.

My initial email in this thread was talking about the changes necessary in
Cakephp internals to be able to use variable salts (see below). In our
company we had to do those changes to be able to use bcrypt.

Since it is not that much work, I hope that those changes would be
implemented in the next version of cake and make the user of websites that
use cakephp more secure.

Best,
   Chris

P.S.: Those are the changes necessary to be able to use bcrypt with
variable salts:

1) bcrypt_hash($new_password);
and
2)bcrypt_check($entered_password, $password_in_DB);

Cake auth module has the assumption that the authentication will be made
through a hash. You can find multiple time in the code, this pattern:
if ($password_in_db == hashPassword($entered_password)) {//The password is
good

In order to make bcrypt works, you need to have

create_password($p)
verify_password($pDB, $p)

in the case you do not believe in bcrypt (
http://codahale.com/how-to-safely-store-a-password/ )  and you still want
to use a hash, you can use:

create_password($p)
{
       return SHA1($p);
}

and

verify_password($pDB, $p)
{
      return $pDB === SHA1($p);
}

But you can also use bcrypt with variable hash:

create_password($p)
{
       return bcrypt_hash($p);
}

and

verify_password($pDB, $p)
{
      return bcrypt_check($pDB, $p);
}

This gist and the related ones have a good implementation:
https://gist.github.com/1053158



On Wed, Sep 14, 2011 at 1:00 AM, Tonu Tusk <[email protected]> wrote:

> Chris, if you are saying that a system that has a repo / db of sha1
> passwords is vulnerable * ONLY * based on the fact that someone has
> access to the app server (to acquire the salt), then your bcrypt
> doesn't help in many siutations either.
>
> If somebody had access to your server, what is stopping them from
> altering the login script / pages and just grabbing raw passwords that
> are submitted from people, before they even get passed on to the
> hashing and subsequent intended authentication procedure?
>
> I know that this requires an undetected crack on the app rather than a
> drive by grab all user details at once, but even so, if you are going
> to use general server insecurity as a comment of the suitability of
> part of a system (hash algorithm), the same has got to be applied back
> to your argument.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
--Everything should be made as simple as possible, but not simpler (Albert
Einstein)

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to