VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: andrey on May 02, 2012, 13:59:18 PM

Title: Is it safe to generate passwords like that?
Post by: andrey on May 02, 2012, 13:59:18 PM
While looking into virtuemart source, I notice, that you guys generate passwords for order like that:
$_orderData->order_pass = 'p_'.substr( md5((string)time().$_orderData->order_number ), 0, 5);

Is is safe? I mean, if somebody knows the order number and knows the day, when order was created, it is only 86400 possible passwords! There are only 86400 seconds in a day. And that number will be lower, if approximate time of the order is known.
Title: Re: Is it safe to generate passwords like that?
Post by: Milbo on May 02, 2012, 17:01:10 PM
You need also to know the order_number, and the order number is also using a "password". But you are not completly wrong, why not just adding a rand.
Title: Re: Is it safe to generate passwords like that?
Post by: Studio 42 on May 02, 2012, 18:22:55 PM
86400 * X possibles ordernumbers = possible results or something so or not ?
All 2 are random numbers
IN brut force ou can always find a password. BUt in how many time?
Eg. If you have the Joomla loggin . How long to find the Password for an account in brute force ?
loggin : admin , password : 123 is valid in joomla
Title: Re: Is it safe to generate passwords like that?
Post by: andrey on May 03, 2012, 06:35:36 AM
I'm not saying that it is an issue. It just looks a bit suspicious. And probably in some situations somebody can guess the password, knowing only order number.
Quote from: Electrocity on May 02, 2012, 18:22:55 PM
All 2 are random numbers
Right now they are not random, they depend on each other. Add some random numbers and we are totally safe  ;)
Title: Re: Is it safe to generate passwords like that?
Post by: Milbo on May 03, 2012, 12:05:14 PM
already done, as I said in my first answer