Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm Currently working on an application in C#, trying to get a textbox to send the textBox.Text to HTML tag value... which works for everything else (ex. Username/email, D.O.B., Captcha), BUT won't work for the password on the site. Trust me, i have been researching this, and nothing works. But i have noticed if i go into the WebBrowser an start typing in the password textbox manually rather than through a button click/code, it works and it's password protected like so:
http://prntscr.com/4aorj1[^]

C#
WebBrowser.Document.GetElementById("account_password").SetAttribute("value", password.Text);
           WebBrowser.Document.GetElementById("confirmPasswordField").SetAttribute("value", password.Text);


http://prntscr.com/4aor1h[^]

The above code works for "confirmPasswordField" but not account_password. :/ It puts the "account_password" in PLAIN TEXT rather than password protected which is the problem.

http://prntscr.com/4aoqss[^]

If anyone could help, it would be greatly appreciated, any feedback would be helpful. Thank you for your time. :)
Posted
Updated 7-Aug-14 18:11pm
v2

1 solution

Forget plain text. Password can be sent in the form of cryptographic hash function; and only the hash should be stored and later used in authentication.

But even this would be unsafe, unless the connection itself is properly encrypted; it should use HTTPS, not HTTP:
http://en.wikipedia.org/wiki/HTTPS[^].

The idea behind this vulnerability is: at the moment when the password is first set up, the hash value can be eavesdropped by spying in the HTTP packages in transition. The person who captured the hash value won't know the original password, as well as anyone else except the person who knows it, but such person (the spy) can use this hash value later to impersonate the legitimate user, log in and access all the personal data. HTTPS can prevent this trick.

About the use of cryptographic hash function, please see my past answers:
i already encrypt my password but when i log in it gives me an error. how can decrypte it[^],
Decryption of Encrypted Password[^],
storing password value int sql server with secure way[^],
TCP Connection with username and password[^].

[EDIT — to answer OP's follow-up question on how on implementation of the function]

Everything is already implemented for you:

Client side: http://code.google.com/p/crypto-js[^].

Server side: http://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm%28v=vs.110%29.aspx[^].

Also, see my past answers I referenced above and Wikipedia articles to understand my warning against using MD5 or SHA-1. You can use the algorithm from SHA-2 family.

—SA
 
Share this answer
 
v5
Comments
BaSs_HaXoR 8-Aug-14 10:50am    
Thank you for your response and possible solution. Although, I'm not really worried about the security part of it at the moment. I just want it to work, for personal purposes. Although, security is important, i feel it's not very important for what I'm making this for. You say the password can be sent in the form of "cryptographic hash function". How hard would this method be and could i go about this using tamper data to get the hash?
Sergey Alexandrovich Kryukov 8-Aug-14 13:45pm    
Please see the update the answer. Will you accept it formally now (green "Accept" button).
—SA
BaSs_HaXoR 8-Aug-14 14:23pm    
Formally? I'm still don't quite understand. Your acting like you want me to accept it as an answer, without actually allowing me to understand how to make this work or even code this. I appreciate you trying to help, and i will accept a solution, that actually solves my issue. I am researching this, but have no clue on how to go about this still. I have never used the hashAlgorithm class before, and definitly don't know how to use it for getting the password box to set. Thanks.

I really do appreciate the help. I just have never done this before and would feel enlightened for how to do this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900