Security and Cryptography
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsSystem AdministrationSecurity and Cryptography

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 14th, 2000, 06:39 AM
gunja gunja is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 22 gunja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to gunja
We have a site that requires users to logon. I want to be able to send passwords non plaintext. I do not have a secure server, and do not want to use one. I just want to have a little bit of JavaScript in the html file (PHP generated), that sends an encrypted password and that the PHP script at the server end can decrypy, similat to the encrypt (I think thats what it is) funciton that is in Linux. Also can I store the password in the MySQL database we have setup as an encrypted string using the encrypt function, will that work?

Reply With Quote
  #2  
Old August 14th, 2000, 07:04 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>I want to be able to send passwords non plaintext. I do not have a secure server

Then you CAN'T.

>>that sends an encrypted password and that the PHP script at the server end can decrypy

CAN'T. Your users are to send original passwords (in clear-text), not the encrypted ones.

>>Also can I store the password in the MySQL database we have setup as an encrypted string using the encrypt function, will that work?

MySQL has its own encrypt way, it's not the same as the one you thought. So still, your users have to send clear-text password and let MySQL server to encrypt it.

Reply With Quote
  #3  
Old August 14th, 2000, 10:39 AM
gunja gunja is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 22 gunja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to gunja
Well you can using a JavaScript function to do it, I just wanted to know what the funciton was. There must be a way to fill in the password, when you click logon get a javascript function to encrypt the text and then send it! IT MUST BE POSSIBLE, PLEASE HELP! I've seen it done b4 and cant remember where!

Reply With Quote
  #4  
Old August 14th, 2000, 06:51 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Hehe. But the problem is, encrypting the password is done on the server side, not the client side. Whatever way you do it on the client side, you will be prompted for "WRONG PASSWORD".

Reply With Quote
  #5  
Old August 15th, 2000, 01:33 AM
benliong benliong is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 56 benliong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
And with JavaScript anyone can easily grap the code and possibly device a working password.

If you don't want to have SSI, the idea of using PHP MD5 one way encryption function comes to my mind. The users can't see the codes and you wouldn't be sending plain text password

just my two cents.

--Ben

Reply With Quote
  #6  
Old August 15th, 2000, 01:52 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>The users can't see the codes

Right

>>and you wouldn't be sending plain text password

Not really. Whatever server-side languages you use, without SSL, the transmission (between the client and the server) is always in clear-text. It doesn't matter your data is password or something else.

Just remember one simple logic, the password encryption is always done on the server side.
Password encryption and data transmission is entirely two different thingy.

Let's not get mixed up with password encryption. Just change the subject to "Sending data non plaintext " -> SSL is the way to go.


[This message has been edited by freebsd (edited August 15, 2000).]

Reply With Quote
  #7  
Old August 15th, 2000, 05:03 AM
gunja gunja is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 22 gunja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to gunja
OK I see now, that if I did encrypt the password on the client side, I would have to have a piece of script to do that on the client side. The encrypted password would be sent to the server who could then un encode it, and then test it against the database. BUT someone could take the JavaScript source code from the client, and work out the encryption and then catch the encrypted passwords from any clients and then decrypt them... Hmmmm.. Still it is a little better than sending it plaintext... Anyway I guess it can be done, but not much more security is going to be introduced, as the JavaScript encryption function could be read by anyone!

Reply With Quote
  #8  
Old August 15th, 2000, 05:35 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>The encrypted password would be sent to the server who could then un encode it

No. Let me explain once again. Let's not mention about JavaScript or whatever way to encrypt it. Let say your password is "123456" and the encrypted-value of it is "asfdjklflssls". If you send the encrypted-password "asfdjklflssls", the server wouldn't understand it because it doesn't match against original password "123456", and you would be prompt for "wrong password". That is, the server will attempt to encrypt "asfdjklflssls", that becomes "abcdefghij".

Ask yourself,
abcdefghij = 123456 or not???

It's all about ONE-WAY encryption. Always, the server is doing the password encryption no matter you encrypted it on the client side or not, the server will encrypt whatever password you entered in the password field.

Here is a real world example:

Let say a friend of yours stole the .htpasswd file from some site, the content of it looks like...

