您可以在此查看JQuery Qaptcha演示-http://www.myjqueryplugins.com/QapTcha/demo
它需要您滑动滑块来解锁并证明您是人类。我已经了解到它是如何设置随机字段值并清除它们的所有信息,但这不是通过JavaScript调用完成的吗?如果是这样,那么机器人是否只需要运行JavaScript方法,然后Qaptcha就被破解了呢?
请帮助我理解这是如何保证安全的...
您可以在此查看JQuery Qaptcha演示-http://www.myjqueryplugins.com/QapTcha/demo
它需要您滑动滑块来解锁并证明您是人类。我已经了解到它是如何设置随机字段值并清除它们的所有信息,但这不是通过JavaScript调用完成的吗?如果是这样,那么机器人是否只需要运行JavaScript方法,然后Qaptcha就被破解了呢?
请帮助我理解这是如何保证安全的...
很遗憾,这个验证码似乎不安全。
本文末尾有一些可以绕过它的示例代码。我编写了此脚本,没有查看任何源代码(php或javascript)。我只是嗅探了几个HTTP请求,看到了它在做什么,并试图模拟它。现在我已经查看了他们的JS代码,但还没有查看PHP,所以即使没有看到任何源代码,也可以绕过它。
根据成功和失败的快速猜测:
它能否变得更加安全?在我看来不容易。为了安全起见,密钥必须存储在服务器上,并且不能通过任何脚本或HTTP请求轻松获取。也就是说,基于某些公共值进行身份验证的Ajax请求仍然可以使用Ajax或HTTP请求进行欺骗,例如下面的示例。基本上,验证码解决方案必须存储在服务器上,并由人类(希望不是计算机)解释并发送回服务器。
这是您可以运行以绕过它的代码。基本上,如果您运行此代码,则会看到:
Form can be submited
First Name : A Test
Last Name : Of Qaptcha
<?php
$COOKIE_FILE = '/tmp/cookies.txt'; // The cookie file to use for storing the PHP session ID cookie
$FIRST_NAME = 'A Test'; // first name to send
$LAST_NAME = 'Of Qaptcha'; // last name to send
if (file_exists($COOKIE_FILE)) unlink($COOKIE_FILE); // clear cookies on start - just prevents re-using the same PHPSESSID over and over
$fake_qaptcha_key = 'thisIsAFakeKey12345'; // arbitrary qaptcha_key - normally generated by client JavaScript
// fetch the form - this creates a PHP session and gives us a cookie (yum)
$first = fetch_url('http://demos.myjqueryplugins.com/qaptcha/');
// This step is important - this stores a "qaptcha_key" in the PHP session that matches our session cookie
// We can make the key up in this step, it doesn't matter what it is or where it came from
$params = array('action' => 'qaptcha', 'qaptcha_key' => $fake_qaptcha_key);
$second = fetch_url('http://demos.myjqueryplugins.com/qaptcha/php/Qaptcha.jquery.php', 'POST', $params);
// Now submit the form along with the same qaptcha_key we told the server about in the last step
// As long as a form field is submitted that has the same name as the qaptcha_key we just told the server about, the captcha is bypassed
$params = array('firstname' => $FIRST_NAME, 'lastname' => $LAST_NAME, $fake_qaptcha_key => '', 'submit' => 'Submit Form');
$third = fetch_url('http://demos.myjqueryplugins.com/qaptcha/', 'POST', $params);
// echo the contents so you can see it said form was accepted.
echo $third;
// basic function that uses curl to fetch a URL with get/post
function fetch_url($url, $method = 'GET', $params = array())
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIEJAR, $GLOBALS['COOKIE_FILE']);
curl_setopt($ch, CURLOPT_COOKIEFILE, $GLOBALS['COOKIE_FILE']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($method == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
}
$return = curl_exec($ch);
return $return;
}