开发者

Login Page security?

开发者 https://www.devze.com 2022-12-17 13:13 出处:网络
I have designed login page for one of our website where I have used following resources Login Name and Passowrd lable and textboxes

I have designed login page for one of our website where I have used following resources

  1. Login Name and Passowrd lable and textboxes
  2. Combo box for multilingual support
  3. Submit button.

Now to make this page more secure I am planning to use following extra points.

  1. CAPTCHA/ RE-CAPTCHA
  2. Number of Retry: block after 3 unsuccessfull login attempt.

I have seen these extra things by visiting other sites. I would like to know

  1. Whether these extar point makes somediffrence for security?
  2. How should we implement number of retry? When should we again unblock user account.
开发者_运维问答

What is right approach?


You could use ASP.NET's login control and the default SQL membership provider. If you do this, implementing the number of retries before a user is locked out is as easy as setting a config value.

Take a look at MSDN here, and scroll down to "Using the SQLMemberShipProvider" section.


Look at the NoBot control from the AjaxControlToolkit (http://www.asp.net/AJAX/AjaxControlToolkit/Samples/NoBot/NoBot.aspx). That provides some "bot protection" without the user needing to decipher a captcha.


  1. General - Require a strong password and limit the login tries/user (not IP/cookie). If you add a five minute lock-down for a user name after three fails a bruit force attack would take more years than you site will live (dictionary attacks are not possible since you require strong passwords)*.

  2. Protect your users - In your form, don't post the password in clear text, post a hashed version eg. md5([your domain] + [password]) The reason you add your domain is to protect the hash of the password from the server owner (you), so if your user DB get hacked the hashed passwords you stored are useless even if your users use the same password on multiple sites. If you like stronger hash you could look for some SHA version. Make a js script that replaces the password with the hashed one before sending. Remember to have this hash calculated on the registration page, never let the password be sent from the browser in clear text. You don't want to know it!

  3. http://en.wikipedia.org/wiki/Cross-site_request_forgery, also have your server sign the cookie values to make cookie forgery harder.

  4. Encryption - Either use TSL/SSL or get a RSA script and encrypt your form data with your severs public_key.

  5. Man-in-the-middle - The hardest threat to guard against, I guess that https is the easiest way but a trusted certificate costs money. If you self sign users today don't bather to look if it's the right cert or not, this requires too much form the users. Buy a cert or hope you don't have a man-in-the-middle.

I would never use re-captcha for login since a lock-down of user name is more effective and less disturbing for a user. Though re-captcha is good for account registration so you don't end up having a lot of scripted accounts.

  • Limiting login tries/username could be used to block a user to log in. Bruit force attacks are still available since they can attack a lot of usernames and not only one, thus keeping the attack under the limit/username block. But for a site with few (less than 10.000?) user accounts you should be quite safe.


  1. If you are updating an existing site that has had security issues, captcha can't hurt. If it is a new site, is it public or for internal use? You can always add this later if you run into issues. If there are sensitive materials, you'll get more mileage out of enforcing strong passwords from users (though this can be annoying to them) than you'll get out of captcha (also annoying).
  2. Several options here. You can record IP address on each attempted login and record failed attempts. 3rd fail from same IP inside of 15 minutes blocks further attempts (every attempt fails with locked account message). Additional attempts reset the 15-minute "timer." Really, there is no timer, but with each attempted login, the log it checked to see whether it has been locked within the last 15 minutes.

The login attempt log can be stored in many ways -- often a database table. There may be value in keeping a record of every login (in case there is ever a breach), or maybe you only want failed logins. Optionally, you could remove failed logins from the log when the user successfully logs in. You could have a database routine that cleans up the table from time to time of failed login records that have exceeded the waiting period (15 minutes, or whatever).

Obviously, 15 minutes is arbitrary -- this can be 1 minute or 24 hours or until the user calls your customer support line to get it reset.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号