bob:ladfsafsfa
gunja:jafjlawerw
foo:flajlsdfjald

Then you go to that login page of that site and enter "foo" as your username and "flajlsdfjald" as the password for "foo". That wouldn't work because the server will encrypt "flajlsdfjald" and see if it matches against the unencrypted password of foo. That is, the server is doing the encryption part.

Reply With Quote
  #9  
Old August 15th, 2000, 08:05 AM
benliong benliong is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 56 benliong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Question for freebsd, so if I use some sort of one way encrption function (example being MD5() in PHP), we'll still be sending plain-text version of the password through the net if we don't use SSI?

Reply With Quote
  #10  
Old August 15th, 2000, 01:54 PM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>we'll still be sending plain-text version of the password through the net if we don't use SSI?

Without SSL, YES. Why you guys always got mixed up with password encryption and data transmission??

Reply With Quote
  #11  
Old August 16th, 2000, 04:21 AM
gunja gunja is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 22 gunja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to gunja
What I was trying to say is that you could encrypt it using a function within the Client. But anyone looking at the sourcecode could work out the reverse (the function that exists in the PHP SERVER script), the PHP could then check the password against the values in the MySQL database, any way I understand that it wouldnt add much security to anyone who had the time to work out the function.

What I was saying for example the Java Script would do this:

Password: 123456
The Java Script wopuld run its function and create the encrypted password (say reverse):
Encry pass: 654321
This would then be sent, and the PHP script would reverse it again! Whatever the method of hiding the passwords, the reverse function could be worked out from the script, and therefore reduces the security. That was what I was trying to say!! But I take your point freeBSD cheers for your help!!

Reply With Quote
  #12  
Old August 16th, 2000, 05:58 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>Encry pass: 654321
>>This would then be sent, and the PHP script would reverse it again!

If you are saying reversing, then that's not password encrypting. It's your predefined way for password checking. All users would have to reverse their password in the password box and let the script to reverse back, then encrypt it (on server side) to check against the original one. But doing so would drive your users away.

Let say bob's password is "123456". But he has to enter "654321" (transmitting as 654321) and let the server to reverse it back to "123456", then encrypt it.

This redundant method only works with PHP authentication but not with htaccess/htpasswd combo.

Reply With Quote
  #13  
Old August 18th, 2000, 12:49 AM
fcatz fcatz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 1999
Posts: 12 fcatz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
But what would stop you from creating both a public and private key in javascript? Then u could actually have a lightweight public key encryption system. Only problem is.. you need a pretty good random number generator, which i really doubt can be done in javascript as you dont have access to anything remotely random. Guess it can still be done but it will be crackable within minutes from looking at how random numbers were generated (most likely some time() function).

Cheers

Reply With Quote
  #14  
Old August 18th, 2000, 01:47 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>But what would stop you from creating both a public and private key in javascript?

Without SSL, whatever you do on the client side or server side, your password will still be transmitted in clear-text.

Maybe you should find out what is the differences between Telnet and ssh/ssh2.

Reply With Quote
  #15  
Old August 18th, 2000, 03:19 PM
schyman schyman is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 2 schyman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
However, one way to do this in a semi-secure way (it is easily crackable, but atleast you won´t send the password as-is over http):

Upon submitting the form, have a client-side javascript alter the entered password with some kind of function. Then have a php-script reverse the altered password, and then check it with the password in the database.

Eg:
Entered password:
1234
client-side altered password:
2345 (every char incresed with 1)

2345 is being passed as clear-text over insecure http-connection.

php-script reads the variable and decreases every char with 1; password is again:
1234

php verifies if the decoded password match the password in the mysql-db. This can be done in several ways, the easiest being to have a field "password" in the user-table which contains the users password in clear-text. However, security won't be high unless you make sure that only localhost can connect to the db and check your grants.

To make this a bit more secure you could always make the encyption (increasing every char with 1) a little more difficult arithmetic operation. But as long as you use javascript to encode the password, anyone will be able to figure out how the encryption is done and decode it.

Maybe freebsd should look at the differences between clear-text and as-is.

[This message has been edited by schyman (edited August 18, 2000).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationSecurity and Cryptography > Sending passwords non plaintext

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap