看起来我们将为Stack Overflow添加CAPTCHA支持。这对于防止机器人、垃圾邮件发送者和其他恶意脚本活动是必要的。我们只希望人类在这里发布或编辑东西!

我们将使用JavaScript (jQuery)验证码作为第一道防线:

http://docs.jquery.com/Tutorials:Safer_Contact_Forms_Without_CAPTCHAs

这种方法的优点是,对于大多数人来说,CAPTCHA永远不会可见!

然而,对于禁用JavaScript的人,我们仍然需要一个备用方案,这就是棘手的地方。

我为ASP编写了一个传统的CAPTCHA控件。NET,我们可以重复使用。

但是,我更倾向于使用一些文本化的东西,以避免为每个请求在服务器上创建所有这些图像的开销。

我见过这样的事情…

ASCII文本验证码:\/\/(_)\/\/ 数学难题:7减3乘以2等于多少? 小问题:癞蛤蟆和冰棍,哪个更好吃?

也许我只是在风车这里倾斜,但我希望有一个更少的资源密集型,非图像为基础的<noscript>兼容的验证码,如果可能的话。

想法吗?


当前回答

我想他们正在研究节流。对于500+ rep的用户禁用CAPTCHA并为攻击者重置rep会更有意义。

其他回答

If the main issue with not using images for the captcha is the CPU load of creating those images, it may be a good idea to figure out a way to create those images when the CPU load is "light" (relatively speaking). There's no reason why the captcha image needs to be generated at the same time that the form is generated. Instead, you could pull from a large cache of captchas, generated the last time server load was "light". You could even reuse the cached captchas (in case there's a weird spike in form submissions) until you regenerate a bunch of new ones the next time the server load is "light".

Make an AJAX query for a cryptographic nonce to the server. The server sends back a JSON response containing the nonce, and also sets a cookie containing the nonce value. Calculate the SHA1 hash of the nonce in JavaScript, copy the value into a hidden field. When the user POSTs the form, they now send the cookie back with the nonce value. Calculate the SHA1 hash of the nonce from the cookie, compare to the value in the hidden field, and verify that you generated that nonce in the last 15 minutes (memcached is good for this). If all those checks pass, post the comment.

This technique requires that the spammer sits down and figures out what's going on, and once they do, they still have to fire off multiple requests and maintain cookie state to get a comment through. Plus they only ever see the Set-Cookie header if they parse and execute the JavaScript in the first place and make the AJAX request. This is far, far more work than most spammers are willing to go through, especially since the work only applies to a single site. The biggest downside is that anyone with JavaScript off or cookies disabled gets marked as potential spam. Which means that moderation queues are still a good idea.

从理论上讲,这可以作为通过模糊性的安全,但在实践中,这是很好的。

我从未见过垃圾邮件发送者试图破解这种技术,尽管可能每隔几个月我就会收到一个手动输入的主题垃圾邮件条目,这有点怪异。

我编写了一个相当大的新闻网站,一直在摆弄验证码和分析垃圾邮件机器人。

我所有的解决方案都是针对中小型网站的(就像这个主题中的大多数解决方案一样) 这意味着他们可以防止垃圾邮件机器人发布,除非他们为你的网站(当你很大的时候)制定了特定的解决方案。


我发现一个很好的解决方案是垃圾邮件机器人不会访问你的文章后48小时后,你发布它。 由于新闻网站上的一篇文章在发布后48小时内就能获得大部分浏览量,因此它允许非注册用户在无需输入验证码的情况下发表评论。


我见过的另一个很好的验证码系统是WebDesignBeach做的。 你有几个对象,你必须拖放一个到一个特定的区域。很有创意,不是吗?

你不只是想让人类发帖。你需要能够讨论编程主题的人。所以你应该有一个验证码,比如:

下面的C函数声明是什么意思:char *(*(**foo [][8])())[];?

=)

我知道没人会读这篇文章,但是狗和猫的验证码呢?

你需要分辨出哪个是猫,哪个是狗,机器做不到。 http://research.microsoft.com/asirra/

是一个很酷的…