Re: Encryption Question
- From: "shimmyshack" <matt.farey@xxxxxxxxx>
- Date: 14 Mar 2007 16:19:32 -0700
On 14 Mar, 22:21, "Richard Cornford" <Rich...@xxxxxxxxxxxxxxxxxxx>
wrote:
Bart Van der Donck wrote:
<snip>
One-way encryption from client on beforehand is secure
to change the password on one Conditio, which is that
the user must know the previous (encrypted) password.
E.g. if one posts the following to newpass.php:
oldEncPW=gH4tGhKLNx
newEncPW=yHjke4c5Wu
Then compare the old (stored) string to the sent
'gH4tGhKLNx'. If it matches, replace it by 'yHjke4c5Wu'.
No encryption needed at server side, and safe if it goes
over HTTPS.
(One common alternative that comes to mind is to use a
cookie where the old password is stored, so the user doesn't
need to retype it when he requests to change it.)
Isn't the problem with sending the password in plain text over HTTP that
someone may intercept the traffic and so acquire the password for later
use in gaining access that they are not entitled to?
However, if a 'hash' of the password is sent in plain text over HTTP, and
all the server knows is the 'hash' of the password, has the situation
really changed? What is to stop someone who knows the 'hash' of the
password inserting it into the appropriate location in an HTTP request
(by any of numerous means, including the executing of alien javascript on
the logon page)? Wouldn't the server recognise the intercepted 'hash' as
easily as it may have recognised the original password?
The advantage of HTTPS is that someone intercepting the HTTP traffic is
not going to find it easy to make any sense of what they observe.
Richard.
yes I fear that this is NOT secure. Take for instance the condition
that the user knows the previous password. The old password is stored
in the mysql database as SHA1 hash. (let us say for argument's sake
the old password was 'fred' and that the new is 'newpassword'
so the database contains the sha1 hash
$db_data = sha1('fred')
now the user typed in fred which with a salt was sha1'd by the client
and sent to the server.
js-> sha1(salt+sha1('fred'))
then sends this as hashed_data
the server must check that the user entered fred, but can only do this
by copying the procedure
server-> sha1($salt . $db_data ) and seeing if it is equal to what was
in the $_POST var
$_POST['hashed_data'].
Now what you are proposing is that the server checks this and when the
user has indeed verified that they know the old password, you then
_replace the old hash with sha1('newpassword')
now anyone listening to the traffic as Richard says now knows the new
hash they have eaves dropped
sha1('newpassword')
so the attacker just requests the logon page, gets given a new salt
and can now send this POST data (using some proxy or other or a header
editor)
$_POST['hashed_data'] = sha1( newsalt+sha1('newpassword') )
the attacker doesnt need to know the password.
The server accepts this and compares it against the database entry by
the smae method as before
server-> sha1($newsalt . $new_db_data )
where $new_db_data is sha1('newpassword')
they match and the attacker gets in
This shows that there is no security in sending the sha1(password)
where this string will then be directly stored in the database. I for
one _never use_ one way hashing to *change* passwords, only to
authenticate an existing one which *can* be secure I agree with you
there!
.
- Follow-Ups:
- Re: Encryption Question
- From: Bart Van der Donck
- Re: Encryption Question
- References:
- Encryption Question
- From: eggie5@xxxxxxxxx
- Re: Encryption Question
- From: David Dorward
- Re: Encryption Question
- From: Bart Van der Donck
- Re: Encryption Question
- From: eggie5@xxxxxxxxx
- Re: Encryption Question
- From: Bart Van der Donck
- Re: Encryption Question
- From: shimmyshack
- Re: Encryption Question
- From: Bart Van der Donck
- Re: Encryption Question
- From: shimmyshack
- Re: Encryption Question
- From: Bart Van der Donck
- Re: Encryption Question
- From: Richard Cornford
- Encryption Question
- Prev by Date: Re: add javascript on the fly
- Next by Date: Re: access the elements with no explicit id
- Previous by thread: Re: Encryption Question
- Next by thread: Re: Encryption Question
- Index(es):
Relevant Pages
|