hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

crypt(): raise a notice if no salt

Open denji opened this issue 12 years ago • 7 comments

5.6.0 Raise E_NOTICE security warning if salt is omitted.

Result: http://3v4l.org/8K3Ob In recent releases of php appears unsafe behavior in the absence of salt:

hhvm-3.0.1 - 3.4.0:

string(34) "$1$bJoWf/..$mTgm1g69VfN9GIbOKxYPv0"
string(34) "$1$4DmSm...$LT1vPcM6123p5LRkQVZrs1"
string(34) "$1$dV7DY/..$pZStzg9hvGAcTg5clHhqp."

Output for 5.6.3:

Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in /in/8K3Ob on line 4

Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in /in/8K3Ob on line 5

Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in /in/8K3Ob on line 6
string(34) "$1$YNMNnxw2$CdQixoEVsaI6XjVyjB1dZ1"
string(34) "$1$Led6ElOJ$WhfQd3/YD0OAyine4P7yD."
string(34) "$1$toyOWA0X$QLYH3zVNmjAVhavpAlfQN0"

In addition to the above, there are performance issues: http://3v4l.org/8K3Ob/perf#tabs

denji avatar Dec 01 '14 08:12 denji

I will work on it

hamidre13 avatar Dec 02 '14 00:12 hamidre13

message crypt() no salt parameters specified.you must use a randomly generated salt and strong hash function to a produce secure hash.

How to solve the problem?

samaiyan avatar Mar 14 '15 04:03 samaiyan

@samaiyan You must use the Password Hashing API (password_hash, password_verify, password_needs_rehash) and Safe comparison for preventing time attack hash_equals (CSRF / hash compare).

For example, two safe mechanism of salt openssl_random_pseudo_bytes, mcrypt_create_iv.

If you are not specialist and will not be able to initialize a persistent vector for mcrypt (IV) the hash will be extremely weak, still recommend Hashing API.

password_hash is compatible with crypt

References:

denji avatar Mar 14 '15 04:03 denji

decription: i am using codeigniter framework. this issue only for latest PHP version. after signup just flash message.

error message: message crypt() no salt parameters specified.you must use a randomly generated salt and strong hash function to a produce secure hash.

How to solve the problem?can you help me....................

samaiyan avatar Mar 14 '15 05:03 samaiyan

decription: i am using codeigniter framework. this issue only for latest PHP version. after signup just flash message error.

error message:

PHP error was encountered; sevenity:Notice message crypt() no salt parameters specified.you must use a randomly generated salt and strong hash function to a produce secure hash. File path:libraries/Dx_auth.php Line number:0

But correct to work....

any change for my coding sir?

How to solve the problem?can you help me....................

                    Thank You

samaiyan avatar Mar 14 '15 05:03 samaiyan

hi gi,

decription: i am using codeigniter framework. this issue only for latest PHP version. after signup just flash message error.

error message:

PHP error was encountered; sevenity:Notice message crypt() no salt parameters specified.you must use a randomly generated salt and strong hash function to a produce secure hash. File path:libraries/Dx_auth.php Line number:0

samaiyan avatar Mar 14 '15 07:03 samaiyan

@samaiyan that sounds like a problem you should bring up with Code Igniter. It's not related to HHVM.

simonwelsh avatar Mar 14 '15 07:03 simonwelsh