Direct feedback elimination
This is more of a general strategy that can be combined with many of the other methods. Don’t let the spammer know if he succeeds.
You can either hide the current results altogether, only show percentages without absolute number of votes or delay the display of the votes.
- Pro: good against all methods
- Con: if the fraud is massive, percentage display and delay won’t be effective
Also a general strategy. If you have some reason to assume that the vote is by a spammer, count their vote and mark it as invalid and delete the invalid votes at the end.
- Pro: good against all detectable spam attacks
- Con: skews the vote, harder to set up, false positives
Use a CAPTCHA. If your Captcha is broken, use a better one.
- Pro: good against all automated scripts.
- Con: useless against pharygulation
Limit the number of votes an IP address can cast in a timespan.
- Pro: Good against random dudes who constantly hit F5 in their browser
- Pro: Easy to implement
- Con: Useless against Pharyngulation and elaborate scripts which use proxy servers.
- Con: An IP address sometimes maps to many different users
If you assume that one user maps one IP address, you can limit the number if votes by that IP address. However this assumption usually only holds true for private households.
- Pro: Easy to implement
- Pro: Good against simple pharyngulation to some extent
- Con: Very easy to circumvent by automated scripts
Use Email confirmation and only allow one vote per Email. Check your database manually to see if they are using throwaway-emails.
Note that you can add
+foo to your username in an email address.
[email protected] and
[email protected] will both deliver the mail to the same account, so remember that when checking if somebody has already voted.
- Pro: good against simple spam scripts
- Con: harder to implement
- Con: Some users won’t like it
HTML Form Randomization
Randomize the order of choices. This might take a while for them to find out.
- Pro: nice to have anyways
- Con: once detected, very easy to circumvent
One method of vote faking is to capture the http request from a valid browser like Firefox and mimic it with a script, this doesn’t work as easy when you use encryption.
- Pro: nice to have anyway
- Pro: good against very simple scripts
- Con: more difficult to set up
If the spammer votes via proxy, you can check for the X-Forwarded-For header.
- Pro: good against more advanced scripts that use proxies
- Con: some legitimate users can be affected
Try to see if the client loads all the uncached resources.
Many spambots don’t do this. I never tried this, I just know that this isn’t checked usually by voting sites.
An example would be embedding
<img src="https://stackoverflow.com/questions/2333054/a.gif" /> in your html, with a.gif being some 1×1 pixel image. Then you have to set the http header for the request
GET /a.gif with
Cache-Control "no-cache, must-revalidate". You can set the http headers in Apache with your
.htaccess file like this. (thanks Jacco)
- Pro: uncommon method as far as I know
- Con: slightly harder to set up
- A so-called evercookie can be useful to track browser-based spammers