看起来我们将为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>兼容的验证码,如果可能的话。
想法吗?
这里的一些人声称解决方案从未被机器人破坏过。我认为问题在于,你也不知道有多少人没有通过“验证码”。
一个网站不能变得对人类用户非常不友好。这似乎是在互联网上做生意的代价,你必须处理一些手工工作来忽略垃圾邮件。拒绝用户的验证码(或类似的系统)比根本没有验证码更糟糕。
Admittedly, StackOverflow has a very knowledgeable audience, so a lot more creative solutions can be used. But for more run-of-the-mill sites, you can really only use what people are used to, or else you will just cause confusion and lose site visitors and traffic. In general, CAPTCHAs shouldn't be tuned towards stopping all bots, or other attack vectors. That just makes the challenge too difficult for legitimate users. Start out easy and make it more difficult until you have spam levels at a somewhat manageable level, but not more.
最后,我想回到基于图像的解决方案:你不需要每次都创建一个新的图像。您可以预先创建大量(可能几千个?),然后随着时间的推移慢慢地更改这个集合。例如,每10分钟或每小时过期100个最旧的图像,并用一组新的图像替换它们。对于每个请求,从整个验证码集中随机选择一个验证码。
当然,这无法承受直接攻击,但正如前面多次提到的,大多数验证码都无法承受。不过,这足以阻止随机机器人。
我会做一个简单的基于时间的验证码。
启用JavaScript:检查后时间减去加载时间大于HUMANISVERYFASTREADER。
禁用JavaScript: HTTP请求开始时间减去HTTP响应结束时间(存储在会话或隐藏字段中)大于HUMANISVERYFASTREADER加上NETWORKLATENCY乘以2。
在任何一种情况下,如果它返回真,那么你重定向到一个图像验证码。
这意味着大多数时候人们不需要使用图像验证码,除非他们的阅读速度非常快,或者垃圾邮件机器人设置为延迟响应。
注意,如果使用隐藏字段,我将为它使用一个随机id名称,以防bot检测到它被用作CAPTCHA并试图修改该值。
另一种完全不同的方法(只适用于JavaScript)是使用jQuery Sortable函数允许用户对一些图像进行排序。也许是一个小的3x3拼图。
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.
从理论上讲,这可以作为通过模糊性的安全,但在实践中,这是很好的。
我从未见过垃圾邮件发送者试图破解这种技术,尽管可能每隔几个月我就会收到一个手动输入的主题垃圾邮件条目,这有点怪异。
1)人工求解
这里提到的所有解都被人工求解方法所绕过。一个专业的垃圾邮件机器人拥有数百个连接,当它自己无法解决CAPTCHA时,它会将截图传递给远程人工解决者。
I frequently read that human solvers of CAPTCHAs break the laws. Well, this is written by those who do not know how this (spamming) industry works.
Human solvers do not directly interact with sites which CAPTCHAs they solve. They even do not know from which sites CAPTCHAs were taken and sent them. I am aware about dozens (if not hundreds) companies or/and websites offering human solvers services but not a single one for direct interaction with boards being broken.
The latter do not infringe any law, so CAPTCHA solving is completely legal (and officialy registered) business companies. They do not have criminal intentions and might, for example, have been used for remote testing, investigations, concept proofing, prototypong, etc.
2)基于上下文的垃圾邮件
AI(人工智能)机器人确定上下文,并在不同时间从不同的IP地址(不同国家)维护上下文敏感的对话。即使是博客的作者也经常不明白评论来自机器人。我不会说太多细节,但是,例如,机器人可以网络抓取人类对话,将它们存储在数据库中,然后简单地重用它们(一个短语一个短语),所以它们不会被软件甚至人类检测到是垃圾邮件。
投票最多的答案是:
*“理论是:
垃圾邮件机器人不支持JavaScript,只提交它看到的内容
如果机器人支持JavaScript,它会立即提交表单
评论者在发表“*”之前至少阅读了一些页面内容
还有蜜罐答案和这篇文章中的大多数答案都是完全错误的。
我敢说,这是一种注定会成为受害者的方法
大多数垃圾邮件机器人通过来自不同ip(不同国家)的本地和远程javascript感知(补丁和管理)浏览器工作,它们非常聪明地避开了蜜糖陷阱和蜜罐。
不同的问题是,即使是博客所有者也不能经常检测到来自机器人的评论,因为它们实际上来自人类对话和来自其他网络板(论坛,博客评论等)的评论。
3)概念上的新方法
抱歉,我把这部分去掉了