views:

135

answers:

4

I am designing a simple registration form in ASP.net MVC 1.0 I want to allow the username to be validated while the user is typing (as per the related questions linked to below)

This is all easy enough. But what are the security implications of such a feature?

How do i avoid abuse from people scraping this to determine the list of valid usernames?

some related questions: 1, 2

A: 

you could limit the number of requests to maybe 2 per 10 seconds or so (a real user may put in a name that is taken and modify it a bit and try again). kind of like how SO doesn't let you comment more than once every 30 seconds.

if you're really worried about it, you could take a method above and count how many times they tried in a certain time period, and if it goes above a threshold, kick them to another page.

Jason
I was considering a security 'token' that needs to be in the requestthe token is good for xx number of queries
Harry
Perhaps limiting the number of queries per IP address is a better way to go
Harry
you could go through all the mess of tokens and hashing and whatnot, but i personally believe limiting requests per IP is easier and just as effective, especially if you're not requiring "enterprise level" security
Jason
@jason I attempted to signup at a website recently and within one minute had gone through about 15 names, none of which were valid, I don't think that IP limiting is worth it either users will become frustrated if they cant find a name and cant continue to try, hashing is simple and effective, assuming they don't know your salt, they cannot check names without being on your website.
Unkwntech
@unkwntech - if you are a real person, you probably can't check more than 2 names every 10 seconds anyways. if you are a computer, you can send hundreds of requests in one second. if you really want to split hairs, go for 3 requests in 10 seconds.
Jason
A: 

Validated as in: "This username is already taken"? If you limit the number of requests per second it should help

SeanJA
yes as in "is this username available?"
Harry
+2  A: 

To prevent against "malicious" activities on some of my internal ajax stuff, I add two GET variables one is the date (usually in epoch) then I take that date add a salt and SHA1 it, and also post that, if the date (when rehashed) does not match the hash then I drop the request otherwise fulfill it.

Of course I do the encryption before the page is rendered and pass the hash & date to the JS. Otherwise it would be meaningless.

The problem with using IP/cookie based limits is that both can be bypassed. Using a token method with a good, cryptographically strong, salt (say something like one of Steve Gibson's "Perfect Passwords" https://www.grc.com/passwords.htm ) it would take a HUGE amount of time (on the scale of decades) before the method could reliably be predicted and there for ensures a certain amount security.

Unkwntech
This was my first thought as well. a security token
Harry
From my experience this is the most effective way, and it wont bother the users.
Unkwntech
this simply don't works! The hacker can replay the security token unless you use some database solution
VP
VP there is an assumption that I didn't state in the post, one must check the time, against the current time.
Unkwntech
A: 

One common way to solve this is simply by adding a delay in the request. If the request is sent to the server, wait 1 (or more) seconds to respond, then respond with the result (if the name is valid or not).

Adding a time barrier doesn't really effect users not trying to scrape, and you have gotten a 60-requests per minute limit for free.

msingleton
at the cost of a thread sleeping
Harry