views:

193

answers:

8

I'm creating a website and I don't want to have user/membership.

However, people using the site can do things like vote and flag questionable content. Is the only way to identify and prevent users from doing this repeatedly by using cookies?

I realize a user can just clear their cookies but I can't think of another way.

Suggestions for this scenario?

A: 

Yes, you are right.

HTTP is stateless, so there is no way of determining if the origin of a request you receive now is the same or different to the origin of a request you received, say, 5 minutes ago.

Cookies are the only way around this. Even server side sessions rely on cookies to maintain session identity across requests (ignoring the security nightmare of passing the sesison ID in the URL, which anyone with malicious intent can sidestep trivially).

Visage
A: 

Cookies are not enough, as you said it could be cleared/expired.

IP address tracking is also not an option because of DHCP and firewalls.

The only thing that is ~100% sure is users, but then again, one person can register multiple accounts.

I'll go with cookies, as the simplest ant least obtrusive way. If someone really wants to play the system, he will find a way whatever you try to prevent it.

Dev er dev
+4  A: 

Well you could map a cookie + ip-adress in a datarecord in your database. To identify the user. So if the ip exists in the database, you simply just add the cookie, but check the cookie first to avoid unessesary database calls.

This is not optimal though, since schools etc might have the same ips on a lot of computers.

You can always just adapt openid!

Filip Ekberg
A: 

Even with membership a user can register multiple times and vote.

Cookies are one way to handle this but people who know that they can delete cookie can vote again.

You can catch the IP of the voter and restrict based on that. But many people will have same IP.

Sadly there is no other way.

Bhushan
+1  A: 

Marko & Visage are correct,

Just to add though, you might want to store each vote with the timestamp,IP, etc... so at least if someone does try to "game" your site, you'd be able to rollback sets of votes made from the same location or within a very short amount of time (i.e. from a bot)

Eoin Campbell
A: 

+1 To all that others have already said. Here's another middle-way idea:

Use cookies as primary means of limiting voting. If a cookie is not found, check the IP address. Allow no more than, say, 1 vote per 5 minutes from the same IP.

Vilx-
A: 

There will always be people gaming the system if it suits them. Moreover, if you make it such that you don't need cookies at all you'd be open to very simple attacks.

I think you'll want to consider ways to increase the economic cost of users operating under a cloud of suspicion.

For example, if a user with the same cookie tries to re-submit the vote, that can obviously be stopped easily.

If a user with a different cookie but from the same IP does the same thing, it could be coming from a proxy/firewall so you may want to be cautious and force them to do something extra, like a simple CAPTCHA. Once they've done this, if they behave properly nothing new is required as long as their new cookie stays with them.

This implies that people without cookies can still participate, but they have to re-enter the letter sequence or whatever each time. A hassle, but they're likely used to sites not working without cookies. They'd be able to make an exception if required.

You really won't be able to deal with users sitting over a pool of IPs (real or otherwise) and exploiting new and dynamic attack vectors on your site. In that case, their economic investment will be more than yours and, frankly, you'll lose. At that point, you're just competing to maintain the rules of your system. That's when you should explore requiring signup/email/mobile/SMS confirmation to up the ante.

Joe Liversedge
A: 

You can add GET variables and URL parts to serve as cookies - some sites do that to allow logins and/or tracking when cookies are disabled. Generate the part using source IP and user agent string, for example.

site.com/vote?cookie=123456

site.com/vote/cookie123456

MaxVT